var player;
var tick = 0;
module =
{
    name: "MatrixGlide",
    description: "hq matrix glide \nSIKE its ass but can be used as a nofall",
    author: "infAura",
	category: "Movement",
	values:
	[
		horSpeed = value.createFloat("HorizontalSpeedMultiplier", 1, 0.5, 2),
		autoDisable = value.createBoolean("AutoDisable", true),
		timer = value.createFloat("Timer", 1, 0.5, 1),
		ticks = value.createInteger("Ticks", 10, 2, 20),
		ground = value.createBoolean("OnGround", true)
	],
	onPacket: function(e) {
		player = mc.thePlayer;
		if (e.getPacket() instanceof C03PacketPlayer) tick++;
		if ((e.getPacket() instanceof C03PacketPlayer) && (tick % ticks.get() == 0)) {
		    mc.timer.timerSpeed = timer.get();
		    player.motionY = 0;
			if (ground.get()) e.getPacket().onGround = true;
			player.motionX *= horSpeed.get();
			player.motionZ *= horSpeed.get();
		}
	},
    onUpdate: function() {
		player = mc.thePlayer;
		if ((!mc.theWorld.isAirBlock(new BlockPos(player.posX, player.posY - 0.5, player.posZ))) && (autoDisable.get())) {
			moduleManager.getModule("MatrixGlide").setState(false);
			player.motionX = 0;
			player.motionZ = 0;
		}
	},
	onDisable: function() {
		mc.timer.timerSpeed = 1;
		tick = 0;
	},
	onEnable: function() {
		tick = ticks.get() - 1;
	}
}
script.import("Core.lib");