/// api_version=2
var script = registerScript({
    name: "Flight",
    version: "1.0",
    authors: ["Gabriel"]
});
var x = 0;
x = 0;

script.registerModule({
    name: "Flight",
    description: "Some flys",
    category: "Movement",
    settings: {
    Mode: Setting.list({
	    name: "Mode",
    	default: "RedeskyFast",
	    values: ["RedeskyFast", "RedeskyFast2", "RedeskyFast3", "RedeskyFast4", "RedeskySlow", "RedeskySlow2", "RedeskySlow3"]
	}),
	
	}
}, function (module) {
	module.on("disable", function () {
		mc.thePlayer.speedInAir = 0.02;
        mc.timer.timerSpeed = 1
	});
	
	module.on("update", function () {

		if (module.settings.Mode.get() == "RedeskySlow") {
			if (mc.thePlayer.onGround) {
                mc.thePlayer.jump();
			}
			if (mc.thePlayer.motionY < 0) {
			mc.timer.timerSpeed = 0.25;
			mc.thePlayer.speedInAir = 0.10;
            mc.thePlayer.motionY = 0;
			}
		}
		
		if (module.settings.Mode.get() == "RedeskySlow2") {
			if (mc.thePlayer.onGround) {
				mc.thePlayer.jump();
			}
			if (mc.thePlayer.motionY < 0) {
				mc.timer.timerSpeed = 0.1;
				mc.thePlayer.speedInAir = 0.1;
				mc.thePlayer.motionY = 0.0;

				// if (mc.thePlayer.ticksExisted % 30 == 0) {
					
				// 	mc.thePlayer.speedInAir = 0.03;
				// 	mc.timer.timerSpeed = 25;
					
				// }	


				if (mc.thePlayer.ticksExisted % 6 == 0) { //7
					mc.thePlayer.speedInAir = 0.1;
					mc.timer.timerSpeed = 35; //25
					x = x + 1
					
				}	


				// if (x == 1) {
				// 	ThisFly.setState(false)
				// }
					
			
			}

		}
		if (module.settings.Mode.get() == "RedeskyFast2") {
			if (mc.thePlayer.onGround) {
                mc.thePlayer.jump();
			}
			if (mc.thePlayer.motionY < 0) {
			mc.timer.timerSpeed = 1;
			mc.thePlayer.speedInAir = 0.14;
            mc.thePlayer.motionY = 0;
			}
		}
		
		
		

		if (module.settings.Mode.get() == "RedeskyFast3") {
			if (mc.thePlayer.onGround) {
				mc.thePlayer.jump();
			}
			if (mc.thePlayer.motionY < 0) {
				mc.timer.timerSpeed = 0.25;
				mc.thePlayer.speedInAir = 0.02;

                               if (mc.thePlayer.ticksExisted % 30 == 0) {
					
					mc.thePlayer.speedInAir = 0.05;
				 	mc.timer.timerSpeed = 3;
					
			        }	


				if (mc.thePlayer.ticksExisted % 8 == 0) { //7
					mc.thePlayer.speedInAir = 0.02;
					mc.timer.timerSpeed = 2; //25
					x = x + 1
					
				}	


				// if (x == 1) {
				// 	ThisFly.setState(false)
				// }
					
			
			}

		}

		if (module.settings.Mode.get() == "RedeskyFast4") {
			if (mc.thePlayer.onGround) {
                mc.thePlayer.jump();
			}
			if (mc.thePlayer.motionY < 0) {
			mc.thePlayer.speedInAir = 0.10;
            mc.thePlayer.motionY = 0;
			}

		}
		
		if (module.settings.Mode.get() == "RedeskySlow3") {
			if (mc.thePlayer.onGround) {
                mc.thePlayer.motionY = 0.30;
			}

			if (mc.thePlayer.motionY < 0) {
				mc.timer.timerSpeed = 0.40;
				mc.thePlayer.speedInAir = 0.12;
				mc.thePlayer.motionY = 0;
			}
			
			if (mc.thePlayer.ticksExisted % 8 == 0) { //7
				// mc.thePlayer.speedInAir = 0.10;
				mc.timer.timerSpeed = 0.7; //25
				// x = x + 1
				
			}

		}
		
		

		if (module.settings.Mode.get() == "RedeskyFast") {
			if (mc.thePlayer.onGround) {
                mc.thePlayer.jump();
			}
			if (mc.thePlayer.motionY < 0) {
				mc.timer.timerSpeed = 0.5;
				mc.thePlayer.speedInAir = 0.12;
				mc.thePlayer.motionY = 0;
			}

			if (mc.thePlayer.ticksExisted % 5 == 0) { //7
				mc.thePlayer.speedInAir = 0.09;
				mc.timer.timerSpeed = 1;
				
			}	


		}
		
	});
});