public void damageItem(int par1, EntityLiving par2EntityLiving)
    {
        if (this.isItemStackDamageable())
        {
            if (par1 > 0 && par2EntityLiving instanceof EntityPlayer)
            {
                int var3 = EnchantmentHelper.getUnbreakingModifier(((EntityPlayer)par2EntityLiving).inventory);

                if (var3 > 0 && par2EntityLiving.worldObj.rand.nextInt(var3 + 1) > 0)
                {
                    return;
                }
            }

            this.itemDamage += par1;

            if (this.itemDamage > this.getMaxDamage())
            {
                par2EntityLiving.renderBrokenItemStack(this);

                if (par2EntityLiving instanceof EntityPlayer)
                {
                    ((EntityPlayer)par2EntityLiving).addStat(StatList.objectBreakStats[this.itemID], 1);
                }

                --this.stackSize;

                if (this.stackSize < 0)
                {
                    this.stackSize = 0;
                }

                this.itemDamage = 0;
            }
        }
    }