Advertisement
Guest User

Killaura

a guest
Jan 24th, 2015
460
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.lordethan.cryton.Modules;
  2.  
  3. import java.util.List;
  4.  
  5. import me.lordethan.cryton.Module.Category;
  6. import me.lordethan.cryton.Module.Module;
  7. import net.minecraft.entity.Entity;
  8. import net.minecraft.entity.EntityLivingBase;
  9. import net.minecraft.entity.player.EntityPlayer;
  10. import net.minecraft.util.MathHelper;
  11.  
  12. import org.lwjgl.input.Keyboard;
  13.  
  14.  
  15.  
  16. public class KillAura extends Module{
  17.  
  18.     public KillAura() {
  19.         super("KillAura", Keyboard.KEY_P, Category.COMBAT);
  20.     }
  21.  
  22.     public void OnUpdate(){
  23.         if(this.getState())
  24.             this.killaura();
  25.        
  26.     }
  27.     //TODO Better KillAura
  28.     int delay;
  29.    
  30.     public void killaura(){
  31.         List list = mc.theWorld.playerEntities;
  32.         delay++;
  33.        
  34.         for(int i = 0; i < list.size(); i++ ){
  35.             if(((EntityPlayer)list.get(i)).getName() == mc.thePlayer.getName()){
  36.                 continue;
  37.             }
  38.        
  39.             EntityPlayer entityPlayer = (EntityPlayer)list.get(1);
  40.            
  41.             if(mc.thePlayer.getDistanceToEntity(entityPlayer) > mc.thePlayer.getDistanceToEntity((Entity)list.get(i))){
  42.                 entityPlayer = (EntityPlayer)list.get(i);
  43.             }
  44.            
  45.             float f = mc.thePlayer.getDistanceToEntity(entityPlayer);
  46.            
  47.             if(f < 4F && mc.thePlayer.canEntityBeSeen(entityPlayer) && delay > 7){
  48.                 this.faceEntity(entityPlayer);
  49.                 mc.playerController.attackEntity(mc.thePlayer, entityPlayer);
  50.                 mc.thePlayer.swingItem();
  51.                 continue;
  52.             }
  53.     }
  54.  
  55. }
  56.    
  57.     public static synchronized void faceEntity(EntityLivingBase entity){
  58.         final float[] roatations = getRotationDeeded(entity);
  59.         if(roatations != null){
  60.             mc.thePlayer.rotationYaw = roatations[0];
  61.             mc.thePlayer.rotationPitch = roatations[1] + 1.0f;
  62.            
  63.         }
  64.     }
  65.  
  66.     public static float[] getRotationDeeded(Entity entity) {
  67.         if(entity == null){ return null;}
  68.         final double diffx = entity.posX - mc.thePlayer.posX;
  69.         final double diffZ = entity.posZ - mc.thePlayer.posZ;
  70.         double diffY;
  71.         if(entity instanceof EntityLivingBase){
  72.             final EntityLivingBase entityLivingBase = (EntityLivingBase) entity;
  73.             diffY = entity.posY + entityLivingBase.getEyeHeight() - (mc.thePlayer.posY + mc.thePlayer.getEyeHeight());
  74.         }else{
  75.             diffY = (entity.getBoundingBox().minY + entity.getBoundingBox().maxY / 2.0D) - (mc.thePlayer.posY + mc.thePlayer.getEyeHeight());
  76.         }
  77.         final double dist = MathHelper.sqrt_double(diffx * diffx + diffZ * diffZ);
  78.         final float yaw = (float) (Math.atan2(diffZ, diffx) * 180.0D / 3.14159265358979d) - 90.F;
  79.         final float pitch = (float) - (Math.atan2(diffY, dist) * 189.0D / 3.14159265358979d);
  80.         return new float[] {mc.thePlayer.rotationYaw + MathHelper.wrapAngleTo180_float(yaw - mc.thePlayer.rotationYaw), mc.thePlayer.rotationPitch + MathHelper.wrapAngleTo180_float(pitch - mc.thePlayer.rotationPitch)};
  81.        
  82.     }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement