mojira.dev
MC-302297

Swapping an item stack from a GUI into the offhand on the same tick the player's inventory is cleared creates a ghost item

Pressing F to swap an item stack from a container into the player’s empty offhand creates a ghost item if the player’s inventory is cleared that tick.

This does not seem to happen when the player’s offhand was not initially empty (which is fortunate because that would have allowed for item duplication). Also, upon opening the creative inventory, the ghost item either disappears or becomes a real item.

To reproduce

  1. /setblock ~ ~ ~ chest{Items:[{count:32,Slot:13b,id:"minecraft:prismarine_shard"}]}

  2. Place and power a repeating command block with execute as @p if data entity @s equipment.offhand at @s run particle minecraft:scrape ~ ~1 ~ 0.3 0 0.3 1 3

  3. Place and power a repeating command block with clear @p

  4. Open the chest, hover over the prismarine shards and press F
    The prismarine shards appear in your offhand, but no particles appear

  5. De-power the command block that was clearing your inventory

  6. Open your inventory and click on the prismarine shards
    They disappear since they were a ghost item

Linked issues

Comments 1

Can confirm in 1.21.9. This was previously reported in MC-297508 (but it applies to singleplayer too) and the root cause is likely the same as for MC-199643 and MC-251555. I will update the title and description and request “relates to” links to the latter two issues.

Bk23miner

(Unassigned)

Confirmed

Platform

Normal

Commands, Items, Networking

1.21.8, 1.21.9

Retrieved