mojira.dev
MC-299649

Tools don't break when using the set_damage or set_components item modifiers on them

  1. 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}
  1. The durability of the held tool decreases to 0, but it isn’t broken

  2. Inspecting the item data using /data getreveals 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

Linked issues

Comments 1

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?

daenvil

(Unassigned)

Confirmed

Commands, Items

1.21.7

Retrieved