var scriptName = "Nofall (Criticals compatible)";
var scriptAuthor = "Soulplexis";
var scriptVersion = 1.1;

function randomIntFrom(min,max) // Get a random integer from [min] to [max] 
{
    return Math.floor(Math.random()*(max-min+1)+min);
}
var C06PlayerPacket = Java.type('net.minecraft.network.play.client.C03PacketPlayer.C06PacketPlayerPosLook');
var C04PacketPlayerPosition = Java.type('net.minecraft.network.play.client.C03PacketPlayer.C04PacketPlayerPosition')
var C05PacketPlayerLook = Java.type('net.minecraft.network.play.client.C03PacketPlayer.C05PacketPlayerLook');
var C03PacketPlayer = Java.type('net.minecraft.network.play.client.C03PacketPlayer');
var S08PacketPlayerPosLook = Java.type("net.minecraft.network.play.server.S08PacketPlayerPosLook");
var packet;

function Derp() {
	var Mode = value.createList("Mode", ["NCP", "NoGround"], "NCP");
    this.getName = function() {
        return "NoFall";
    }
    this.getCategory = function() {
        return "Player";   
    }

    this.getDescription = function() {
        return "Damns yourself.";
    }
	this.onEnable = function() {
	}
	this.onMotion = function() {	
	}
	this.onDisable = function() {
	}
	this.onPacket = function(event) {
		var packet = event.getPacket();
		switch(Mode.get()) {
		case "NCP":
		if(packet instanceof C03PacketPlayer && mc.thePlayer.onGround == false) {
			packet.onGround = true;
		}
		break;
		case "NoGround":
		if(packet instanceof C03PacketPlayer) {
		packet.onGround = false;
		}
		break;
		}
		
	}
	this.addValues = function(soul) {
		soul.add(Mode);
	}
}

var derp = new Derp();
var derpClient;

function onEnable() {
    derpClient = moduleManager.registerModule(derp);
}

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