From a9bc070e25dbab973203cf612a58d9adac107f1c Mon Sep 17 00:00:00 2001 From: Matt Caughey Date: Fri, 13 Sep 2013 23:26:42 -0400 Subject: [PATCH] Made wading boots affect ash and cloud blocks --- common/biomesoplenty/blocks/BlockAsh.java | 21 +++++++++++++++------ common/biomesoplenty/blocks/BlockCloud.java | 14 ++++++++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/common/biomesoplenty/blocks/BlockAsh.java b/common/biomesoplenty/blocks/BlockAsh.java index 9999c7612..d4568401c 100644 --- a/common/biomesoplenty/blocks/BlockAsh.java +++ b/common/biomesoplenty/blocks/BlockAsh.java @@ -8,6 +8,8 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; @@ -62,14 +64,21 @@ public class BlockAsh extends Block return false; } - /** - * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity - */ @Override - public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) + public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { - par5Entity.motionX *= 0.4D; - par5Entity.motionZ *= 0.4D; + if (entity instanceof EntityPlayer) + { + InventoryPlayer inventory = ((EntityPlayer)entity).inventory; + + if (inventory.armorInventory[0] != null && inventory.armorInventory[0].itemID == Items.wadingBoots.get().itemID) + { + return; + } + } + + entity.motionX *= 0.4D; + entity.motionZ *= 0.4D; } /** diff --git a/common/biomesoplenty/blocks/BlockCloud.java b/common/biomesoplenty/blocks/BlockCloud.java index 51ee2cf07..442a3479e 100644 --- a/common/biomesoplenty/blocks/BlockCloud.java +++ b/common/biomesoplenty/blocks/BlockCloud.java @@ -4,10 +4,13 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import biomesoplenty.BiomesOPlenty; +import biomesoplenty.api.Items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -44,6 +47,17 @@ public class BlockCloud extends Block public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { par5Entity.fallDistance = 0.0F; + + if (par5Entity instanceof EntityPlayer) + { + InventoryPlayer inventory = ((EntityPlayer)par5Entity).inventory; + + if (inventory.armorInventory[0] != null && inventory.armorInventory[0].itemID == Items.wadingBoots.get().itemID) + { + return; + } + } + par5Entity.motionX *= 0.8D; par5Entity.motionZ *= 0.8D; }