Advertisement
Portl

Untitled

Oct 5th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. public NewKillaura() {
  2. super("NewKillaura", "NewKillaura", Keyboard.KEY_J, Category.COMBAT);
  3. }
  4. public void onUpdate() {
  5. if (this.getState()) {
  6. this.killaura();
  7. }
  8. }
  9.  
  10. int delay;
  11.  
  12. private void killaura() {
  13. List list = Wrapper.mc.theWorld.playerEntities;
  14. delay++;
  15.  
  16. for (int k = 0; k < list.size(); k++) {
  17. if (((EntityPlayer) list.get(k)).getName() == Wrapper.mc.thePlayer.getName()) {
  18. continue;
  19. }
  20.  
  21. EntityPlayer entityplayer = (EntityPlayer) list.get(1);
  22.  
  23. if (Wrapper.mc.thePlayer.getDistanceToEntity(entityplayer) > Wrapper.mc.thePlayer.getDistanceToEntity((Entity) list.get(k))) {
  24. entityplayer = (EntityPlayer) list.get(k);
  25. }
  26.  
  27. float f = Wrapper.mc.thePlayer.getDistanceToEntity(entityplayer);
  28.  
  29. if (f < 4F && Wrapper.mc.thePlayer.canEntityBeSeen(entityplayer) && delay > 7) {
  30. this.faceEntity(entityplayer);
  31. Wrapper.mc.playerController.attackEntity(Wrapper.mc.thePlayer, entityplayer);
  32. Wrapper.mc.thePlayer.swingItem();
  33. delay = 0;
  34. continue;
  35. }
  36. }
  37. }
  38.  
  39. public static synchronized void faceEntity(EntityLivingBase entity) {
  40. final float[] rotations = getRotationsNeeded(entity);
  41.  
  42. if (rotations != null) {
  43. Minecraft.getMinecraft().thePlayer.rotationYaw = rotations[0];
  44. Minecraft.getMinecraft().thePlayer.rotationPitch = rotations[1] + 1.0F;// 14
  45. }
  46. }
  47.  
  48. public static float[] getRotationsNeeded(Entity entity) {
  49. if (entity == null) {
  50. return null;
  51. }
  52.  
  53. final double diffX = entity.posX - Minecraft.getMinecraft().thePlayer.posX;
  54. final double diffZ = entity.posZ - Minecraft.getMinecraft().thePlayer.posZ;
  55. double diffY;
  56.  
  57. if (entity instanceof EntityLivingBase) {
  58. final EntityLivingBase entityLivingBase = (EntityLivingBase) entity;
  59. diffY = entityLivingBase.posY + entityLivingBase.getEyeHeight() - (Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight());
  60. } else {
  61. diffY = (entity.boundingBox.minY + entity.boundingBox.maxY) / 2.0D - (Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight());
  62. }
  63.  
  64. final double dist = MathHelper.sqrt_double(diffX * diffX + diffZ * diffZ);
  65. final float yaw = (float) (Math.atan2(diffZ, diffX) * 180.0D / Math.PI) - 90.0F;
  66. final float pitch = (float) -(Math.atan2(diffY, dist) * 180.0D / Math.PI);
  67. return new float[] { Minecraft.getMinecraft().thePlayer.rotationYaw + MathHelper.wrapAngleTo180_float(yaw - Minecraft.getMinecraft().thePlayer.rotationYaw), Minecraft.getMinecraft().thePlayer.rotationPitch + MathHelper.wrapAngleTo180_float(pitch - Minecraft.getMinecraft().thePlayer.rotationPitch) };
  68. }
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement