var scriptName = "CubeFastLadder"; // The name of your script
var scriptVersion = 0.1; // The version of your script 
var scriptAuthor = "Alan"; // The author of your script

var CubeFastLadder = new CubeFastLadder();
var CubeFastLadder;

BlockPos = Java.type('net.minecraft.util.BlockPos')
BlockLadder = Java.type('net.minecraft.block.BlockLadder')
EntityPlayer = Java.type("net.minecraft.entity.player.EntityPlayer")

 Math.radians = function(degrees) {
    return degrees * Math.PI / 180;
  };
   
  // Converts from radians to degrees.
  Math.degrees = function(radians) {
    return radians * 180 / Math.PI;
  };
  
  function vClip(offset) {
		mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + offset, mc.thePlayer.posZ);
	}

function CubeFastLadder() {
	var dmg = value.createInteger("DamageAmount", 1, 1, 20);
	var offset = value.createFloat("YOffset", 0.62, 0.01, 1.0);
    this.getName = function() {
        return "CubeFastLadder";
    };

    this.getDescription = function() {
        return "CubeFastLadder";
    };

    this.getCategory = function() {
        return "Misc";
    };
	
    this.onUpdate = function() {	
	if(mc.theWorld.getBlockState(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)).getBlock() instanceof BlockLadder){
		if (mc.thePlayer.ticksExisted % 3 == 0){
			if (mc.thePlayer.motionY > 0){
				vClip(1);
			}else if (mc.theWorld.getBlockState(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1, mc.thePlayer.posZ)).getBlock() instanceof BlockLadder){
				vClip(-1);
			}else if (mc.theWorld.getBlockState(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 0.5, mc.thePlayer.posZ)).getBlock() instanceof BlockLadder){
				vClip(-0.5);
			}
		}
	}
}

	
	this.onDisable = function() {

	mc.timer.timerSpeed = 1;
 }
 	this.onEnable = function() {
			
 }
 }
function onLoad() {
    // Currently this event has to be in every script even if it is not directly needed.
};

function onEnable() {
    SpartanSpeedClient = moduleManager.registerModule(CubeFastLadder);
		
};

function onDisable() {
    moduleManager.unregisterModule(SpartanSpeedClient);
	
};