public virtual void useCurrentItemOnEntity(Entity entity) { if (entity.interact(this)) { return; } ItemStack itemstack = getCurrentEquippedItem(); if (itemstack != null && (entity is EntityLiving)) { itemstack.useItemOnEntity((EntityLiving)entity); if (itemstack.stackSize <= 0) { itemstack.func_577_a(this); destroyCurrentEquippedItem(); } } }
public void attackTargetEntityWithCurrentItem(Entity entity) { int i = inventory.getDamageVsEntity(entity); if (i > 0) { entity.attackEntityFrom(this, i); ItemStack itemstack = getCurrentEquippedItem(); if (itemstack != null && (entity is EntityLiving)) { itemstack.hitEntity((EntityLiving)entity); if (itemstack.stackSize <= 0) { itemstack.func_577_a(this); destroyCurrentEquippedItem(); } } } }