mojira.dev
MC-271081

"minecraft:set_damage" on an item with the "minecraft:max_damage" component works strangely

When an item is created with the proper components (as per MC-269654) the "minecraft:set_damage" modifier function and "add": true causes strange effects

How to Reproduce:

  1. Create an item like /give @s minecraft:iron_axe[minecraft:damage=0,minecraft:max_damage=20]

  2. Run /item modify entity @s weapon.mainhand {"function": "minecraft:set_damage","damage": -1,"add": true} and see that it instantly sets damage to max damage.

  3. Run /item modify entity @s weapon.mainhand {"function": "minecraft:set_damage","damage": 1,"add": true} and see that it suddenly resets damage entirely.

Comments 1

set_damage expects a ratio between 0 and 1, so this is expected

Immodial

(Unassigned)

Unconfirmed

(Unassigned)

1.20.5

Retrieved