public override void HandleUseEntity(net.minecraft.src.Packet7UseEntity packet7useentity) { if (this.playerEntity.isDead) { return; // CRAFTBUKKIT } net.minecraft.src.WorldServer worldserver = mcServer.GetWorldServer(playerEntity.dimension); net.minecraft.src.Entity entity = worldserver.Func_6158_a(packet7useentity.targetEntity); ItemStack itemInHand = this.playerEntity.inventory.GetCurrentItem(); // CRAFTBUKKIT if (entity != null && playerEntity.CanEntityBeSeen(entity) && playerEntity.GetDistanceSqToEntity(entity) < 36D) { if (packet7useentity.isLeftClick == 0) { playerEntity.UseCurrentItemOnEntity(entity); // CRAFTBUKKIT start - update the client if the item is an infinite one if (itemInHand != null && itemInHand.stackSize <= -1) { this.playerEntity.UpdateInventory(this.playerEntity.currentCraftingInventory); } // CRAFTBUKKIT end } else if (packet7useentity.isLeftClick == 1) { // CRAFTBUKKIT start if ((entity is EntityItem) || (entity is EntityArrow)) { String type = entity.GetType().Name; KickPlayer("Attacking an " + type + " is not permitted"); logger.Warning("Player " + playerEntity.username + " tried to attack an " + type + ", so I have disconnected them for exploiting."); return; } // CRAFTBUKKIT end playerEntity.AttackTargetEntityWithCurrentItem(entity); // CRAFTBUKKIT start - update the client if the item is an infinite one if (itemInHand != null && itemInHand.stackSize <= -1) { this.playerEntity.UpdateInventory(this.playerEntity.currentCraftingInventory); } // CRAFTBUKKIT end } } }