-
Bug
-
Resolution: Fixed
-
Minecraft 1.12.1
-
Confirmed
The bug
Tool and armor durability allows for items with 0 durability, and only breaks after the next use. This doesn't make much sense: a tool with 100 durability should have 100 uses left, but it actually has 101. Likewise, a tool with its max damage on it should be broken, as the next use would be too much damage and so it shouldn't be able to be used again.
In other words: tools/armor should break at 0 durability, not at -1 durability.
Code Analysis
The fix is very simple. Using the Forge for 1.12.1 names, in the ItemStack#attemptDamageItem() method, it currently returns this:
return getItemDamage() > getMaxDamage();
Instead, it should return this:
return getItemDamage() >= getMaxDamage();
Just a "greater than" changed to a "greater than or equal to" fixes the problem everywhere.
- relates to
-
MC-136374 Mobs can drop 0 durability items
- Resolved
-
MC-265207 Durability bar can appear empty even if the item still has remaining uses
- Open
-
MCPE-176713 Durability is off by one
- Open
-
MC-136400 'Serious Dedication' advancement not given when using up diamond hoe
- Resolved
-
MC-137212 Tool Durability - Breaks at 0
- Resolved
-
MC-139044 All items added before 18w30b have 1 less usage
- Resolved
-
MC-163946 Tridents with one durability remaining can be thrown
- Resolved