diff --git a/src/main/java/crazypants/enderio/block/BlockDarkSteelLadder.java b/src/main/java/crazypants/enderio/block/BlockDarkSteelLadder.java index 1b958366..066e0cd6 100644 --- a/src/main/java/crazypants/enderio/block/BlockDarkSteelLadder.java +++ b/src/main/java/crazypants/enderio/block/BlockDarkSteelLadder.java @@ -6,6 +6,7 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import codechicken.lib.math.MathHelper; import cpw.mods.fml.common.registry.GameRegistry; import crazypants.enderio.EnderIO; import crazypants.enderio.EnderIOTab; @@ -42,13 +43,20 @@ public class BlockDarkSteelLadder extends BlockLadder implements IResourceToolti @Override public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { + if (entity.onGround || entity.isCollidedVertically) { + return; + } + if(entity.motionY >= 0.1) { entity.setPosition(entity.posX, entity.posY + Config.darkSteelLadderSpeedBoost, entity.posZ); - } else if (entity.motionY <= 0.1) { - entity.setPosition(entity.posX, entity.posY - Config.darkSteelLadderSpeedBoost, entity.posZ); + } else if(entity.motionY <= -0.1) { + Block blockUnder = entity.worldObj.getBlock(MathHelper.floor_double(entity.posX), MathHelper.floor_double(entity.posY) - 3, MathHelper.floor_double(entity.posZ)); + if (blockUnder == null || blockUnder == this) { // prevent clipping into block + entity.setPosition(entity.posX, entity.posY - Config.darkSteelLadderSpeedBoost, entity.posZ); + } } } - + @Override public String getUnlocalizedNameForTooltip(ItemStack itemStack) { return getUnlocalizedName();