Execute one of these commands while holding a tool or weapon:
/item modify entity @s weapon.mainhand {function:"set_components",components:{"minecraft:damage":9999}}
or
/item modify entity @s weapon.mainhand {function:"set_damage",damage:-9999,add:true}
The durability of the held tool decreases to 0, but it isn’t broken
Inspecting the item data using
/data get
reveals that indeed the damage of the tool is equal or higher than its max durability, yet the tool isn’t broken.
Expected behavior would be for the tool to break when setting a damage higher than its max durability.
Environment
Minecraft Java Edition 1.21.7
This bug is also exists for java, but it never was fixed. (ex: 0 durability on zombified piglin’s golden swords). Did you tried to use the tool once for it to break?