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

Inconsistent stacking behavior when 1-9 hotkeying out of limited slots

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 15w44b, Minecraft 1.9, Minecraft 16w42a, Minecraft 17w06a, 20w07a, 20w51a, 21w03a, 1.16.5, 21w05b, 21w06a, 21w07a, 21w08b, 1.19.2, 1.19.3 Release Candidate 3, 1.19.3, 1.21.3, 24w46a
    • None
    • Confirmed
    • UI
    • Low
    • Platform

      Like in MC-91883, I'm just going to provide steps to reproduce:

      1. /gamemode survival
      2. /clear
      3. /item replace entity @p armor.head with minecraft:carved_pumpkin
      4. /item replace entity @p hotbar.1 with minecraft:carved_pumpkin 32
      5. /item replace entity @p hotbar.2 with minecraft:carved_pumpkin 32
      5. Open your inventory, move your mouse over the pumpkin in the helmet slot
      6. Hit 2 on your keyboard and observe how item stack sizes in your hotbar do not change.
      7. Hit 3 on your keyboard and observe how item stack size increases in the second hotbar slot and decreases in the first hotbar slot.

      What's actually happening is: When using the 1-9 hotkey, it switches the item stacks between the two slots. Stack size limitation for the helmet slot dictates that only one item may move there, so only one of the 32 pumpkins is moved there, resulting in 31 pumpkins. Then the single pumpkin that was originally in the head slot is moved into the inventory: a slot for it is looked for because the slot we are hotkeying in is still occupied with 31 pumpkins. The game looks through the inventory to find a suitable spot for the single pumpkin to put in (a suitable slot is either an empty slot or a slot the pumpkin can be added to), finds the slot with 31 pumpkins in it and puts the pumpkin there.

      The "problem" lies with the order in which a slot is looked for: The 9 hotbar slots are always searched left-to-right. This is why, when we pressed the 2 key, the stack sizes remained the same (the pumpkin from the helmet slot was put in the same slot where the other pumpkin went), and when we pressed the 3 key, the stack sizes changed (the pumpkin from the helmet slot went into the 2nd hotbar slot, the pumpkin that was put into the helmet slot came from the 3rd hotbar slot).

      The item "to the left" of the hotkeyed stack can also be in the offhand.

            Unassigned Unassigned
            redstonehelper [Mod] redstonehelper
            Votes:
            12 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              CHK: