Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.48 KB | None | 0 0
  1. package Squad.Modules.Combat;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Random;
  5.  
  6. import org.lwjgl.input.Keyboard;
  7.  
  8. import com.darkmagician6.eventapi.EventManager;
  9. import com.darkmagician6.eventapi.EventTarget;
  10.  
  11. import Squad.Squad;
  12. import Squad.Events.EventPreMotion;
  13. import Squad.Events.EventUpdate;
  14. import Squad.Utils.TimeHelper;
  15. import Squad.base.Module;
  16. import de.Hero.settings.Setting;
  17. import net.minecraft.client.Minecraft;
  18. import net.minecraft.client.particle.EntitySpellParticleFX.MobFactory;
  19. import net.minecraft.entity.Entity;
  20. import net.minecraft.entity.EntityLivingBase;
  21. import net.minecraft.entity.player.EntityPlayer;
  22. import net.minecraft.network.play.client.C02PacketUseEntity;
  23. import net.minecraft.network.play.client.C03PacketPlayer;
  24. import net.minecraft.network.play.client.C0BPacketEntityAction;
  25. import net.minecraft.potion.Potion;
  26. import net.minecraft.potion.PotionEffect;
  27. import net.minecraft.util.MathHelper;
  28. import net.minecraft.village.Village;
  29.  
  30. public class ModKillAura extends Module {
  31.  
  32. private float delay;
  33. private float range;
  34. private int random;
  35. Entity e1;
  36. public boolean rotated = false;
  37. private TimeHelper auraHitDelay = new TimeHelper();
  38. private TimeHelper heuristicsBypassDelay = new TimeHelper();
  39. private Random r = new Random();
  40.  
  41. public ModKillAura() {
  42. super("Aura", Keyboard.KEY_R, 0xf44146, Category.Combat);
  43.  
  44. }
  45.  
  46. public void setup() {
  47. ArrayList<String> options2 = new ArrayList<>();
  48. options2.add("NCP-Aura1");
  49. options2.add("AAC-Aura1");
  50. Squad.instance.setmgr.rSetting(new Setting("Mode", this, "NCP-Aura1", options2));
  51.  
  52. Squad.instance.setmgr.rSetting(new Setting("Delay", this, 4.33, 1, 70.0, false));
  53. Squad.instance.setmgr.rSetting(new Setting("Range", this, 4.0, 1.0, 100.0, false));
  54. Squad.instance.setmgr.rSetting(new Setting("EntityID", this, false));
  55. Squad.instance.setmgr.rSetting(new Setting("Ping", this, false));
  56. Squad.instance.setmgr.rSetting(new Setting("OpHit", this, false));
  57.  
  58. }
  59.  
  60. @EventTarget
  61. public void onEvent(EventUpdate e) {
  62. delay = ((float) Squad.instance.setmgr.getSettingByName("Delay").getValDouble());
  63. range = ((float) Squad.instance.setmgr.getSettingByName("Range").getValDouble());
  64. }
  65.  
  66. @EventTarget
  67. public void onTick(EventUpdate event) {
  68. for (Object o : mc.theWorld.loadedEntityList) {
  69. if (o instanceof EntityLivingBase) {
  70. if (o != mc.thePlayer) {
  71. EntityLivingBase e = (EntityLivingBase) o;
  72. // random = (1 + r.nextInt(60 - 1));
  73. if (check(e) && (auraHitDelay.isDelayComplete(1000 / delay))) {
  74. attack(e);
  75. e1 = e;
  76. System.out.println(e + "");
  77. }
  78. }
  79. }
  80. }
  81. }
  82. public boolean OpHit(EntityLivingBase e){
  83. if(Squad.instance.setmgr.getSettingByName("OpHit").getValBoolean()){
  84. if(mc.thePlayer.hurtTime != 0)
  85. mc.timer.timerSpeed = 5F;
  86. {
  87. return true;
  88. }
  89. } else {
  90. return true;
  91. }
  92.  
  93. }
  94.  
  95.  
  96.  
  97.  
  98.  
  99. public boolean ping(EntityLivingBase e){
  100. if(Squad.instance.setmgr.getSettingByName("Ping").getValBoolean()){
  101. if(mc.getNetHandler().getPlayerInfo(e.getUniqueID()).getResponseTime() > 5)
  102. {
  103. return true;
  104. }
  105. } else {
  106. return true;
  107. }
  108.  
  109. return false;
  110.  
  111. }
  112.  
  113. private boolean check(EntityLivingBase e) {
  114. if (e.isInvisible())
  115. return false;
  116. if (e.getHealth() <= 0)
  117. return false;
  118. if (e instanceof Entity
  119. && e.getDisplayName().getUnformattedText().equals("§6Dealer")) {
  120. return false;
  121. }
  122. if (Squad.instance.setmgr.getSettingByName("Mode").getValString().equalsIgnoreCase("NCP-Aura1")
  123. && e.ticksExisted < 250)
  124.  
  125. return false;
  126. if (Squad.instance.setmgr.getSettingByName("EntityID").getValBoolean() && e.getEntityId() > 1070000000)
  127. return false;
  128.  
  129. return true;
  130.  
  131. }
  132.  
  133. private void attack(EntityLivingBase e) {
  134. if (e.getDistanceToEntity(mc.thePlayer) <= range) {
  135. // mc.thePlayer.sendQueue.addToSendQueue(new
  136. // C0BPacketEntityAction(mc.thePlayer.posX, mc.thePlayer.posY,
  137. // mc.thePlayer.posZ, getYaw(e), getPitch(e), true));
  138. System.out.println(e + "");
  139. if (rotated) {
  140. mc.thePlayer.swingItem();
  141. mc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(e, C02PacketUseEntity.Action.ATTACK));
  142. auraHitDelay.setLastMS();
  143. if (Squad.instance.setmgr.getSettingByName("Mode").getValString().equalsIgnoreCase("AAC-Aura1")) {
  144. if (rotated) {
  145. mc.thePlayer.sendQueue
  146. .addToSendQueue(new C02PacketUseEntity(e, C02PacketUseEntity.Action.ATTACK));
  147. mc.thePlayer.swingItem();
  148.  
  149. }
  150.  
  151. }
  152. e1 = null;
  153. rotated = false;
  154. }
  155.  
  156. }
  157. }
  158.  
  159. @EventTarget
  160. public void onPreMotion(EventPreMotion e) {
  161. float rot[] = getRotationsNeeded(e1);
  162. e.setPitch(rot[1]);
  163. e.setYaw(rot[0]);
  164. this.rotated = true;
  165. }
  166.  
  167. public float[] getRotationsNeeded(Entity entity) {
  168. float yaw;
  169. float pitch;
  170. double diffX = entity.posX - Minecraft.getMinecraft().thePlayer.posX;
  171. double diffY;
  172. if ((entity instanceof EntityLivingBase)) {
  173. EntityLivingBase entityLivingBase = (EntityLivingBase) entity;
  174. diffY = entityLivingBase.posY + entityLivingBase.getEyeHeight() * 0.9D
  175. - (Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight());
  176. } else {
  177. diffY = (entity.boundingBox.minY + entity.boundingBox.maxY) / 2.0D
  178. - (Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight());
  179. }
  180. double diffZ = entity.posZ - Minecraft.getMinecraft().thePlayer.posZ;
  181. double dist = MathHelper.sqrt_double(diffX * diffX + diffZ * diffZ);
  182. yaw = (float) (Math.atan2(diffZ, diffX) * 180.0D / 3.141592653589793D) - 90.0F;
  183. pitch = (float) -(Math.atan2(diffY, dist) * 180.0D / 3.141592653589793D);
  184. return new float[] {
  185. Minecraft.getMinecraft().thePlayer.rotationYaw
  186. + MathHelper.wrapAngleTo180_float(yaw - Minecraft.getMinecraft().thePlayer.rotationYaw),
  187. Minecraft.getMinecraft().thePlayer.rotationPitch
  188. + MathHelper.wrapAngleTo180_float(pitch - Minecraft.getMinecraft().thePlayer.rotationPitch) };
  189. }
  190.  
  191. @EventTarget
  192. public void onevent(EventUpdate e) {
  193. if (Squad.instance.setmgr.getSettingByName("Mode").getValString().equalsIgnoreCase("NCP-Aura1")) {
  194. setDisplayname("Aura §7NCP");
  195. } else {
  196. if (Squad.instance.setmgr.getSettingByName("Mode").getValString().equalsIgnoreCase("AAC-Aura1")) {
  197. setDisplayname("Aura §7AAC");
  198.  
  199. }
  200. }
  201. }
  202.  
  203. public void onEnable(){
  204. EventManager.register(this);
  205. }
  206.  
  207. public void onDisable(){
  208. e1 = null;
  209. EventManager.unregister(this);
  210. }
  211.  
  212. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement