/** Damages the item in the ItemStack */ public void damageItem(int par1, EntityLivingBase par2EntityLivingBase) { if (!(par2EntityLivingBase instanceof EntityPlayer) || !((EntityPlayer) par2EntityLivingBase).capabilities.isCreativeMode) { if (this.isItemStackDamageable()) { if (this.attemptDamageItem(par1, par2EntityLivingBase.getRNG())) { par2EntityLivingBase.renderBrokenItemStack(this); --this.stackSize; if (par2EntityLivingBase instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) par2EntityLivingBase; entityplayer.addStat( StatList.objectBreakStats[Item.getIdFromItem(this.field_151002_e)], 1); if (this.stackSize == 0 && this.getItem() instanceof ItemBow) { entityplayer.destroyCurrentEquippedItem(); } } if (this.stackSize < 0) { this.stackSize = 0; } this.itemDamage = 0; } } } }