var scriptName = "StepHelper";
var scriptVersion = 2.0;
var scriptAuthor = "yorik100";

var cleanStep = new CleanStep();

var client;

function CleanStep() {
	var Mode = value.createList("Mode", ["Basic", "Edge", "NCP"], "Basic");
    this.getName = function() {
        return "StepHelper";
    };

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

    this.getCategory = function() {
        return "Movement";
    };
	this.addValues = function(values) {
		values.add(Mode);
	};
    this.onEnable = function() {
    }
	var wasonground = false;
	this.onUpdate = function() {
				switch (Mode.get()) {
					case "Basic":
	if ((mc.thePlayer.isCollidedHorizontally) && !mc.thePlayer.onGround){
		mc.thePlayer.onGround = true;
		mc.gameSettings.keyBindJump.pressed = false;
	}
						break;
					case "Edge":
	if (mc.thePlayer.onGround){
	wasonground = true;
	}
	if (mc.thePlayer.motionY <= 0 && wasonground == true && (mc.thePlayer.isCollidedHorizontally) && !mc.thePlayer.onGround){
		mc.thePlayer.onGround = true;
		mc.gameSettings.keyBindJump.pressed = false;
		wasonground = false;
	}else{
	if (mc.thePlayer.motionY <= 0 && !mc.thePlayer.onGround && wasonground == true){
	wasonground = false;
	}
	}
						break;
					case "NCP":
	if (mc.thePlayer.motionY <= 0 && mc.thePlayer.fallDistance >= 0.078 && wasonground == true && (mc.thePlayer.isCollidedHorizontally) && !mc.thePlayer.onGround){
		mc.thePlayer.onGround = true;
		mc.gameSettings.keyBindJump.pressed = false;
	}
						break;
				}
}
    this.onDisable = function () {
    }
}

function onLoad() {}

function onEnable() {
    client = moduleManager.registerModule(cleanStep);
}

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