var scriptName="ZeroAim";var scriptAuthor="Soulplexis";var scriptVersion=3.0;var PlayerPositionLook=Java.type('net.minecraft.network.play.client.C03PacketPlayer.C06PacketPlayerPosLook');var PlayerLook=Java.type('net.minecraft.network.play.client.C03PacketPlayer.C05PacketPlayerLook');var PlayerPosition=Java.type('net.minecraft.network.play.client.C03PacketPlayer.C04PacketPlayerPosition')
var Player=Java.type('net.minecraft.network.play.client.C03PacketPlayer');var C04PacketPlayerPosition=Java.type('net.minecraft.network.play.client.C03PacketPlayer.C04PacketPlayerPosition');var EntityLiving=Java.type('net.minecraft.entity.EntityLivingBase');var MathHelper=Java.type("net.minecraft.util.MathHelper");var BlockPlace=Java.type("net.minecraft.network.play.client.C08PacketPlayerBlockPlacement");var BlockPos=Java.type("net.minecraft.util.BlockPos");var attackpacket=Java.type("net.minecraft.network.play.client.C02PacketUseEntity");var teamz=moduleManager.getModule("Teams");function getClosestEntity(){var filteredEntites=[]
for(var i in mc.theWorld.loadedEntityList){var entity=mc.theWorld.loadedEntityList[i]
if(entity instanceof EntityLiving&&entity!=mc.thePlayer&&entity.isDead==false){filteredEntites.push(entity)}}
filteredEntites.sort(function(a,b){var distanceA=mc.thePlayer.getDistanceToEntity(a)
var distanceB=mc.thePlayer.getDistanceToEntity(b)
return distanceB-distanceA;})
return filteredEntites[filteredEntites.length-1]}
function getYawFromPosition(x,z,y){var xDiff=x-mc.thePlayer.posX;var zDiff=z-mc.thePlayer.posZ;var yDiff=y-mc.thePlayer.posY+mc.thePlayer.getEyeHeight();var dist=MathHelper.sqrt_double(xDiff*xDiff+zDiff*zDiff);var yaw=(Math.atan2(zDiff,xDiff)*180.0/3.141592653589793)-90.0;return yaw;}
function getPitchFromPosition(x,z,y){var xDiff=x-mc.thePlayer.posX;var zDiff=z-mc.thePlayer.posZ;var yDiff=y-mc.thePlayer.posY+mc.thePlayer.getEyeHeight();var dist=MathHelper.sqrt_double(xDiff*xDiff+zDiff*zDiff);var pitch=(-Math.atan2(yDiff,dist)*180.0/3.141592653589793);return pitch;}
function randomIntFrom(min,max)
{return Math.floor(Math.random()*(max-min+1)+min);}
var BlockPos=Java.type("net.minecraft.util.BlockPos");var C05PacketPlayerLook=Java.type('net.minecraft.network.play.client.C03PacketPlayer.C05PacketPlayerLook');var C08PacketPlayerBlockPlacement=Java.type('net.minecraft.network.play.client.C08PacketPlayerBlockPlacement');var C09PacketHeldItemChange=Java.type('net.minecraft.network.play.client.C09PacketHeldItemChange');var Air=Java.type("net.minecraft.block.BlockAir");var Scaffold=moduleManager.getModule("Scaffold");function Derp(){var Mode=value.createList("Mode",["Sprint","Derp","Shake","NoSilentAim","FlipFlop","Scaffold","Coordinate","AntiAim","SetRotation","VanillaDerp","Entity","Spin","Spin2","BlockPlacement","BlockPlacementNew","Hit","SpinBot"],"AntiAim");var Yaw=value.createBoolean("Yaw",true);var YawAmount=value.createInteger("YawAmount",180,0,360);var Pitch=value.createBoolean("Pitch",true);var PitchAmount=value.createInteger("PitchAmount",20,-90,90);var ShakeAmount=value.createInteger("ShakeAmount",5,0,360);var SpinAmount=value.createInteger("SpinAmount",180,0,360);var CoordYaw=value.createBoolean("Coord_Use_Yaw_Amount_Instead",false);var CoordPitch=value.createBoolean("Coord_Use_Pitch_Amount_Instead",false);var XCoord=value.createInteger("X",1,-20,20);var YCoord=value.createInteger("Y",1,-20,20);var ZCoord=value.createInteger("Z",1,-20,20);var EntityRange=value.createInteger("EntityRange",6,0,500);var EntityRightClickOnly=value.createBoolean("Entity_Right_Click_Only",false);var EntityOnlyWhenVisible=value.createBoolean("Entity_Only_When_Visible",false);var EntityAuto=value.createBoolean("EntityAuto",false);var EntityShake=value.createBoolean("EntityShake",false);var EntityAutoClickMode=value.createList("EntityAuto_Mode",["None","Left","Right","SpamUse"],"None");var EntityRageMode=value.createBoolean("EntitySpinbot",false);var Compensate=value.createBoolean("Entity_Projectile_Air_Loss",true);var PreventHeadless=value.createBoolean("NoHeadless",false);var ExperimentalPacketSending=value.createBoolean("Packet",true);var ExperimentalPacketDelay=value.createInteger("PacketDelay",2,0,25);var StopAttack=value.createBoolean("StopAttack",false);var ClientRender=value.createBoolean("ClientRender",false);var nine=value.createBoolean("1.9",false);var placing=false;this.getName=function(){return "SoulAim";}
this.getCategory=function(){return "Misc";}
this.getDescription=function(){return "Change head rotations, AKA fancy derp.";}
this.onEnable=function(){var ticks=0;}
var yaw1=0;this.onMotion=function(){}
var packet2;var dell=0;this.onPacket=function(event){var packet=event.getPacket();if(ExperimentalPacketSending.get()){dell++;if(dell>=ExperimentalPacketDelay.get()){if(packet instanceof Player&&!(packet instanceof PlayerPosition)&&!(packet instanceof PlayerLook)&&!(packet instanceof PlayerPositionLook)){if(Mode.get()!="Scaffold"){mc.thePlayer.sendQueue.addToSendQueue(new PlayerLook(mc.thePlayer.rotationYaw,mc.thePlayer.rotationPitch,packet.isOnGround()));}else{mc.thePlayer.sendQueue.addToSendQueue(new PlayerLook(randomIntFrom(0,360),randomIntFrom(-90,90),packet.isOnGround()));}
event.cancelEvent()}
if(packet instanceof PlayerPosition){if(Mode.get()!="Scaffold"){mc.thePlayer.sendQueue.addToSendQueue(new PlayerPositionLook(packet.getPositionX(),packet.getPositionY(),packet.getPositionZ(),mc.thePlayer.rotationYaw,mc.thePlayer.rotationPitch,packet.isOnGround()));}else{mc.thePlayer.sendQueue.addToSendQueue(new PlayerPositionLook(packet.getPositionX(),packet.getPositionY(),packet.getPositionZ(),randomIntFrom(0,360),randomIntFrom(-90,90),packet.isOnGround()));}
event.cancelEvent()}
dell=0;}}
var packet2=event.getPacket();var packet3=event.getPacket();if((packet instanceof PlayerPositionLook||packet instanceof PlayerLook)){yaw1+=SpinAmount.get();switch(Mode.get()){case "Sprint":if(Yaw.get()){if(mc.thePlayer.movementInput.moveStrafe>0){packet.yaw=mc.thePlayer.rotationYaw-90;}
if(mc.thePlayer.movementInput.moveStrafe<0){packet.yaw=mc.thePlayer.rotationYaw+90;}
if(mc.thePlayer.movementInput.moveForward>0){}
if(mc.thePlayer.movementInput.moveForward<0){packet.yaw=mc.thePlayer.rotationYaw+180;}}
if(Pitch.get()){packet.pitch=PitchAmount.get();}
break;case "Derp":if(Yaw.get()){packet.yaw=randomIntFrom(0,360);}
if(Pitch.get()){packet.pitch=randomIntFrom(-90,90);}
break;case "Shake":if(Yaw.get()){packet.yaw+=randomIntFrom(-ShakeAmount.get(),ShakeAmount.get());}
if(Pitch.get()){packet.pitch+=randomIntFrom(-ShakeAmount.get(),ShakeAmount.get());}
break;case "NoSilentAim":if(Yaw.get()){packet.yaw=mc.thePlayer.rotationYaw;}
if(Pitch.get()){packet.pitch=mc.thePlayer.rotationPitch;}
break;case "FlipFlop":if(Yaw.get()){packet.yaw=packet.pitch;}
if(Pitch.get()){packet.pitch=packet.yaw;}
break;case "Scaffold":break;case "Coordinate":if(Pitch.get()){if(CoordPitch.get()){packet.pitch+=PitchAmount.get();}else{packet.pitch=getPitchFromPosition(mc.thePlayer.posX+XCoord.get(),mc.thePlayer.posZ+ZCoord.get(),mc.thePlayer.posY+YCoord.get());}}
if(Yaw.get()){if(CoordYaw.get()){packet.yaw+=YawAmount.get();}else{packet.yaw=getYawFromPosition(mc.thePlayer.posX+XCoord.get(),mc.thePlayer.posZ+ZCoord.get(),mc.thePlayer.posY+YCoord.get());}}
break;case "AntiAimold":if(Yaw.get()){packet.yaw=mc.thePlayer.rotationYaw+YawAmount.get();}
if(Pitch.get()){packet.pitch=mc.thePlayer.rotationPitch+PitchAmount.get();}
break;case "AntiAim":if(Yaw.get()){packet.yaw+=YawAmount.get();}
if(Pitch.get()){packet.pitch+=PitchAmount.get();}
break;case "SetRotation":if(Yaw.get()){packet.yaw=YawAmount.get();}
if(Pitch.get()){packet.pitch=PitchAmount.get();}
break;case "VanillaDerp":if(Yaw.get()){packet.yaw=randomIntFrom(0,360);}
if(Pitch.get()){packet.pitch=randomIntFrom(-180,180);}
break;case "Entity":if((EntityRightClickOnly.get()&&mc.gameSettings.keyBindUseItem.pressed)||EntityRightClickOnly.get()==false){var target=getClosestEntity();var diffX=target.posX-mc.thePlayer.posX;var diffZ=target.posZ-mc.thePlayer.posZ;var diffY=target.posY-mc.thePlayer.posY;var dist=Math.sqrt(diffX*diffX+diffZ*diffZ);var yaw=(Math.atan2(diffZ,diffX)*180.0/Math.PI)-90.0;var pitch=-(Math.atan2(diffY,dist)*180.0/Math.PI);if(EntityShake.get()){yaw+=randomIntFrom(-ShakeAmount.get(),ShakeAmount.get())
pitch+=randomIntFrom(-ShakeAmount.get(),ShakeAmount.get())}
if(EntityAuto.get()==false&&target instanceof EntityLiving&&mc.thePlayer.getDistanceToEntity(target)<=EntityRange.get()&&((EntityOnlyWhenVisible.get()&&mc.thePlayer.canEntityBeSeen(target))||EntityOnlyWhenVisible.get()==false)&&((teamz.getState()&&target.isOnSameTeam(mc.thePlayer)==false)||teamz.getState()==false)&&target.getHealth()>0){EntityAuto.set(false);if(Yaw.get()){packet.yaw=yaw;}
if(Pitch.get()){packet.pitch=pitch;}}
if(EntityAuto.get()==true&&target instanceof EntityLiving&&mc.thePlayer.getDistanceToEntity(target)<=EntityRange.get()&&((teamz.getState()&&target.isOnSameTeam(mc.thePlayer)==false)||teamz.getState()==false)&&((EntityOnlyWhenVisible.get()&&mc.thePlayer.canEntityBeSeen(target))||EntityOnlyWhenVisible.get()==false)){EntityRightClickOnly.set(false);if(mc.thePlayer.canEntityBeSeen(target)){switch(EntityAutoClickMode.get()){case "None":break;case "Left":mc.gameSettings.keyBindAttack.pressed=true
break;case "Right":mc.gameSettings.keyBindUseItem.pressed=true;break;case "SpamUse":mc.playerController.sendUseItem(mc.thePlayer,mc.theWorld,mc.thePlayer.getHeldItem());break;}
if(Yaw.get()){packet.yaw=yaw;}
if(Pitch.get()&&Compensate.get()){packet.pitch=pitch-mc.thePlayer.getDistanceToEntity(target)/2.45;}
if(Pitch.get()&&!Compensate.get()){packet.pitch=pitch;}}}
if(EntityRageMode.get()&&packet.yaw==mc.thePlayer.rotationYaw&&packet.pitch==mc.thePlayer.rotationPitch){if(Yaw.get()){packet.yaw+=SpinAmount.get()*randomIntFrom(0,3);}
if(Pitch.get()){packet.pitch=randomIntFrom(85,90);}}}
break;case "Spin":if(Yaw.get()){packet.yaw+=yaw1}
if(Pitch.get()){packet.pitch+=PitchAmount.get();}
break;case "Spin2":if(Yaw.get()){packet.yaw=mc.thePlayer.rotationYaw+yaw1;}
if(Pitch.get()){packet.pitch=PitchAmount.get();}
break;case "SpinBot":if(Yaw.get()){packet.yaw+=SpinAmount.get()*randomIntFrom(0,3);}
if(Pitch.get()){packet.pitch=randomIntFrom(PitchAmount.get(),90);}
break;}
if(nine.get()){packet.yaw=Math.round(packet.yaw);packet.pitch=Math.round(packet.pitch);}
if(PreventHeadless.get()){if(packet.pitch<-90){packet.pitch=-90;}
if(packet.pitch>90){packet.pitch=90;}}
if(ClientRender.get()){if(packet.yaw!=null&&packet.yaw!=undefined){mc.thePlayer.renderYawOffset=packet.yaw;mc.thePlayer.rotationYawHead=packet.yaw;}}}
if(Mode.get()=="BlockPlacementNew"){if(packet instanceof BlockPlace){var xDiff=packet.getPosition().getX()-mc.thePlayer.posX;var zDiff=packet.getPosition().getZ()-mc.thePlayer.posZ;var yDiff=packet.getPosition().getY()-mc.thePlayer.posY;var dist=MathHelper.sqrt_double(xDiff*xDiff+zDiff*zDiff);var pitch4=(-Math.atan2(yDiff,dist)*180.0/3.141592653589793);var yaw4=(Math.atan2(zDiff,xDiff)*180.0/3.141592653589793)-90.0;}
if(packet instanceof BlockPlace){if(packet3 instanceof C04PacketPlayerPosition||packet3 instanceof PlayerPositionLook||packet3 instanceof PlayerLook||packet3 instanceof Player){packet3.yaw=yaw4;packet3.pitch=pitch4;}else if(!(packet3 instanceof PlayerLook||packet3 instanceof PlayerPositionLook||packet3 instanceof PlayerPosition)){mc.thePlayer.sendQueue.addToSendQueue(new PlayerLook(yaw4,pitch4+10,mc.thePlayer.onGround));}}}
if(Mode.get()=="BlockPlacement"){if(packet instanceof BlockPlace){var xDiff=packet.getPosition().getX();var zDiff=packet.getPosition().getZ();var yDiff=packet.getPosition().getY();var dist=MathHelper.sqrt_double(xDiff*xDiff+zDiff*zDiff);var pitch4=(-Math.atan2(yDiff,dist)*180.0/3.141592653589793);var yaw4=(Math.atan2(zDiff,xDiff)*180.0/3.141592653589793)-90.0;if(packet instanceof PlayerLook||packet instanceof PlayerPositionLook||packet instanceof PlayerPosition){packet.yaw=yaw4;packet.pitch=pitch4;mc.thePlayer.rotationYaw=yaw4;mc.thePlayer.rotationPitch=pitch4;}else{mc.thePlayer.sendQueue.addToSendQueue(new PlayerPositionLook(mc.thePlayer.posX,mc.thePlayer.posY,mc.thePlayer.posZ,yaw4,pitch4,mc.thePlayer.onGround));}}}
if(StopAttack.get()&&mc.gameSettings.keyBindAttack.pressed){packet.yaw=mc.thePlayer.rotationYaw;packet.pitch=mc.thePlayer.rotationPitch;}}
this.onDisable=function(){}
this.onAttack=function(event){if(Mode.get()=="Hit"){mc.thePlayer.sendQueue.addToSendQueue(new PlayerPositionLook(mc.thePlayer.posX,mc.thePlayer.posY,mc.thePlayer.posZ,randomIntFrom(0,360),randomIntFrom(-360,360),mc.thePlayer.onGround));}}
this.addValues=function(soul){soul.add(Mode);soul.add(Pitch);soul.add(PitchAmount);soul.add(Yaw);soul.add(YawAmount);soul.add(ShakeAmount);soul.add(SpinAmount);soul.add(EntityRange);soul.add(EntityShake);soul.add(EntityRageMode);soul.add(PreventHeadless);soul.add(ExperimentalPacketSending);soul.add(ExperimentalPacketDelay);soul.add(StopAttack);soul.add(ClientRender);soul.add(nine);}
this.getTag=function(){return Mode.get()}}
var derp=new Derp();var derpClient;function onEnable(){derpClient=moduleManager.registerModule(derp);}
function onDisable(){moduleManager.unregisterModule(derpClient);}