Advertisement
Guest User

fvf

a guest
Aug 31st, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. package me.juice.gilles.Modulestuff.Mods;
  2.  
  3. import net.minecraft.client.Minecraft;
  4. import net.minecraft.entity.Entity;
  5. import net.minecraft.entity.EntityLivingBase;
  6. import net.minecraft.entity.player.EntityPlayer;
  7. import net.minecraft.util.MathHelper;
  8.  
  9. import java.util.List;
  10.  
  11. import org.lwjgl.input.Keyboard;
  12.  
  13. import me.juice.gilles.Modulestuff.Category;
  14. import me.juice.gilles.Modulestuff.Module;
  15. import me.juice.gilles.utils.Wrapper;
  16.  
  17. public class Aura extends Module {
  18.  
  19. public Aura() {
  20. super("Aura (Jerky)", Keyboard.KEY_NONE, Category.COMBAT);
  21. }
  22.  
  23. public void onUpdate() {
  24. if (this.getState()) {
  25. this.killaura();
  26. }
  27. }
  28.  
  29. int delay;
  30.  
  31. private void killaura() {
  32. List list = Wrapper.mc.theWorld.playerEntities;
  33. delay++;
  34.  
  35. for (int k = 0; k < list.size(); k++) {
  36. if (((EntityPlayer) list.get(k)).getName() == Wrapper.mc.thePlayer.getName()) {
  37. continue;
  38. }
  39.  
  40. EntityPlayer entityplayer = (EntityPlayer) list.get(1);
  41.  
  42. if (Wrapper.mc.thePlayer.getDistanceToEntity(entityplayer) > Wrapper.mc.thePlayer.getDistanceToEntity((Entity) list.get(k))) {
  43. entityplayer = (EntityPlayer) list.get(k);
  44. }
  45.  
  46. float f = Wrapper.mc.thePlayer.getDistanceToEntity(entityplayer);
  47.  
  48. if (f < 4F && Wrapper.mc.thePlayer.canEntityBeSeen(entityplayer) && delay > 7) {
  49. this.faceEntity(entityplayer);
  50. Wrapper.mc.playerController.attackEntity(Wrapper.mc.thePlayer, entityplayer);
  51. Wrapper.mc.thePlayer.swingItem();
  52. delay = 0;
  53. continue;
  54. }
  55. }
  56. }
  57.  
  58. public static synchronized void faceEntity(EntityLivingBase entity) {
  59. final float[] rotations = getRotationsNeeded(entity);
  60.  
  61. if (rotations != null) {
  62. Minecraft.getMinecraft().thePlayer.rotationYaw = rotations[0];
  63. Minecraft.getMinecraft().thePlayer.rotationPitch = rotations[1] + 1.0F;// 14
  64. }
  65. }
  66.  
  67. public static float[] getRotationsNeeded(Entity entity) {
  68. if (entity == null) {
  69. return null;
  70. }
  71.  
  72. final double diffX = entity.posX - Minecraft.getMinecraft().thePlayer.posX;
  73. final double diffZ = entity.posZ - Minecraft.getMinecraft().thePlayer.posZ;
  74. double diffY;
  75.  
  76. if (entity instanceof EntityLivingBase) {
  77. final EntityLivingBase entityLivingBase = (EntityLivingBase) entity;
  78. diffY = entityLivingBase.posY + entityLivingBase.getEyeHeight() - (Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight());
  79. } else {
  80. diffY = (entity.boundingBox.minY + entity.boundingBox.maxY) / 2.0D - (Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight());
  81. }
  82.  
  83. final double dist = MathHelper.sqrt_double(diffX * diffX + diffZ * diffZ);
  84. final float yaw = (float) (Math.atan2(diffZ, diffX) * 180.0D / Math.PI) - 90.0F;
  85. final float pitch = (float) -(Math.atan2(diffY, dist) * 180.0D / Math.PI);
  86. 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) };
  87. }
  88.  
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement