Made wading boots affect ash and cloud blocks

This commit is contained in:
Matt Caughey 2013-09-13 23:26:42 -04:00
parent fe86f280c3
commit a9bc070e25
2 changed files with 29 additions and 6 deletions

View file

@ -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;
}
/**

View file

@ -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;
}