package crazypants.enderio.block;

import net.minecraft.block.Block;
import net.minecraft.block.BlockLadder;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.common.registry.GameRegistry;
import crazypants.enderio.EnderIO;
import crazypants.enderio.EnderIOTab;
import crazypants.enderio.ModObject;
import crazypants.enderio.config.Config;
import crazypants.enderio.gui.IResourceTooltipProvider;

public class BlockDarkSteelLadder extends BlockLadder implements IResourceTooltipProvider {
  
  public static BlockDarkSteelLadder create() {
    BlockDarkSteelLadder res = new BlockDarkSteelLadder();
    res.init();
    return res;
  }

  protected BlockDarkSteelLadder() {
    super();
    
    setBlockName(ModObject.blockDarkSteelLadder.unlocalisedName);
    setBlockTextureName(EnderIO.MODID + ":" + ModObject.blockDarkSteelLadder.unlocalisedName);
    setStepSound(Block.soundTypeMetal);
    setCreativeTab(EnderIOTab.tabEnderIO);
    setHardness(0.4F);
  }
  
  protected void init() {
    GameRegistry.registerBlock(this, ModObject.blockDarkSteelLadder.unlocalisedName);    
  }
  
  @Override
  public Material getMaterial() {
    return Material.iron;
  }

  @Override
  public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
    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);
    }
  }
  
  @Override
  public String getUnlocalizedNameForTooltip(ItemStack itemStack) {
    return getUnlocalizedName();
  }
}

@@ -255,16 +255,56 @@
 .World;%0A
+import codechicken.lib.math.MathHelper;%0A
 import c
@@ -1420,24 +1420,107 @@
 y entity) %7B%0A
+    if (entity.onGround %7C%7C entity.isCollidedVertically) %7B%0A      return;%0A    %7D%0A    %0A
     if(entit
@@ -1652,17 +1652,16 @@
  else if
- 
 (entity.
@@ -1671,23 +1671,280 @@
 ionY %3C= 
+-
 0.1) %7B%0A
+      Block blockUnder = entity.worldObj.getBlock(MathHelper.floor_double(entity.posX), MathHelper.floor_double(entity.posY) - 3, MathHelper.floor_double(entity.posZ));%0A      if (blockUnder == null %7C%7C blockUnder == this) %7B // prevent clipping into block%0A  
       en
@@ -2031,24 +2031,32 @@
 tity.posZ);%0A
+      %7D%0A
     %7D%0A  %7D%0A  
@@ -2049,26 +2049,24 @@
 %7D%0A    %7D%0A  %7D%0A
-  
 %0A  @Override

Fix dark steel ladder not working at all