Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-269580

Items with negative damage/extra durability are not upgraded correctly

XMLWordPrintable

    • Icon: Bug 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.

      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.

        1. 2024-03-19_11.35.22.png
          2024-03-19_11.35.22.png
          39 kB
        2. 2024-03-19_11.35.39.png
          2024-03-19_11.35.39.png
          111 kB
        3. 2024-03-19_11.40.49.png
          2024-03-19_11.40.49.png
          94 kB
        4. 2024-03-19_11.41.07.png
          2024-03-19_11.41.07.png
          229 kB
        5. extradurabilityupgradetest.zip
          147 kB

            Unassigned Unassigned
            Awesoman3000 Connor Steppie
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: