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

Items with stack sizes below 1 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 -128 to 0 in 1.10.2 or earlier, and this item is upgraded to the latest 1.20.5 snapshot, that stack size will increase to 1.

      Since item counts are handled as a 32-bit signed integer, it'd be expected that negative values would also be handled, as they were previously.

      How to reproduce

      A world containing a chest containing several negative item stack counts is attached to this ticket.

      1. Open this world in 1.10.2
      2. Look inside the chest
      3. Open this world in the latest snapshot
      4. Look in the chest again

      Expected results

      In the latest version, the stack sizes would still be negative, as they used to be.

      Actual results

      All of the negative stacks are now stacks of 1.

      Further notes

      Since stack size is now handled as an integer, rather than as a byte, the minimum stack size should be -2147483648, even if it isn't possible to get such stack sizes in survival; there may be a use for this in custom maps. The artificial limit should preferably be configurable through some means, perhaps via a game rule or a minimum stack size component for items.

      If negative stack counts truly are considered unsupported, it may be advisable to use an unsigned 32-bit (or 64-bit) integer for item stacks instead, to remove the entire concept of negativity, and therefore double or even square the amount of possible positive stack sizes (which may be useful alongside said potential stack size component, see also MC-269536).

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

              Created:
              Updated:
              Resolved:
              CHK: