diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2018-05-24 16:03:42 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2018-05-24 16:03:42 -0400 |
| commit | 9a4d1e95ea7784f0f98ea2913701a3a3c28aefaa (patch) | |
| tree | b4307f58fe2197d2215707bb3f44cf8952229c6d /src/main/java/darkknight/jewelrycraft/effects | |
| parent | 4f7ad220df0438b6f3382110577b53f29da46453 (diff) | |
Formatting pass
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/effects')
5 files changed, 352 insertions, 212 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java b/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java index c735b2c..ebfa48c 100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java @@ -21,26 +21,32 @@ public class EffectBlazePowder extends ModifierEffects { }
@Override
- public void action(ItemStack item, EntityPlayer player, Item jewelry) {
+ public void action(ItemStack item, EntityPlayer player,
+ Item jewelry) {
if (jewelry instanceof ItemNecklace) {
// Positive for necklace
- if (player.isBurning() && rand
- .nextInt(JewelryNBT.numberOfModifiers(item)) == 0)
+ if (player.isBurning() && rand.nextInt(JewelryNBT
+ .numberOfModifiers(item)) == 0)
player.extinguish();
// Negative for necklace
if (player.isInWater())
- player.attackEntityFrom(DamageSource.drown, 1f
- + (JewelryNBT.numberOfModifiers(item) - 1) * 0.1F);
+ player.attackEntityFrom(DamageSource.drown,
+ 1f + (JewelryNBT.numberOfModifiers(
+ item) - 1)
+ * 0.1F);
}
// Negative for bracelet
- if (jewelry instanceof ItemBracelet && player.isInWater()) {
- double slowAmount = 0.6D
- + (JewelryNBT.numberOfModifiers(item) - 1) * 0.05D;
+ if (jewelry instanceof ItemBracelet
+ && player.isInWater()) {
+ double slowAmount = 0.6D + (JewelryNBT
+ .numberOfModifiers(item) - 1)
+ * 0.05D;
player.motionX *= slowAmount;
player.motionY *= slowAmount;
player.motionZ *= slowAmount;
- player.motionY -= (0.02D
- + (JewelryNBT.numberOfModifiers(item) - 1) * 0.005D);
+ player.motionY -= (0.02D + (JewelryNBT
+ .numberOfModifiers(item) - 1)
+ * 0.005D);
if (player.isCollidedHorizontally)
player.motionY = 0.30000001192092896D;
}
@@ -49,8 +55,8 @@ public class EffectBlazePowder extends ModifierEffects { if (player.getAir() >= 300)
player.setAir(player.getAir() / 2);
else
- player.setAir(player.getAir()
- - JewelryNBT.numberOfModifiers(item));
+ player.setAir(player.getAir() - JewelryNBT
+ .numberOfModifiers(item));
}
}
@@ -60,24 +66,28 @@ public class EffectBlazePowder extends ModifierEffects { float amount) {
// Balanced for ring
if (jewelry instanceof ItemRing && !player.isInWater()
- && rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0)
+ && rand.nextInt(JewelryNBT
+ .numberOfModifiers(
+ item)) == 0)
target.setFire(2);
return false;
}
@Override
public boolean onPlayerAttackedCancellable(ItemStack item,
- EntityPlayer player, DamageSource source, Item jewelry,
- float amount) {
+ EntityPlayer player, DamageSource source,
+ Item jewelry, float amount) {
if (jewelry instanceof ItemEarrings && rand.nextInt(4) == 0
&& source == DamageSource.lava
|| source == DamageSource.inFire
|| source == DamageSource.onFire) {
// Positive for earrings
- int stackSize = JewelryNBT.modifierSize(item, modifier);
+ int stackSize = JewelryNBT.modifierSize(item,
+ modifier);
- player.heal(stackSize * 0.05F
- - (JewelryNBT.numberOfModifiers(item) - 1) * 0.01F);
+ player.heal(stackSize * 0.05F - (JewelryNBT
+ .numberOfModifiers(item) - 1)
+ * 0.01F);
return true;
}
@@ -86,24 +96,26 @@ public class EffectBlazePowder extends ModifierEffects { if (source == DamageSource.inFire
|| source == DamageSource.onFire
|| source == DamageSource.lava
- && player.worldObj.isMaterialInBB(
- AxisAlignedBB.getBoundingBox(
- player.boundingBox.minX,
- player.boundingBox.minY,
- player.boundingBox.minZ,
- player.boundingBox.maxX,
- player.boundingBox.maxY - 0.7,
- player.boundingBox.maxZ),
- Material.lava)
- && !player.worldObj.isMaterialInBB(
- AxisAlignedBB.getBoundingBox(
- player.boundingBox.minX,
- player.boundingBox.minY + 0.9,
- player.boundingBox.minZ,
- player.boundingBox.maxX,
- player.boundingBox.maxY,
- player.boundingBox.maxZ),
- Material.lava)) {
+ && player.worldObj
+ .isMaterialInBB(AxisAlignedBB
+ .getBoundingBox(player.boundingBox.minX,
+ player.boundingBox.minY,
+ player.boundingBox.minZ,
+ player.boundingBox.maxX,
+ player.boundingBox.maxY
+ - 0.7,
+ player.boundingBox.maxZ),
+ Material.lava)
+ && !player.worldObj
+ .isMaterialInBB(AxisAlignedBB
+ .getBoundingBox(player.boundingBox.minX,
+ player.boundingBox.minY
+ + 0.9,
+ player.boundingBox.minZ,
+ player.boundingBox.maxX,
+ player.boundingBox.maxY,
+ player.boundingBox.maxZ),
+ Material.lava)) {
return true;
}
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java b/src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java index 6fcfac6..4f24e8f 100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java @@ -37,8 +37,7 @@ public class EffectEnderEye extends ModifierEffects { if (jewelry instanceof ItemRing) {
int viewDistance;
- if (Minecraft
- .getMinecraft().gameSettings.renderDistanceChunks <= 2) {
+ if (Minecraft.getMinecraft().gameSettings.renderDistanceChunks <= 2) {
viewDistance = 10;
} else {
viewDistance = Minecraft
@@ -52,127 +51,167 @@ public class EffectEnderEye extends ModifierEffects { @Override
public void onJewelryUnequipped(ItemStack item, Item jewelry) {
if (jewelry instanceof ItemRing)
- Minecraft.getMinecraft().gameSettings.setOptionFloatValue(
- Options.RENDER_DISTANCE, getViewDistance(item));
+ Minecraft.getMinecraft().gameSettings
+ .setOptionFloatValue(
+ Options.RENDER_DISTANCE,
+ getViewDistance(item));
}
@SuppressWarnings("cast")
@Override
- public void action(ItemStack item, EntityPlayer player, Item jewelry) {
- if (jewelry instanceof ItemEarrings && !player.worldObj.isRemote) {
- for (Object e : player.worldObj.getEntitiesWithinAABB(
- EntityEnderman.class,
- player.boundingBox.expand(100D, 0D, 100D))) {
+ public void action(ItemStack item, EntityPlayer player,
+ Item jewelry) {
+ if (jewelry instanceof ItemEarrings
+ && !player.worldObj.isRemote) {
+ for (Object e : player.worldObj
+ .getEntitiesWithinAABB(
+ EntityEnderman.class,
+ player.boundingBox
+ .expand(100D, 0D,
+ 100D))) {
EntityEnderman enderman = (EntityEnderman) e;
- ReflectionHelper.setPrivateValue(EntityEnderman.class,
- enderman, -1, "stareTimer", "field_70826_g");
+ ReflectionHelper.setPrivateValue(
+ EntityEnderman.class,
+ enderman, -1, "stareTimer",
+ "field_70826_g");
- Vec3 vec3 = player.getLook(1.0F).normalize();
+ Vec3 vec3 = player.getLook(1.0F)
+ .normalize();
Vec3 vec31 = Vec3.createVectorHelper(
enderman.posX - player.posX,
enderman.boundingBox.minY
- + (double) (enderman.height / 2.0F)
- - (player.posY
- + (double) player.getEyeHeight()),
+ + (double) (enderman.height
+ / 2.0F)
+ - (player.posY + (double) player
+ .getEyeHeight()),
enderman.posZ - player.posZ);
double d0 = vec31.lengthVector();
vec31 = vec31.normalize();
double d1 = vec3.dotProduct(vec31);
if (d1 > 1.0D - 0.025D / d0
- && player.canEntityBeSeen(enderman)) {
+ && player.canEntityBeSeen(
+ enderman)) {
// Positive earrings
- if (rand.nextInt(
- JewelryNBT.numberOfModifiers(item)) == 0)
+ if (rand.nextInt(JewelryNBT
+ .numberOfModifiers(
+ item)) == 0)
enderman.setTarget(null);
// Negative earrings
- if (!player.isPotionActive(Potion.confusion) || player
- .getActivePotionEffect(Potion.confusion)
- .getDuration() <= 80)
- player.addPotionEffect(new PotionEffect(
- Potion.confusion.id, 300,
- 2 + JewelryNBT.numberOfModifiers(item)
- / 4));
+ if (!player.isPotionActive(
+ Potion.confusion)
+ || player.getActivePotionEffect(
+ Potion.confusion)
+ .getDuration() <= 80)
+ player.addPotionEffect(
+ new PotionEffect(
+ Potion.confusion.id,
+ 300,
+ 2 + JewelryNBT.numberOfModifiers(
+ item)
+ / 4));
}
}
}
// Positive necklace
- if (jewelry instanceof ItemNecklace && !player.worldObj.isRemote) {
+ if (jewelry instanceof ItemNecklace
+ && !player.worldObj.isRemote) {
ChunkPosition chunkposition = player.worldObj
- .findClosestStructure("Stronghold", (int) player.posX,
- (int) player.posY, (int) player.posZ);
+ .findClosestStructure("Stronghold",
+ (int) player.posX,
+ (int) player.posY,
+ (int) player.posZ);
if (chunkposition != null) {
Minecraft.getMinecraft().thePlayer.motionX += 0.01D
* Math.signum((double) chunkposition.chunkPosX
- player.posX)
- * (rand.nextInt(
- JewelryNBT.numberOfModifiers(item)) == 0
- ? 1 : -1);
+ * (rand.nextInt(JewelryNBT
+ .numberOfModifiers(
+ item)) == 0 ? 1
+ : -1);
Minecraft.getMinecraft().thePlayer.motionZ += 0.01D
* Math.signum((double) chunkposition.chunkPosZ
- player.posZ)
- * (rand.nextInt(
- JewelryNBT.numberOfModifiers(item)) == 0
- ? 1 : -1);
+ * (rand.nextInt(JewelryNBT
+ .numberOfModifiers(
+ item)) == 0 ? 1
+ : -1);
}
}
// Positive bracelet
- if (jewelry instanceof ItemBracelet && !player.worldObj.isRemote
- && player.worldObj.getBiomeGenForCoords((int) player.posX,
+ if (jewelry instanceof ItemBracelet
+ && !player.worldObj.isRemote
+ && player.worldObj.getBiomeGenForCoords(
+ (int) player.posX,
(int) player.posZ) == BiomeGenBase.sky
- && (!player.isPotionActive(Potion.moveSpeed)
- || player.getActivePotionEffect(Potion.moveSpeed)
+ && (!player.isPotionActive(
+ Potion.moveSpeed)
+ || player.getActivePotionEffect(
+ Potion.moveSpeed)
.getDuration() < 30))
- player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id,
- 150 - JewelryNBT.numberOfModifiers(item) * 10,
- 2 - JewelryNBT.numberOfModifiers(item) / 5));
+ player.addPotionEffect(new PotionEffect(
+ Potion.moveSpeed.id,
+ 150 - JewelryNBT.numberOfModifiers(
+ item) * 10,
+ 2 - JewelryNBT.numberOfModifiers(
+ item) / 5));
// Negative bracelet
- if (jewelry instanceof ItemBracelet && !player.worldObj.isRemote
- && rand.nextInt(520
- - JewelryNBT.numberOfModifiers(item) * 20) == 15)
- player.setPositionAndUpdate(
- player.posX + rand.nextInt(30)
- * (rand.nextBoolean() ? -1 : 1),
- player.posY, player.posZ + rand.nextInt(30)
- * (rand.nextBoolean() ? -1 : 1));
+ if (jewelry instanceof ItemBracelet
+ && !player.worldObj.isRemote
+ && rand.nextInt(520 - JewelryNBT
+ .numberOfModifiers(item)
+ * 20) == 15)
+ player.setPositionAndUpdate(player.posX + rand
+ .nextInt(30)
+ * (rand.nextBoolean() ? -1 : 1),
+ player.posY,
+ player.posZ + rand.nextInt(30)
+ * (rand.nextBoolean()
+ ? -1
+ : 1));
// Negative ring
if (jewelry instanceof ItemRing && Minecraft
.getMinecraft().gameSettings.renderDistanceChunks != 2.2F
- - JewelryNBT.numberOfModifiers(item) * 0.1F)
- Minecraft.getMinecraft().gameSettings.setOptionFloatValue(
- Options.RENDER_DISTANCE,
- 2.2F - JewelryNBT.numberOfModifiers(item) * 0.1F);
+ - JewelryNBT.numberOfModifiers(
+ item)
+ * 0.1F)
+ Minecraft.getMinecraft().gameSettings
+ .setOptionFloatValue(
+ Options.RENDER_DISTANCE,
+ 2.2F - JewelryNBT
+ .numberOfModifiers(
+ item)
+ * 0.1F);
// Positive ring
if (jewelry instanceof ItemRing && rand.nextInt(
- 180 + JewelryNBT.numberOfModifiers(item) * 20) == 12) {
- for (int i = (int) player.posX - 2; i <= (int) player.posX + 2;
- i++)
- for (int j = (int) player.posY - 2;
- j <= (int) player.posY + 2; j++)
- for (int k = (int) player.posZ - 2;
- k <= (int) player.posZ + 2; k++)
- if (player.worldObj.getBlock(i, j,
- k) instanceof BlockOre)
+ 180 + JewelryNBT.numberOfModifiers(item)
+ * 20) == 12) {
+ for (int i = (int) player.posX
+ - 2; i <= (int) player.posX
+ + 2; i++)
+ for (int j = (int) player.posY
+ - 2; j <= (int) player.posY
+ + 2; j++)
+ for (int k = (int) player.posZ
+ - 2; k <= (int) player.posZ
+ + 2; k++)
+ if (player.worldObj
+ .getBlock(i, j, k) instanceof BlockOre)
player.addChatComponentMessage(
new ChatComponentText(
EnumChatFormatting.GRAY
- + StatCollector
- .translateToLocal(
- "chatmessage."
- + Variables.MODID
- + ".effect.endereye.1")
+ + StatCollector.translateToLocal(
+ "chatmessage." + Variables.MODID
+ + ".effect.endereye.1")
+ " "
+ player.worldObj
- .getBlock(i, j,
- k)
+ .getBlock(i, j, k)
.getLocalizedName()
+ " "
- + StatCollector
- .translateToLocal(
- "chatmessage."
- + Variables.MODID
- + ".effect.endereye.2")));
+ + StatCollector.translateToLocal(
+ "chatmessage." + Variables.MODID
+ + ".effect.endereye.2")));
}
}
@@ -180,12 +219,17 @@ public class EffectEnderEye extends ModifierEffects { public void onPlayerAttacked(ItemStack item, EntityPlayer player,
DamageSource source, Item jewelry, float amount) {
// Negative necklace
- if (jewelry instanceof ItemNecklace && !player.worldObj.isRemote)
- player.addPotionEffect(new PotionEffect(Potion.blindness.id,
- 100 + JewelryNBT.numberOfModifiers(item) * 30, 1));
+ if (jewelry instanceof ItemNecklace
+ && !player.worldObj.isRemote)
+ player.addPotionEffect(new PotionEffect(
+ Potion.blindness.id,
+ 100 + JewelryNBT.numberOfModifiers(
+ item) * 30,
+ 1));
}
- public static void setViewDistance(ItemStack item, int viewDistance) {
+ public static void setViewDistance(ItemStack item,
+ int viewDistance) {
NBTTagCompound itemStackData;
if (item.hasTagCompound())
itemStackData = item.getTagCompound();
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectEnderPearl.java b/src/main/java/darkknight/jewelrycraft/effects/EffectEnderPearl.java index 0b48ba2..562d83e 100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectEnderPearl.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectEnderPearl.java @@ -27,57 +27,86 @@ public class EffectEnderPearl extends ModifierEffects { }
@Override
- public void action(ItemStack item, EntityPlayer player, Item jewelry) {
+ public void action(ItemStack item, EntityPlayer player,
+ Item jewelry) {
if (jewelry instanceof ItemEarrings) {
- AxisAlignedBB axisalignedbb =
- player.boundingBox.expand(2.0D, 2.0D, 2.0D);
- List<?> list = player.worldObj.getEntitiesWithinAABB(
- EntityArrow.class, axisalignedbb);
+ AxisAlignedBB axisalignedbb = player.boundingBox
+ .expand(2.0D, 2.0D, 2.0D);
+ List<?> list = player.worldObj
+ .getEntitiesWithinAABB(
+ EntityArrow.class,
+ axisalignedbb);
if (!player.worldObj.isRemote && list != null
&& !list.isEmpty()) {
Iterator<?> iterator = list.iterator();
while (iterator.hasNext()) {
- EntityArrow arrow = (EntityArrow) iterator.next();
+ EntityArrow arrow = (EntityArrow) iterator
+ .next();
if (arrow.shootingEntity == null
- || !(arrow.shootingEntity.equals(player)))
+ || !(arrow.shootingEntity
+ .equals(player)))
// Negative earrings
- if (rand.nextInt(30) == 0) {
- arrow.worldObj.createExplosion(new EntityTNTPrimed(arrow.worldObj), arrow.posX, arrow.posY, arrow.posZ, 2F, true);
- arrow.setDead();
+ if (rand.nextInt(
+ 30) == 0) {
+ arrow.worldObj.createExplosion(
+ new EntityTNTPrimed(
+ arrow.worldObj),
+ arrow.posX,
+ arrow.posY,
+ arrow.posZ,
+ 2F,
+ true);
+ arrow.setDead();
}
// Positive earrings
else
- arrow.setPosition(arrow.posX + rand.nextInt(16) - rand.nextInt(16), arrow.posY + rand.nextInt(16), arrow.posZ + rand.nextInt(16) - rand.nextInt(16));
+ arrow.setPosition(
+ arrow.posX + rand
+ .nextInt(16)
+ - rand.nextInt(16),
+ arrow.posY + rand
+ .nextInt(16),
+ arrow.posZ + rand
+ .nextInt(16)
+ - rand.nextInt(16));
}
}
}
// Negative Necklace
if (jewelry instanceof ItemNecklace)
- player.addPotionEffect(
- new PotionEffect(Potion.resistance.id, 60, -10, true));
+ player.addPotionEffect(new PotionEffect(
+ Potion.resistance.id, 60, -10,
+ true));
// Negative bracelet
if (jewelry instanceof ItemBracelet && player.isInWater())
player.setPositionAndUpdate(
- player.posX + rand.nextInt(16) - rand.nextInt(16),
+ player.posX + rand.nextInt(16)
+ - rand.nextInt(16),
player.posY + rand.nextInt(4),
- player.posZ + rand.nextInt(16) - rand.nextInt(16));
+ player.posZ + rand.nextInt(16)
+ - rand.nextInt(16));
}
@Override
public void onPlayerAttacked(ItemStack item, EntityPlayer player,
DamageSource source, Item jewelry, float amount) {
// Positive Necklace
- if (jewelry instanceof ItemNecklace && source.getEntity() != null)
- source.getEntity().attackEntityFrom(source, amount);
+ if (jewelry instanceof ItemNecklace
+ && source.getEntity() != null)
+ source.getEntity().attackEntityFrom(source,
+ amount);
// Positive bracelet
- if (jewelry instanceof ItemBracelet && !player.worldObj.isRemote) {
+ if (jewelry instanceof ItemBracelet
+ && !player.worldObj.isRemote) {
int id = player.worldObj.provider.dimensionId;
if (player.getHealth() <= 6F)
if (player.getBedLocation(id) != null)
- player.setPositionAndUpdate(
- player.getBedLocation(id).posX,
- player.getBedLocation(id).posY,
- player.getBedLocation(id).posZ);
+ player.setPositionAndUpdate(player
+ .getBedLocation(id).posX,
+ player.getBedLocation(
+ id).posY,
+ player.getBedLocation(
+ id).posZ);
else
player.setPositionAndUpdate(
player.worldObj.getSpawnPoint().posX,
@@ -92,14 +121,19 @@ public class EffectEnderPearl extends ModifierEffects { if (jewelry instanceof ItemRing) {
// Negative ring
if (target instanceof EntityEnderman)
- player.addPotionEffect(new PotionEffect(Potion.weakness.id,
- 400, 2, true));
+ player.addPotionEffect(new PotionEffect(
+ Potion.weakness.id, 400, 2,
+ true));
// Positive ring
else
- target.setPosition(
- target.posX + rand.nextInt(16) - rand.nextInt(16),
- target.posY + rand.nextInt(4),
- target.posZ + rand.nextInt(16) - rand.nextInt(16));
+ target.setPosition(target.posX
+ + rand.nextInt(16)
+ - rand.nextInt(16),
+ target.posY + rand.nextInt(
+ 4),
+ target.posZ + rand.nextInt(
+ 16)
+ - rand.nextInt(16));
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectFeather.java b/src/main/java/darkknight/jewelrycraft/effects/EffectFeather.java index a7f2c8e..5235b7d 100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectFeather.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectFeather.java @@ -34,23 +34,29 @@ public class EffectFeather extends ModifierEffects { }
@Override
- public void action(ItemStack item, EntityPlayer player, Item jewelry) {
+ public void action(ItemStack item, EntityPlayer player,
+ Item jewelry) {
// Positive earrings
if (jewelry instanceof ItemEarrings) {
- AxisAlignedBB axisalignedbb =
- player.boundingBox.expand(1.0D, 1.0D, 1.0D);
- List<?> list = player.worldObj.getEntitiesWithinAABB(
- EntityArrow.class, axisalignedbb);
+ AxisAlignedBB axisalignedbb = player.boundingBox
+ .expand(1.0D, 1.0D, 1.0D);
+ List<?> list = player.worldObj
+ .getEntitiesWithinAABB(
+ EntityArrow.class,
+ axisalignedbb);
if (!player.worldObj.isRemote && list != null
&& !list.isEmpty()) {
Iterator<?> iterator = list.iterator();
while (iterator.hasNext()) {
- EntityArrow arrow = (EntityArrow) iterator.next();
+ EntityArrow arrow = (EntityArrow) iterator
+ .next();
if ((arrow.shootingEntity == null
- || !(arrow.shootingEntity.equals(player))
+ || !(arrow.shootingEntity
+ .equals(player))
|| arrow.canBePickedUp == 0)
- && rand.nextInt(2 + JewelryNBT
- .numberOfModifiers(item)) == 0)
+ && rand.nextInt(2
+ + JewelryNBT.numberOfModifiers(
+ item)) == 0)
arrow.setDead();
}
}
@@ -58,19 +64,24 @@ public class EffectFeather extends ModifierEffects { if (jewelry instanceof ItemBracelet) {
// Positive bracelet
if (player.motionY < 0)
- player.motionY *=
- (0.6D + (JewelryNBT.numberOfModifiers(item) - 1)
- * 0.03D);
- if (rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0)
+ player.motionY *= (0.6D + (JewelryNBT
+ .numberOfModifiers(item)
+ - 1) * 0.03D);
+ if (rand.nextInt(JewelryNBT
+ .numberOfModifiers(item)) == 0)
player.fallDistance = 0F;
// Negative bracelet
if (!player.isPotionActive(Potion.moveSlowdown)
- || player.getActivePotionEffect(Potion.moveSlowdown)
+ || player.getActivePotionEffect(
+ Potion.moveSlowdown)
.getDuration() < 30)
player.addPotionEffect(new PotionEffect(
Potion.moveSlowdown.id,
- 80 + JewelryNBT.numberOfModifiers(item) * 10,
- 1 + JewelryNBT.numberOfModifiers(item) / 4));
+ 80 + JewelryNBT.numberOfModifiers(
+ item) * 10,
+ 1 + JewelryNBT.numberOfModifiers(
+ item)
+ / 4));
}
}
@@ -79,24 +90,33 @@ public class EffectFeather extends ModifierEffects { EntityPlayer player, Entity target, Item jewelry,
float amount) {
NBTTagCompound enemyData = target.getEntityData();
- if (jewelry instanceof ItemRing && !player.worldObj.isRemote) {
+ if (jewelry instanceof ItemRing
+ && !player.worldObj.isRemote) {
if (enemyData.getInteger("reAttacked") == 0) {
// Negative ring
enemyData.setInteger("reAttacked",
- enemyData.getInteger("reAttacked") + 1);
- target.attackEntityFrom(
- DamageSource.causePlayerDamage(player),
- amount / (2F
- + (JewelryNBT.numberOfModifiers(item) - 1)
- * 0.3F));
+ enemyData.getInteger(
+ "reAttacked")
+ + 1);
+ target.attackEntityFrom(DamageSource
+ .causePlayerDamage(player),
+ amount / (2F + (JewelryNBT
+ .numberOfModifiers(
+ item)
+ - 1)
+ * 0.3F));
// Positive ring
if (rand.nextInt(2) == 0
&& target instanceof EntityLivingBase)
- ((EntityLivingBase) target).addPotionEffect(
- new PotionEffect(PotionList.stun.id,
- (51 - JewelryNBT
- .numberOfModifiers(item)) * 2,
- 0, false));
+ ((EntityLivingBase) target)
+ .addPotionEffect(
+ new PotionEffect(
+ PotionList.stun.id,
+ (51 - JewelryNBT.numberOfModifiers(
+ item))
+ * 2,
+ 0,
+ false));
return true;
}
enemyData.setInteger("reAttacked", 0);
@@ -106,21 +126,21 @@ public class EffectFeather extends ModifierEffects { @Override
public boolean onPlayerAttackedCancellable(ItemStack item,
- EntityPlayer player, DamageSource source, Item jewelry,
- float amount) {
+ EntityPlayer player, DamageSource source,
+ Item jewelry, float amount) {
// Positive necklace
- if (jewelry instanceof ItemNecklace
- && rand.nextInt(
- 3 + JewelryNBT.numberOfModifiers(item)) == 0
+ if (jewelry instanceof ItemNecklace && rand.nextInt(3
+ + JewelryNBT.numberOfModifiers(item)) == 0
&& source != DamageSourceList.weak
&& source != DamageSource.inFire
&& source != DamageSource.onFire
&& source != DamageSource.lava) {
player.addChatComponentMessage(
- new ChatComponentText(EnumChatFormatting.GRAY
- + StatCollector.translateToLocal(
- "chatmessage." + Variables.MODID
- + ".effect.feather")));
+ new ChatComponentText(
+ EnumChatFormatting.GRAY
+ + StatCollector.translateToLocal(
+ "chatmessage." + Variables.MODID
+ + ".effect.feather")));
return true;
}
// Negative necklace
@@ -129,13 +149,19 @@ public class EffectFeather extends ModifierEffects { || source == DamageSource.onFire
|| source == DamageSource.lava)
&& source != DamageSourceList.weak)
- player.attackEntityFrom(DamageSourceList.weak, amount * (3F
- + (JewelryNBT.numberOfModifiers(item) - 1) * 0.1F));
+ player.attackEntityFrom(DamageSourceList.weak,
+ amount * (3F + (JewelryNBT
+ .numberOfModifiers(
+ item)
+ - 1) * 0.1F));
// Negative earrings
if (jewelry instanceof ItemEarrings
&& source.damageType.equals("arrow"))
- player.attackEntityFrom(DamageSourceList.weak, amount * (2F
- + (JewelryNBT.numberOfModifiers(item) - 1) * 0.1F));
+ player.attackEntityFrom(DamageSourceList.weak,
+ amount * (2F + (JewelryNBT
+ .numberOfModifiers(
+ item)
+ - 1) * 0.1F));
return false;
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectObsidian.java b/src/main/java/darkknight/jewelrycraft/effects/EffectObsidian.java index be1d233..3b79390 100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectObsidian.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectObsidian.java @@ -25,53 +25,68 @@ public class EffectObsidian extends ModifierEffects { }
@Override
- public void action(ItemStack item, EntityPlayer player, Item jewelry) {
+ public void action(ItemStack item, EntityPlayer player,
+ Item jewelry) {
NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player, Variables.MODID);
+ .getModPlayerPersistTag(player,
+ Variables.MODID);
if (jewelry instanceof ItemNecklace) {
// Positive necklace
- player.addPotionEffect(
- new PotionEffect(Potion.resistance.id, 60, 2, true));
+ player.addPotionEffect(new PotionEffect(
+ Potion.resistance.id, 60, 2,
+ true));
// Negative necklace
if (player.isInWater()
&& !player.capabilities.isCreativeMode) {
- double slowAmount = 0.2D
- + (JewelryNBT.numberOfModifiers(item) - 1) * 0.05D;
+ double slowAmount = 0.2D + (JewelryNBT
+ .numberOfModifiers(item)
+ - 1) * 0.05D;
player.motionX *= slowAmount;
player.motionY *= slowAmount;
player.motionZ *= slowAmount;
player.motionY = -0.5D;
if (rand.nextInt(50) == 0)
- player.attackEntityFrom(DamageSourceList.weak, 2F);
+ player.attackEntityFrom(
+ DamageSourceList.weak,
+ 2F);
}
}
// Negative bracelet
- if (jewelry instanceof ItemBracelet && playerInfo.hasKey("falls")
+ if (jewelry instanceof ItemBracelet
+ && playerInfo.hasKey("falls")
&& playerInfo.getInteger("falls") >= 300)
- player.addPotionEffect(
- new PotionEffect(Potion.moveSlowdown.id, 60, 1, true));
+ player.addPotionEffect(new PotionEffect(
+ Potion.moveSlowdown.id, 60, 1,
+ true));
// Negative ring
- if (jewelry instanceof ItemRing && playerInfo.hasKey("strikes")
- && playerInfo.getInteger("strikes") >= 200) {
- player.addPotionEffect(
- new PotionEffect(Potion.weakness.id, 60, 0, true));
- player.addPotionEffect(
- new PotionEffect(Potion.digSlowdown.id, 60, 1, true));
+ if (jewelry instanceof ItemRing
+ && playerInfo.hasKey("strikes")
+ && playerInfo.getInteger(
+ "strikes") >= 200) {
+ player.addPotionEffect(new PotionEffect(
+ Potion.weakness.id, 60, 0, true));
+ player.addPotionEffect(new PotionEffect(
+ Potion.digSlowdown.id, 60, 1,
+ true));
}
}
@Override
public boolean onPlayerAttackedCancellable(ItemStack item,
- EntityPlayer player, DamageSource source, Item jewelry,
- float amount) {
+ EntityPlayer player, DamageSource source,
+ Item jewelry, float amount) {
NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player, Variables.MODID);
+ .getModPlayerPersistTag(player,
+ Variables.MODID);
if (jewelry instanceof ItemEarrings
&& (source == DamageSource.anvil
- || source.damageType.equals("arrow"))) {
+ || source.damageType
+ .equals("arrow"))) {
if (playerInfo.hasKey("protected")) {
playerInfo.setInteger("protected",
- playerInfo.getInteger("protected") + 1);
+ playerInfo.getInteger(
+ "protected")
+ + 1);
} else {
playerInfo.setInteger("protected", 1);
}
@@ -86,7 +101,9 @@ public class EffectObsidian extends ModifierEffects { && source == DamageSource.fall) {
if (playerInfo.hasKey("falls")) {
playerInfo.setInteger("falls",
- playerInfo.getInteger("falls") + 1);
+ playerInfo.getInteger(
+ "falls")
+ + 1);
} else {
playerInfo.setInteger("falls", 1);
}
@@ -101,7 +118,8 @@ public class EffectObsidian extends ModifierEffects { public void onPlayerDead(ItemStack item, EntityPlayer player,
DamageSource source, Item jewelry) {
NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player, Variables.MODID);
+ .getModPlayerPersistTag(player,
+ Variables.MODID);
playerInfo.setInteger("falls", 0);
playerInfo.setInteger("strikes", 0);
playerInfo.setInteger("protected", 0);
@@ -112,7 +130,8 @@ public class EffectObsidian extends ModifierEffects { EntityPlayer player, Entity target, Item jewelry,
float amount) {
NBTTagCompound playerInfo = PlayerUtils
- .getModPlayerPersistTag(player, Variables.MODID);
+ .getModPlayerPersistTag(player,
+ Variables.MODID);
NBTTagCompound enemyData = target.getEntityData();
// Positive ring
if (jewelry instanceof ItemRing
@@ -121,14 +140,19 @@ public class EffectObsidian extends ModifierEffects { if (enemyData.getInteger("reAttacked") == 0) {
if (playerInfo.hasKey("strikes"))
playerInfo.setInteger("strikes",
- playerInfo.getInteger("strikes") + 1);
+ playerInfo.getInteger(
+ "strikes")
+ + 1);
else
- playerInfo.setInteger("strikes", 1);
+ playerInfo.setInteger("strikes",
+ 1);
// Negative ring
enemyData.setInteger("reAttacked",
- enemyData.getInteger("reAttacked") + 1);
- target.attackEntityFrom(
- DamageSource.causePlayerDamage(player),
+ enemyData.getInteger(
+ "reAttacked")
+ + 1);
+ target.attackEntityFrom(DamageSource
+ .causePlayerDamage(player),
amount * 1.5F);
return true;
}
|
