mojira.dev
MC-85216

Shift-clicking in player inventory cannot move items into off-hand if item is no off-hand item

The bug

Shift-clicking an item which is not an offhand item (like a shield) will never move it to the offhand, even if no other slots are free or the offhand has already the same item.

How to reproduce

Option 1:

  1. Place a chestplate in the chest armor slot

  2. Fill your complete inventory except for the offhand slot with items

  3. Try to shift-click the chestplate into the offhand slot
    → ❌ It does not work

Option 2:

  1. Set your gamemode to survival

  2. Put some torches in your offhand slot

  3. Craft more torches and collect them using shift-click
    → ❌ Torches won't stack on the offhand slot but in the inventory

Code analysis

Based on 1.11.2 decompiled using MCP 9.35 rc1

The method net.minecraft.inventory.ContainerPlayer.transferStackInSlot(EntityPlayer, int) only tries to merge items with items in slots up to (excluding) index 45 which is offhand. Therefore the items cannot be moved into the offhand.

Linked issues

Attachments

Comments 9

Confirmed for player crafting grid and for crafting table.

I confirm the bug items in the left hand "MC-87395"

Is this still an issue in the latest snapshot 16w44a? If so please update the affected versions.

This is an automated comment on any open or reopened issue with out-of-date affected versions.

Can confirm for MC 1.12.1.

Confirmed for 1.13.1.

Confirmed in 1.16-pre5. Please, change the reporter to me, I'll keep this ticket updated.

Can confirm in 21w05b.

Can confirm in 1.16.5 and 21w08b.

Enzo Lopez

[Mod] turbo

(Unassigned)

Confirmed

Platform

Low

Inventory

hotbar, inventory, item, off-hand, shift-click, slot

Minecraft 15w32a, Minecraft 15w35b, Minecraft 15w45a, Minecraft 16w35a, Minecraft 1.11.2, ..., 1.20.5, 1.20.6, 1.21, 1.21.4, 25w02a

Retrieved