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

Items with stack sizes above 64 are not upgraded correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Works As Intended
    • None
    • 24w11a
    • Confirmed
    • (Unassigned)

      The bug

      If an item has a stack size from 65 to 127 in 1.20.4 or earlier, and this item is upgraded to the latest 1.20.5 snapshot, that stack size will decrease to 64, causing unwanted item loss.

      Errors are reported to the console while loading any such worlds, for example:

      Tried to load invalid item: 'Item stack with stack size of 127 was larger than maximum: 64 missed input: {}'
      Tried to load invalid item: 'Item stack with stack size of 127 was larger than maximum: 64'

      How to reproduce

      A world containing a stack of 127 logs in a chest is attached to this ticket.

      1. Open this world in 1.20.4
      2. Look inside the right chest (you will need to click to verify the stack count due to MC-267171)
      3. Replace the right chest with a new one with NBT, there is a chest full of them behind the wall
      4. Open this world in the latest snapshot
      5. Look in the right chest again (click stack to verify)

      Expected results

      In the latest version, the stack size would still be 127, and 63 items would not just get deleted for no reason.

      Actual results

      63 of those items are now permanently gone.

      Further notes

      Since stack size is now handled as an integer, rather than as a byte, the maximum stack size should be 2147483647 rather than 127, even if it isn't possible to stack that high in survival; could be useful in custom maps. The artificial limit should preferably be configurable through some means, perhaps via a game rule or a maximum stack size component for items.

        1. 2024-03-17_16.18.23.png
          85 kB
          Connor Steppie
        2. 2024-03-17_16.18.25.png
          86 kB
          Connor Steppie
        3. 2024-03-17_16.22.38.png
          89 kB
          Connor Steppie
        4. 2024-03-17_16.22.39.png
          87 kB
          Connor Steppie

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

              Created:
              Updated:
              Resolved:
              CHK: