Advertisement
Guest User

Untitled

a guest
Aug 27th, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.29 KB | None | 0 0
  1. }
  2.  
  3.   public static Queue<Entity> entityList = new ConcurrentLinkedQueue();
  4.   public boolean players = true;
  5.   public boolean mobs;
  6.   public boolean animals;
  7.   public boolean block;
  8.   public double distance = Values.getValues().distance;
  9.   private TimeHelper time = new TimeHelper();
  10.   private TimeHelper blocktime = new TimeHelper();
  11.   private TimeHelper targetSwitchTime = new TimeHelper();
  12.   private TimeHelper angleSwitchTime = new TimeHelper();
  13.   private boolean shouldblock = false;
  14.   public int aps = this.time.convertToMS(Values.getValues().cps);
  15.   public static Entity target = null;
  16.   private boolean wassprint = false;
  17.   private boolean waslistfull = false;
  18.   private boolean wasblock = false;
  19.   private EntityLivingBase nexttarget;
  20.   public static float[] rot = { 0.0F, 0.0F };
  21.   private float lastYaw;
  22.   private float lastPitch;
  23.  
  24.   public void onPreMotionUpdate()
  25.   {
  26.     if (this.mc.theWorld == null) {
  27.       return;
  28.     }
  29.     this.aps = this.time.convertToMS(Values.getValues().cps);
  30.     this.distance = Values.getValues().distance;
  31.     populateEntityList();
  32.     this.nexttarget = setupForNextEntity();
  33.     try
  34.     {
  35.       if ((entityList.isEmpty()) && (this.lasthit.isDelayComplete(1000L)) && (isSword(this.mc.thePlayer.inventory.getCurrentItem().getItem()))) {
  36.         this.wasblock = this.mc.thePlayer.isBlocking();
  37.       }
  38.       if ((!entityList.isEmpty()) && (Values.getValues().autoblock) && (isSword(this.mc.thePlayer.inventory.getCurrentItem().getItem())))
  39.       {
  40.         this.mc.gameSettings.keyBindUseItem.pressed = true;
  41.         this.waslistfull = true;
  42.       }
  43.       else
  44.       {
  45.         this.waslistfull = false;
  46.       }
  47.       if ((this.lasthit.isDelayComplete(250L)) && (Values.getValues().autoblock) && (!this.lasthit.isDelayComplete(500L)) && (isSword(this.mc.thePlayer.inventory.getCurrentItem().getItem())))
  48.       {
  49.         this.mc.gameSettings.keyBindUseItem.pressed = false;
  50.         for (int i = 0; i <= 2; i++) {
  51.           this.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, new BlockPos(0, 0, 0), EnumFacing.DOWN));
  52.         }
  53.       }
  54.     }
  55.     catch (NullPointerException localNullPointerException) {}
  56.     this.lastYaw = this.mc.thePlayer.rotationYaw;
  57.     this.lastPitch = this.mc.thePlayer.rotationPitch;
  58.     if (!this.lasthit.isDelayComplete(2000L))
  59.     {
  60.       this.mc.thePlayer.rotationYaw = rot[0];
  61.       this.mc.thePlayer.rotationPitch = rot[1];
  62.     }
  63.   }
  64.  
  65.   public void onPostMotionUpdate()
  66.   {
  67.     if (this.mc.theWorld == null) {
  68.       return;
  69.     }
  70.     this.wassprint = this.mc.thePlayer.isSprinting();
  71.     this.mc.thePlayer.setSprinting(false);
  72.     attackEntity(this.nexttarget);
  73.     this.mc.thePlayer.setSprinting(this.wassprint);
  74.     this.mc.thePlayer.rotationYaw = this.lastYaw;
  75.     this.mc.thePlayer.rotationPitch = this.lastPitch;
  76.   }
  77.  
  78.   public void onDisable()
  79.   {
  80.     try
  81.     {
  82.       if ((Values.getValues().autoblock) && (isSword(this.mc.thePlayer.inventory.getCurrentItem().getItem())))
  83.       {
  84.         this.mc.gameSettings.keyBindUseItem.pressed = false;
  85.         for (int i = 0; i <= 2; i++) {
  86.           this.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, new BlockPos(0, 0, 0), EnumFacing.DOWN));
  87.         }
  88.       }
  89.     }
  90.     catch (NullPointerException localNullPointerException) {}
  91.   }
  92.  
  93.   private void populateEntityList()
  94.   {
  95.     for (Object o : this.mc.theWorld.loadedEntityList)
  96.     {
  97.       Entity e = (Entity)o;
  98.       if (isAttackable(e)) {
  99.         entityList.add(e);
  100.       }
  101.     }
  102.   }
  103.  
  104.   private TimeHelper lasthit = new TimeHelper();
  105.   boolean editpacket = false;
  106.   private EntityLivingBase lastAttackedTarget;
  107.  
  108.   public void onPacketSend(Packet packet)
  109.   {
  110.     if ((packet instanceof C03PacketPlayer)) {
  111.       C03PacketPlayer localC03PacketPlayer = (C03PacketPlayer)packet;
  112.     }
  113.   }
  114.  
  115.   private EntityLivingBase setupForNextEntity()
  116.   {
  117.     Random rand = new Random();
  118.     EntityLivingBase toattack = null;
  119.     try
  120.     {
  121.       for (Entity e : entityList) {
  122.         if (this.time.isDelayComplete(rand.nextInt(this.aps - 53 + 1) + (this.aps - 20))) {
  123.           if ((isViableToAttack((EntityLivingBase)e)) && (isAttackable(e)))
  124.           {
  125.             rot = getAngles(e);
  126.             target = e;
  127.             toattack = (EntityLivingBase)e;
  128.             if (this.mc.thePlayer.isBlocking()) {
  129.               for (int i = 0; i <= 2; i++) {
  130.                 this.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, new BlockPos(0, 0, 0), EnumFacing.DOWN));
  131.               }
  132.             }
  133.             this.time.setLastMS();
  134.             entityList.remove(e);
  135.           }
  136.           else
  137.           {
  138.             entityList.remove(e);
  139.           }
  140.         }
  141.       }
  142.     }
  143.     catch (NullPointerException localNullPointerException) {}
  144.     return toattack;
  145.   }
  146.  
  147.   private void attackEntity(EntityLivingBase e)
  148.   {
  149.     try
  150.     {
  151.       this.mc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(e, C02PacketUseEntity.Action.ATTACK));
  152.       this.mc.thePlayer.swingItem();
  153.       this.lasthit.setLastMS();
  154.       if (this.mc.thePlayer.isBlocking()) {
  155.         for (int i = 0; i <= 2; i++) {
  156.           this.mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(new BlockPos(-1, -1, -1), 255, this.mc.thePlayer.inventory.getCurrentItem(), 0.0F, 0.0F, 0.0F));
  157.         }
  158.       }
  159.       this.targetSwitchTime.setLastMS();
  160.       this.lastAttackedTarget = ((EntityLivingBase)target);
  161.       target = null;
  162.       this.mc.thePlayer.setSprinting(this.wassprint);
  163.       this.nexttarget = null;
  164.     }
  165.     catch (NullPointerException localNullPointerException) {}
  166.   }
  167.  
  168.   private void attackEntityList()
  169.   {
  170.     Random rand = new Random();
  171.     try
  172.     {
  173.       for (Entity e : entityList) {
  174.         if (this.time.isDelayComplete(rand.nextInt(this.aps - 53 + 1) + (this.aps - 20))) {
  175.           if (isViableToAttack((EntityLivingBase)e))
  176.           {
  177.             rot = getAngles(e);
  178.             this.mc.thePlayer.setSprinting(false);
  179.             target = e;
  180.             if (this.mc.thePlayer.isBlocking()) {
  181.               for (int i = 0; i <= 2; i++) {
  182.                 this.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, new BlockPos(0, 0, 0), EnumFacing.DOWN));
  183.               }
  184.             }
  185.             this.mc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(target, C02PacketUseEntity.Action.ATTACK));
  186.            
  187.             this.mc.thePlayer.swingItem();
  188.             this.lasthit.setLastMS();
  189.            
  190.             entityList.remove(e);
  191.             this.time.setLastMS();
  192.             if (this.mc.thePlayer.isBlocking()) {
  193.               for (int i = 0; i <= 2; i++) {
  194.                 this.mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(new BlockPos(-1, -1, -1), 255, this.mc.thePlayer.inventory.getCurrentItem(), 0.0F, 0.0F, 0.0F));
  195.               }
  196.             }
  197.             this.targetSwitchTime.setLastMS();
  198.             this.lastAttackedTarget = ((EntityLivingBase)target);
  199.             target = null;
  200.             this.mc.thePlayer.setSprinting(this.wassprint);
  201.           }
  202.           else
  203.           {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement