summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-08-13 21:12:11 +0100
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-08-13 21:12:11 +0100
commit0ef6a00aa79f022e5bd56b3f77e6861bbecf6d94 (patch)
tree03966c83cd16d1912ec1596d83f89f251cc35f83 /src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java
parent921f1ba6f30e66c80c803618ebff496778e78970 (diff)
Added a new structure, a new curse, achievements, challenges, curses
entry in the guide; reworked liquids to be tile entities, cleaned the structures code, potion code and... you know what? I improved and changed so much stuff that I literally forgot what I did...
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java')
-rw-r--r--src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java109
1 files changed, 48 insertions, 61 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java b/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java
index 17db979..4e0a14b 100644
--- a/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java
+++ b/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java
@@ -18,65 +18,52 @@ import darkknight.jewelrycraft.util.JewelryNBT;
import darkknight.jewelrycraft.util.PlayerUtils;
import darkknight.jewelrycraft.util.Variables;
-public class EffectBlazePowder extends ModifierEffects
-{
- public EffectBlazePowder()
- {
- super(new ItemStack(Items.blaze_powder));
- }
-
- @Override
- 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) player.extinguish();
- // Negative for necklace
- if (player.isInWater()) 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;
- player.motionX *= slowAmount;
- player.motionY *= slowAmount;
- player.motionZ *= slowAmount;
- player.motionY -= (0.02D + (JewelryNBT.numberOfModifiers(item) - 1) * 0.005D);
- if (player.isCollidedHorizontally) player.motionY = 0.30000001192092896D;
- }
- // Negative for earrings
- if (jewelry instanceof ItemEarrings){
- if (player.getAir() >= 300) player.setAir(player.getAir() / 2);
- else player.setAir(player.getAir() - JewelryNBT.numberOfModifiers(item));
- }
- }
-
- @Override
- public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
- {
- // Balanced for ring
- if (jewelry instanceof ItemRing && !player.isInWater() && rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0) target.setFire(2);
- return false;
- }
-
- @Override
- public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
- {
- return false;
- }
-
- public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
- {}
-
- public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
- {
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- if (jewelry instanceof ItemEarrings && rand.nextInt(4) == 0) if (source == DamageSource.lava || source == DamageSource.inFire || source == DamageSource.onFire){
- // Positive for earrings
- int stackSize = JewelryNBT.modifierSize(item, modifier);
- player.heal(stackSize*0.05F - (JewelryNBT.numberOfModifiers(item) - 1)*0.01F);
- playerInfo.setBoolean("negateDamage", true);
- }
- // Positive for bracelet
- if (jewelry instanceof ItemBracelet) 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);
- }
+public class EffectBlazePowder extends ModifierEffects {
+ public EffectBlazePowder() {
+ super(new ItemStack(Items.blaze_powder));
+ }
+
+ @Override
+ 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) player.extinguish();
+ // Negative for necklace
+ if (player.isInWater()) 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;
+ player.motionX *= slowAmount;
+ player.motionY *= slowAmount;
+ player.motionZ *= slowAmount;
+ player.motionY -= (0.02D + (JewelryNBT.numberOfModifiers(item) - 1) * 0.005D);
+ if (player.isCollidedHorizontally) player.motionY = 0.30000001192092896D;
+ }
+ // Negative for earrings
+ if (jewelry instanceof ItemEarrings) {
+ if (player.getAir() >= 300) player.setAir(player.getAir() / 2);
+ else player.setAir(player.getAir() - JewelryNBT.numberOfModifiers(item));
+ }
+ }
+
+ @Override
+ public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount) {
+ // Balanced for ring
+ if (jewelry instanceof ItemRing && !player.isInWater() && rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0) target.setFire(2);
+ return false;
+ }
+
+ public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount) {
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
+ 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);
+ player.heal(stackSize * 0.05F - (JewelryNBT.numberOfModifiers(item) - 1) * 0.01F);
+ return true;
+ }
+ // Positive for bracelet
+ if (jewelry instanceof ItemBracelet) 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;
+ }
}