Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- }
- public static Queue<Entity> entityList = new ConcurrentLinkedQueue();
- public boolean players = true;
- public boolean mobs;
- public boolean animals;
- public boolean block;
- public double distance = Values.getValues().distance;
- private TimeHelper time = new TimeHelper();
- private TimeHelper blocktime = new TimeHelper();
- private TimeHelper targetSwitchTime = new TimeHelper();
- private TimeHelper angleSwitchTime = new TimeHelper();
- private boolean shouldblock = false;
- public int aps = this.time.convertToMS(Values.getValues().cps);
- public static Entity target = null;
- private boolean wassprint = false;
- private boolean waslistfull = false;
- private boolean wasblock = false;
- private EntityLivingBase nexttarget;
- public static float[] rot = { 0.0F, 0.0F };
- private float lastYaw;
- private float lastPitch;
- public void onPreMotionUpdate()
- {
- if (this.mc.theWorld == null) {
- return;
- }
- this.aps = this.time.convertToMS(Values.getValues().cps);
- this.distance = Values.getValues().distance;
- populateEntityList();
- this.nexttarget = setupForNextEntity();
- try
- {
- if ((entityList.isEmpty()) && (this.lasthit.isDelayComplete(1000L)) && (isSword(this.mc.thePlayer.inventory.getCurrentItem().getItem()))) {
- this.wasblock = this.mc.thePlayer.isBlocking();
- }
- if ((!entityList.isEmpty()) && (Values.getValues().autoblock) && (isSword(this.mc.thePlayer.inventory.getCurrentItem().getItem())))
- {
- this.mc.gameSettings.keyBindUseItem.pressed = true;
- this.waslistfull = true;
- }
- else
- {
- this.waslistfull = false;
- }
- if ((this.lasthit.isDelayComplete(250L)) && (Values.getValues().autoblock) && (!this.lasthit.isDelayComplete(500L)) && (isSword(this.mc.thePlayer.inventory.getCurrentItem().getItem())))
- {
- this.mc.gameSettings.keyBindUseItem.pressed = false;
- for (int i = 0; i <= 2; i++) {
- this.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, new BlockPos(0, 0, 0), EnumFacing.DOWN));
- }
- }
- }
- catch (NullPointerException localNullPointerException) {}
- this.lastYaw = this.mc.thePlayer.rotationYaw;
- this.lastPitch = this.mc.thePlayer.rotationPitch;
- if (!this.lasthit.isDelayComplete(2000L))
- {
- this.mc.thePlayer.rotationYaw = rot[0];
- this.mc.thePlayer.rotationPitch = rot[1];
- }
- }
- public void onPostMotionUpdate()
- {
- if (this.mc.theWorld == null) {
- return;
- }
- this.wassprint = this.mc.thePlayer.isSprinting();
- this.mc.thePlayer.setSprinting(false);
- attackEntity(this.nexttarget);
- this.mc.thePlayer.setSprinting(this.wassprint);
- this.mc.thePlayer.rotationYaw = this.lastYaw;
- this.mc.thePlayer.rotationPitch = this.lastPitch;
- }
- public void onDisable()
- {
- try
- {
- if ((Values.getValues().autoblock) && (isSword(this.mc.thePlayer.inventory.getCurrentItem().getItem())))
- {
- this.mc.gameSettings.keyBindUseItem.pressed = false;
- for (int i = 0; i <= 2; i++) {
- this.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, new BlockPos(0, 0, 0), EnumFacing.DOWN));
- }
- }
- }
- catch (NullPointerException localNullPointerException) {}
- }
- private void populateEntityList()
- {
- for (Object o : this.mc.theWorld.loadedEntityList)
- {
- Entity e = (Entity)o;
- if (isAttackable(e)) {
- entityList.add(e);
- }
- }
- }
- private TimeHelper lasthit = new TimeHelper();
- boolean editpacket = false;
- private EntityLivingBase lastAttackedTarget;
- public void onPacketSend(Packet packet)
- {
- if ((packet instanceof C03PacketPlayer)) {
- C03PacketPlayer localC03PacketPlayer = (C03PacketPlayer)packet;
- }
- }
- private EntityLivingBase setupForNextEntity()
- {
- Random rand = new Random();
- EntityLivingBase toattack = null;
- try
- {
- for (Entity e : entityList) {
- if (this.time.isDelayComplete(rand.nextInt(this.aps - 53 + 1) + (this.aps - 20))) {
- if ((isViableToAttack((EntityLivingBase)e)) && (isAttackable(e)))
- {
- rot = getAngles(e);
- target = e;
- toattack = (EntityLivingBase)e;
- if (this.mc.thePlayer.isBlocking()) {
- for (int i = 0; i <= 2; i++) {
- this.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, new BlockPos(0, 0, 0), EnumFacing.DOWN));
- }
- }
- this.time.setLastMS();
- entityList.remove(e);
- }
- else
- {
- entityList.remove(e);
- }
- }
- }
- }
- catch (NullPointerException localNullPointerException) {}
- return toattack;
- }
- private void attackEntity(EntityLivingBase e)
- {
- try
- {
- this.mc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(e, C02PacketUseEntity.Action.ATTACK));
- this.mc.thePlayer.swingItem();
- this.lasthit.setLastMS();
- if (this.mc.thePlayer.isBlocking()) {
- for (int i = 0; i <= 2; i++) {
- this.mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(new BlockPos(-1, -1, -1), 255, this.mc.thePlayer.inventory.getCurrentItem(), 0.0F, 0.0F, 0.0F));
- }
- }
- this.targetSwitchTime.setLastMS();
- this.lastAttackedTarget = ((EntityLivingBase)target);
- target = null;
- this.mc.thePlayer.setSprinting(this.wassprint);
- this.nexttarget = null;
- }
- catch (NullPointerException localNullPointerException) {}
- }
- private void attackEntityList()
- {
- Random rand = new Random();
- try
- {
- for (Entity e : entityList) {
- if (this.time.isDelayComplete(rand.nextInt(this.aps - 53 + 1) + (this.aps - 20))) {
- if (isViableToAttack((EntityLivingBase)e))
- {
- rot = getAngles(e);
- this.mc.thePlayer.setSprinting(false);
- target = e;
- if (this.mc.thePlayer.isBlocking()) {
- for (int i = 0; i <= 2; i++) {
- this.mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, new BlockPos(0, 0, 0), EnumFacing.DOWN));
- }
- }
- this.mc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(target, C02PacketUseEntity.Action.ATTACK));
- this.mc.thePlayer.swingItem();
- this.lasthit.setLastMS();
- entityList.remove(e);
- this.time.setLastMS();
- if (this.mc.thePlayer.isBlocking()) {
- for (int i = 0; i <= 2; i++) {
- this.mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(new BlockPos(-1, -1, -1), 255, this.mc.thePlayer.inventory.getCurrentItem(), 0.0F, 0.0F, 0.0F));
- }
- }
- this.targetSwitchTime.setLastMS();
- this.lastAttackedTarget = ((EntityLivingBase)target);
- target = null;
- this.mc.thePlayer.setSprinting(this.wassprint);
- }
- else
- {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement