diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-03-23 14:25:27 +0000 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-03-23 14:25:27 +0000 |
| commit | e86949a1ad3269ec66c9de65e2c92f5e66251411 (patch) | |
| tree | abe7a3b14d7a5f7bb27a916a991f8911de94c1d2 /java/darkknight/jewelrycraft/effects/EffectBlazePowder.java | |
| parent | 12cb40ba14e76b999a381b1f122bfce73223fd38 (diff) | |
More stuff. I don't even know by this point....
Diffstat (limited to 'java/darkknight/jewelrycraft/effects/EffectBlazePowder.java')
| -rw-r--r-- | java/darkknight/jewelrycraft/effects/EffectBlazePowder.java | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java b/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java index efec29b..949d0d8 100644 --- a/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java +++ b/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java @@ -6,6 +6,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import darkknight.jewelrycraft.item.ItemBracelet; @@ -13,6 +14,7 @@ import darkknight.jewelrycraft.item.ItemEarrings; import darkknight.jewelrycraft.item.ItemNecklace; import darkknight.jewelrycraft.item.ItemRing; import darkknight.jewelrycraft.util.JewelryNBT; +import darkknight.jewelrycraft.util.PlayerUtils; public class EffectBlazePowder extends ModifierEffects { @@ -33,15 +35,19 @@ public class EffectBlazePowder extends ModifierEffects if (player.isInWater()) player.attackEntityFrom(DamageSource.drown, 1f); } //Negative for bracelet - if (jewelry instanceof ItemBracelet && pos != -1) if(player.isInWater()) player.fallDistance *= 0.8F; + if (jewelry instanceof ItemBracelet && pos != -1 && player.isInWater()){ + player.motionX *= 0.6D; + player.motionY *= 0.6D; + player.motionZ *= 0.6D; + player.motionY -= 0.02D; + if (player.isCollidedHorizontally) player.motionY = 0.30000001192092896D; + } //Negative for earrings if (jewelry instanceof ItemEarrings && pos != -1){ if (player.getAir() >= 300) player.setAir(player.getAir() / 2); - else player.setAir(player.getAir() - 1); - - } - + else player.setAir(player.getAir() - 1); + } } @Override @@ -56,31 +62,34 @@ public class EffectBlazePowder extends ModifierEffects @Override public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount) { - int pos = JewelryNBT.doesModifierExist(item, modifier); - if (jewelry instanceof ItemEarrings && pos != -1 && player.worldObj.rand.nextInt(4) == 0) if (source == DamageSource.lava || source == DamageSource.inFire || source == DamageSource.onFire){ - //Positive for earrings - int stackSize = JewelryNBT.modifier(item).get(pos).stackSize; - player.heal((float)(0.05 * stackSize)); - return true; - } - //Positive for bracelet - if (jewelry instanceof ItemBracelet && pos != -1) 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)) return true; +// int pos = JewelryNBT.doesModifierExist(item, modifier); +// if (jewelry instanceof ItemEarrings && pos != -1 && rand.nextInt(4) == 0) if (source == DamageSource.lava || source == DamageSource.inFire || source == DamageSource.onFire){ +// //Positive for earrings +// int stackSize = JewelryNBT.modifier(item).get(pos).stackSize; +// player.heal((float)(0.05 * stackSize)); +// return true; +// } +// //Positive for bracelet +// if (jewelry instanceof ItemBracelet && pos != -1) 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)) return true; return false; } - @Override public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount) { + } - @Override public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount) { - } - - @Override - public boolean onPlayerFall(ItemStack item, EntityPlayer player, Item jewelry) - { - return false; + int pos = JewelryNBT.doesModifierExist(item, modifier); + NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft"); + if (jewelry instanceof ItemEarrings && pos != -1 && rand.nextInt(4) == 0) if (source == DamageSource.lava || source == DamageSource.inFire || source == DamageSource.onFire){ + //Positive for earrings + int stackSize = JewelryNBT.modifier(item).get(pos).stackSize; + player.heal((float)(0.05 * stackSize)); + playerInfo.setBoolean("negateDamage", true); + } + //Positive for bracelet + if (jewelry instanceof ItemBracelet && pos != -1) 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)) playerInfo.setBoolean("negateDamage", true); } } |
