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



    • Type: Bug
    • Status: Reopened
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 15w44b, Minecraft 1.9, Minecraft 16w42a, Minecraft 17w06a, 20w07a
    • Fix Version/s: None
    • Labels:
    • Confirmation Status:
    • Category:
    • Mojang Priority:


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

      1. /gamemode survival
      2. /clear
      3. /replaceitem entity @p armor.head minecraft:pumpkin
      4. /replaceitem entity @p hotbar.1 minecraft:pumpkin 32
      5. /replaceitem entity @p hotbar.2 minecraft: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.


          Issue Links



              Unassigned Unassigned
              redstonehelper [Mod] redstonehelper
              9 Vote for this issue
              8 Start watching this issue