var scriptName = "Spinbot derp";
var scriptAuthor = "Soulplexis";
var scriptVersion = 1.0;

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

function Derp() {
    this.getName = function() {
        return "Spinbot";
    }
    this.getCategory = function() {
        return "Fun";   
    }

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

    this.onPacket = function() {
	packet = event.getPacket();
      if (packet instanceof C05PacketPlayerLook)
      {
        event.cancelEvent();
		
      }
	}
	this.onMotion = function() {
		mc.thePlayer.sendQueue.addToSendQueue(new lookpacket(randomIntFrom(0,360), randomIntFrom(85,90), true) );
	}
}

var derp = new Derp();
var derpClient;

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

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