private void attack(final EntityLivingBase ent, final boolean crit) { this.swingItem(); if (crit) { this.crit(); } else { this.mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer()); } final float sharpLevel = EnchantmentHelper.func_152377_a(this.mc.thePlayer.getHeldItem(), ent.getCreatureAttribute()); final boolean vanillaCrit = this.mc.thePlayer.fallDistance > 0.0f && !this.mc.thePlayer.onGround && !this.mc.thePlayer.isOnLadder() && !this.mc.thePlayer.isInWater() && !this.mc.thePlayer.isPotionActive(Potion.blindness) && this.mc.thePlayer.ridingEntity == null; this.mc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(ent, C02PacketUseEntity.Action.ATTACK)); if (crit || vanillaCrit) { this.mc.thePlayer.onCriticalHit(ent); } if (sharpLevel > 0.0f) { this.mc.thePlayer.onEnchantmentCritical(ent); } }
/** * Attacks an entity */ public void attackEntity(EntityPlayer playerIn, Entity targetEntity) { this.syncCurrentPlayItem(); this.netClientHandler.addToSendQueue(new C02PacketUseEntity(targetEntity, C02PacketUseEntity.Action.ATTACK)); if (this.currentGameType != WorldSettings.GameType.SPECTATOR) { playerIn.attackTargetEntityWithCurrentItem(targetEntity); } }
/** * Send packet to server - player is interacting with another entity (left click) */ public boolean interactWithEntitySendPacket(EntityPlayer playerIn, Entity targetEntity) { this.syncCurrentPlayItem(); this.netClientHandler.addToSendQueue(new C02PacketUseEntity(targetEntity, C02PacketUseEntity.Action.INTERACT)); return this.currentGameType != WorldSettings.GameType.SPECTATOR && playerIn.interactWith(targetEntity); }
public boolean func_178894_a(EntityPlayer p_178894_1_, Entity p_178894_2_, MovingObjectPosition p_178894_3_) { this.syncCurrentPlayItem(); Vec3 vec3 = new Vec3(p_178894_3_.hitVec.xCoord - p_178894_2_.posX, p_178894_3_.hitVec.yCoord - p_178894_2_.posY, p_178894_3_.hitVec.zCoord - p_178894_2_.posZ); this.netClientHandler.addToSendQueue(new C02PacketUseEntity(p_178894_2_, vec3)); return this.currentGameType != WorldSettings.GameType.SPECTATOR && p_178894_2_.interactAt(p_178894_1_, vec3); }
@EventTarget private void onPostUpdate(UpdateEvent event) { if (event.state == Event.State.POST && (autoclicker && Mouse.isButtonDown((int)0) || !autoclicker) && this.mc.objectMouseOver != null && this.mc.objectMouseOver.entityHit != null && this.attackChecks(this.mc.objectMouseOver.entityHit) && this.timer.delay((float)(1000.0 / this.speed))) { if (this.criticals) { this.crit(); } this.mc.thePlayer.swingItem(); this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C02PacketUseEntity(this.mc.objectMouseOver.entityHit, C02PacketUseEntity.Action.ATTACK)); this.timer.reset(); } }
@EventTarget private void onPacketSend(PacketSendEvent event) { if (event.packet instanceof C0BPacketEntityAction || event.packet instanceof C03PacketPlayer || event.packet instanceof C02PacketUseEntity || event.packet instanceof C0APacketAnimation || event.packet instanceof C08PacketPlayerBlockPlacement) { this.packetList.add(event.packet); event.setCancelled(true); } }
public FriendProtect() { super("Friend Protect", 0xFFF6194A, ModuleCategory.COMBAT); setHidden(true); listeners.add(new Listener<SendPacket>() { @Override public void call(SendPacket event) { if (event.getPacket() instanceof C02PacketUseEntity) { C02PacketUseEntity useEntity = (C02PacketUseEntity) event.getPacket(); Entity entity = useEntity.getEntityFromWorld(mc.theWorld); if (useEntity.getAction() == C02PacketUseEntity.Action.ATTACK && Serenity.getInstance().getFriendManager().isFriend(entity.getCommandSenderName())) { ItemStack currentItem = mc.thePlayer.getCurrentEquippedItem(); Item item = currentItem == null ? null : currentItem.getItem(); if (minezHealing.getValue()) { if (item != null && (item == Items.paper || (item == Items.dye) || item == Items.shears)) { return; } } if (swordsOnly.getValue() && (item instanceof ItemSword)) { return; } if (notify.getValue()) { Serenity.getInstance().addChatMessage(String.format("%s is your friend.", entity.getCommandSenderName())); } event.setCancelled(true); } } } }); setState(true); }
/** * Processes interactions ((un)leashing, opening command block GUI) and attacks on an entity with players currently * equipped item */ public void processUseEntity(C02PacketUseEntity p_147340_1_) { WorldServer var2 = this.serverController.worldServerForDimension(this.playerEntity.dimension); Entity var3 = p_147340_1_.func_149564_a(var2); this.playerEntity.func_143004_u(); if (var3 != null) { boolean var4 = this.playerEntity.canEntityBeSeen(var3); double var5 = 36.0D; if (!var4) { var5 = 9.0D; } if (this.playerEntity.getDistanceSqToEntity(var3) < var5) { if (p_147340_1_.func_149565_c() == C02PacketUseEntity.Action.INTERACT) { this.playerEntity.interactWith(var3); } else if (p_147340_1_.func_149565_c() == C02PacketUseEntity.Action.ATTACK) { if (var3 instanceof EntityItem || var3 instanceof EntityXPOrb || var3 instanceof EntityArrow || var3 == this.playerEntity) { this.kickPlayerFromServer("Attempting to attack an invalid entity"); this.serverController.logWarning("Player " + this.playerEntity.getCommandSenderName() + " tried to attack an invalid entity"); return; } this.playerEntity.attackTargetEntityWithCurrentItem(var3); } } } }
/** * Attacks an entity */ public void attackEntity(EntityPlayer par1EntityPlayer, Entity par2Entity) { this.syncCurrentPlayItem(); this.netClientHandler.addToSendQueue(new C02PacketUseEntity(par2Entity, C02PacketUseEntity.Action.ATTACK)); par1EntityPlayer.attackTargetEntityWithCurrentItem(par2Entity); }
/** * Send packet to server - player is interacting with another entity (left click) */ public boolean interactWithEntitySendPacket(EntityPlayer par1EntityPlayer, Entity par2Entity) { this.syncCurrentPlayItem(); this.netClientHandler.addToSendQueue(new C02PacketUseEntity(par2Entity, C02PacketUseEntity.Action.INTERACT)); return par1EntityPlayer.interactWith(par2Entity); }
public void processUseEntity(C02PacketUseEntity p_147340_1_) { WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); Entity entity = p_147340_1_.func_149564_a(worldserver); this.playerEntity.func_143004_u(); if (entity != null) { boolean flag = this.playerEntity.canEntityBeSeen(entity); double d0 = 36.0D; if (!flag) { d0 = 9.0D; } if (this.playerEntity.getDistanceSqToEntity(entity) < d0) { if (p_147340_1_.func_149565_c() == C02PacketUseEntity.Action.INTERACT) { this.playerEntity.interactWith(entity); } else if (p_147340_1_.func_149565_c() == C02PacketUseEntity.Action.ATTACK) { if (entity instanceof EntityItem || entity instanceof EntityXPOrb || entity instanceof EntityArrow || entity == this.playerEntity) { this.kickPlayerFromServer("Attempting to attack an invalid entity"); this.serverController.logWarning("Player " + this.playerEntity.getCommandSenderName() + " tried to attack an invalid entity"); return; } this.playerEntity.attackTargetEntityWithCurrentItem(entity); } } } }
/** * Processes interactions ((un)leashing, opening command block GUI) and attacks on an entity with players currently * equipped item */ public void processUseEntity(C02PacketUseEntity packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); Entity entity = packetIn.getEntityFromWorld(worldserver); this.playerEntity.markPlayerActive(); if (entity != null) { boolean flag = this.playerEntity.canEntityBeSeen(entity); double d0 = 36.0D; if (!flag) { d0 = 9.0D; } if (this.playerEntity.getDistanceSqToEntity(entity) < d0) { if (packetIn.getAction() == C02PacketUseEntity.Action.INTERACT) { this.playerEntity.interactWith(entity); } else if (packetIn.getAction() == C02PacketUseEntity.Action.INTERACT_AT) { entity.interactAt(this.playerEntity, packetIn.getHitVec()); } else if (packetIn.getAction() == C02PacketUseEntity.Action.ATTACK) { if (entity instanceof EntityItem || entity instanceof EntityXPOrb || entity instanceof EntityArrow || entity == this.playerEntity) { this.kickPlayerFromServer("Attempting to attack an invalid entity"); this.serverController.logWarning("Player " + this.playerEntity.getName() + " tried to attack an invalid entity"); return; } this.playerEntity.attackTargetEntityWithCurrentItem(entity); } } } }
public void attackEntity(EntityPlayer p_78764_1_, Entity p_78764_2_) { syncCurrentPlayItem(); this.netClientHandler.addToSendQueue(new C02PacketUseEntity(p_78764_2_, C02PacketUseEntity.Action.ATTACK)); p_78764_1_.attackTargetEntityWithCurrentItem(p_78764_2_); }
public boolean interactWithEntitySendPacket(EntityPlayer p_78768_1_, Entity p_78768_2_) { syncCurrentPlayItem(); this.netClientHandler.addToSendQueue(new C02PacketUseEntity(p_78768_2_, C02PacketUseEntity.Action.INTERACT)); return p_78768_1_.interactWith(p_78768_2_); }
@Override public void processUseEntity(C02PacketUseEntity p_147340_1_) { }
public void attackEntity(EntityPlayer p_78764_1_, Entity p_78764_2_) { this.syncCurrentPlayItem(); this.netClientHandler.addToSendQueue(new C02PacketUseEntity(p_78764_2_, C02PacketUseEntity.Action.ATTACK)); p_78764_1_.attackTargetEntityWithCurrentItem(p_78764_2_); }
public boolean interactWithEntitySendPacket(EntityPlayer p_78768_1_, Entity p_78768_2_) { this.syncCurrentPlayItem(); this.netClientHandler.addToSendQueue(new C02PacketUseEntity(p_78768_2_, C02PacketUseEntity.Action.INTERACT)); return p_78768_1_.interactWith(p_78768_2_); }
/** * Processes interactions ((un)leashing, opening command block GUI) and attacks on an entity with players currently * equipped item */ void processUseEntity(C02PacketUseEntity packetIn);
/** * Processes interactions ((un)leashing, opening command block GUI) and attacks on an entity with players currently * equipped item */ void processUseEntity(C02PacketUseEntity var1);
void processUseEntity(C02PacketUseEntity p_147340_1_);