diff --git a/common/mekanism/client/ClientPlayerTickHandler.java b/common/mekanism/client/ClientPlayerTickHandler.java index 7a63bcc63..96ac3b7a2 100644 --- a/common/mekanism/client/ClientPlayerTickHandler.java +++ b/common/mekanism/client/ClientPlayerTickHandler.java @@ -234,6 +234,7 @@ public class ClientPlayerTickHandler implements ITickHandler tank.useGas(entityPlayer.getCurrentItemOrArmor(3)); entityPlayer.setAir(300); + entityPlayer.clearActivePotions(); } } } diff --git a/common/mekanism/common/CommonPlayerTickHandler.java b/common/mekanism/common/CommonPlayerTickHandler.java index 2f6aec45c..9e372b4cf 100644 --- a/common/mekanism/common/CommonPlayerTickHandler.java +++ b/common/mekanism/common/CommonPlayerTickHandler.java @@ -132,6 +132,7 @@ public class CommonPlayerTickHandler implements ITickHandler tank.useGas(player.getCurrentItemOrArmor(3)); player.setAir(300); + player.clearActivePotions(); } } } diff --git a/common/mekanism/common/block/BlockMachine.java b/common/mekanism/common/block/BlockMachine.java index 5b5f2148a..2ffbe2260 100644 --- a/common/mekanism/common/block/BlockMachine.java +++ b/common/mekanism/common/block/BlockMachine.java @@ -247,23 +247,23 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds if(side == 4) { - world.spawnParticle("smoke", (double)(xRandom - iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D); - world.spawnParticle("reddust", (double)(xRandom - iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D); + world.spawnParticle("smoke", (xRandom - iRandom), yRandom, (zRandom + jRandom), 0.0D, 0.0D, 0.0D); + world.spawnParticle("reddust", (xRandom - iRandom), yRandom, (zRandom + jRandom), 0.0D, 0.0D, 0.0D); } else if(side == 5) { - world.spawnParticle("smoke", (double)(xRandom + iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D); - world.spawnParticle("reddust", (double)(xRandom + iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D); + world.spawnParticle("smoke", (xRandom + iRandom), yRandom, (zRandom + jRandom), 0.0D, 0.0D, 0.0D); + world.spawnParticle("reddust", (xRandom + iRandom), yRandom, (zRandom + jRandom), 0.0D, 0.0D, 0.0D); } else if(side == 2) { - world.spawnParticle("smoke", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom - iRandom), 0.0D, 0.0D, 0.0D); - world.spawnParticle("reddust", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom - iRandom), 0.0D, 0.0D, 0.0D); + world.spawnParticle("smoke", (xRandom + jRandom), yRandom, (zRandom - iRandom), 0.0D, 0.0D, 0.0D); + world.spawnParticle("reddust", (xRandom + jRandom), yRandom, (zRandom - iRandom), 0.0D, 0.0D, 0.0D); } else if(side == 3) { - world.spawnParticle("smoke", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom + iRandom), 0.0D, 0.0D, 0.0D); - world.spawnParticle("reddust", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom + iRandom), 0.0D, 0.0D, 0.0D); + world.spawnParticle("smoke", (xRandom + jRandom), yRandom, (zRandom + iRandom), 0.0D, 0.0D, 0.0D); + world.spawnParticle("reddust", (xRandom + jRandom), yRandom, (zRandom + iRandom), 0.0D, 0.0D, 0.0D); } } } diff --git a/common/mekanism/common/item/ItemGasMask.java b/common/mekanism/common/item/ItemGasMask.java index fa5e22e5c..1860d51a4 100644 --- a/common/mekanism/common/item/ItemGasMask.java +++ b/common/mekanism/common/item/ItemGasMask.java @@ -1,7 +1,5 @@ package mekanism.common.item; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import mekanism.client.render.ModelCustomArmor; import mekanism.client.render.ModelCustomArmor.ArmorModel; import mekanism.common.Mekanism; @@ -11,6 +9,11 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraftforge.common.EnumHelper; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.ForgeSubscribe; +import net.minecraftforge.event.entity.living.LivingAttackEvent; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class ItemGasMask extends ItemArmor { @@ -18,6 +21,7 @@ public class ItemGasMask extends ItemArmor { super(id, EnumHelper.addArmorMaterial("GASMASK", 0, new int[] {0, 0, 0, 0}, 0), 0, 0); setCreativeTab(Mekanism.tabMekanism); + MinecraftForge.EVENT_BUS.register(this); } @Override @@ -40,4 +44,25 @@ public class ItemGasMask extends ItemArmor model.modelType = ArmorModel.GASMASK; return model; } + + @ForgeSubscribe + public void onEntityAttacked(LivingAttackEvent event) + { + EntityLivingBase base = event.entityLiving; + + if(base.getCurrentItemOrArmor(4) != null && base.getCurrentItemOrArmor(4).getItem() instanceof ItemGasMask) + { + ItemGasMask mask = (ItemGasMask)base.getCurrentItemOrArmor(4).getItem(); + + if(base.getCurrentItemOrArmor(3) != null && base.getCurrentItemOrArmor(3).getItem() instanceof ItemScubaTank) + { + ItemScubaTank tank = (ItemScubaTank)base.getCurrentItemOrArmor(3).getItem(); + + if(tank.getFlowing(base.getCurrentItemOrArmor(3)) && tank.getGas(base.getCurrentItemOrArmor(3)) != null) + { + event.setCanceled(true); + } + } + } + } }