mojira.dev
MC-276651

damage_item does not repair items when the value is negative

Starting from 1.21, it was possible to make enchantments that repaired the enchanted item using a negative value for the damage_item component. However, as of 24w33a and up to the most recent snapshot 24w37a, this is no longer possible.

Steps to Reproduce:

  1. Get the following item:

    /give @p minecraft:netherite_chestplate[minecraft:damage=591]
  2. Enchant it with the following command:

    /enchant @p testing:repair_damage_negative_test
  3. Hold the damaged item in your mainhand

Expected Result:
The item continues to have one durability point repaired every 20 ticks, like before.

Actual Result:
The item is not repairing itself over time, it remains at it's current durability amount.

Attachments

Comments 2

This seems intentional to me provided an item should only be damaged by a positive integer, but I've confirmed the report.

An alternative would be to use an “Item Modifier” to change the damage of the item, but even doing this still an issue.

[media]

"Set damage" only allows you to use a value between 0~1, being forced to calculate ( 1 / max_damage x amount of damage to repair). This is possible to achieve with a scoreboard, but due to the use of decimals, if the item uses an high max_damage value, it's possible that the result will give an erroneous decimal.

It would be much more appropriate (if this is possible) to revert the change that doesn't allow the use of negative values, or change the field of the “damage_item” effect, to allow discounting the damage value.

miziragamez

slicedlime

Confirmed

Platform

Important

Data Packs, Enchantments

damage-item, data-pack, enchantment

24w37a, 24w38a

24w40a

Retrieved