-
Bug
-
Resolution: Works As Intended
-
None
-
24w11a
-
Confirmed
-
Datafixer
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.
- Open this world in 1.4.7
- Go into survival mode
- Break one of the stone blocks
- Open this world in the latest snapshot
- 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.