Mojira Archive
MC-269580

Items with negative damage/extra durability are not upgraded correctly

The bug

If an item has a damage value from -32768 to -1 in 1.4.7 or earlier, and this item is upgraded to the latest 1.20.5 snapshot, that damage level will increase to 0.

In order to keep the amount of uses on these items the same, it'd be expected that the max durability for these items would be adjusted per item. Alternatively, since damage is handled as a 32-bit signed integer, negative values would also be handled, as they were previously.

Error messages are printed to the log.

How to reproduce

A world containing a chest containing several negatively damaged stone pickaxes is attached to this ticket.

  1. Open this world in 1.4.7
  2. Go into survival mode
  3. Break one of the stone blocks
  4. Open this world in the latest snapshot
  5. Break another one of the stone blocks with the same pickaxe, again in Survival mode

Expected results

In the latest version, the pickaxe would not obtain a durability bar, just like it didn't in 1.4.7.

Actual results

It now does.

How to fix

Either permit negative values for item damage, or make max item durability configurable via components somehow; this way, items with extra durability like these ones could have their durability component increased so that they function identically to how they did in 1.4.7 (the new max durability would be [normal durability of this item] + [abs(negative value specified for "damage")]. This way, none of the extra tool uses would disappear.

Further notes

If negative damage truly is considered unsupported, it may be advisable to use an unsigned 32-bit (or 64-bit) integer for damage instead, to remove the entire concept of negativity, and therefore double or even square the amount of possible durabilities.

This isn't even the worst issue that can be faced when upgrading a world from 1.4.7 - that award probably goes to the chunk-corrupting menace that is MC-232104.

Works As Intended

Connor Steppie

2024-03-19, 11:48 AM

2024-03-20, 08:04 AM

2024-03-20, 08:04 AM

1

1

Confirmed

Datafixer

data-fixer

24w11a

-