mojira.dev
MC-87019

Only visible slots are updated clientside when you are inside an inventory

The bug

When you are inside an inventory (chest/horse/crafting table/creative inventory...) only visible slots are updated. This way, when you are inside:

  • Normal player inventory and Survival inventory tab in creative - everything is fine

  • Most inventories - armor and offhand slots are not updated
    Creative item/search tabs - only hotbar is updated

  • When you remove an item (/clear, /replaceitem with air) from a non-updating slot you get a ghost item - you can't use it properly and it disappears in survival when you update your inventory.

  • When you add an item (/replaceitem, pick up from ground) - you get an invisible item. It will reappear when you re-enter the world or (in survival) when you update this slot.

How to reproduce

  • Setup 2 command blocks with significant delay running in a loop, with commands like the following:

    /item entity @p container.10 replace minecraft:brick

    the second one with another block parameter;

  • Open the creative menu and switch away from your survival inventory (note that the bug doesn't occur when the menu is closed);

  • Wait for the command to switch the item and go back to your survival inventory: the item should be replaced but it is not: this is the issue;

  • Optional: relog and see the item is replaced after all.

Linked issues

MC-80609 /replaceitem command doesn't work with armour pieces when accessing an inventory Resolved MC-97819 Weird ghost items when items are picked up while in creative mode in a non-survival inventory tab. Resolved MC-108894 Replaceitem does not replace player inventory while viewing a container Resolved MC-133145 Replace offhand item while opening GUI cause render issue Resolved MC-147175 Offhand and armor items don't update client-side if they are put when the player has a container open Resolved

Comments 11

Confirmed for

  • 15w36c It only works once after opening a world, but it seems to affect also players with a closed inventory, however the /replaceitem command states it succeeded

Relates to:

  • MC-2912: The items seem to appear after reopening the world

Thanks

Why is the state of this issue still Unconfirmed?

This still affects 1.12.2. Very annoying for my game.

Still affects 1.13, 1.14, 1.15, 1.16.

The NBT of Inventory is actually updated correctly. For example, if you replace a gold block in your offhand with diamond block and trigger this bug, what is displayed in your inventory is gold block. but if you place it, it turns out to be diamond block. So it seems to be a client-side display bug.

But what is weird is that the item that has triggered this bug can be regained if you place it to another slot or just throw it away and pick it up, which means it is more than just a display bug.

1 more comments

Confirmed in 1.16.1.

Also applies when the player is looking at a non-inventory GUI such as a book on a lectern–the player's hotbar and offhand will not update when those GUIs are open, causing ghost items.

Note that the lectern is actually internally/over the network an inventory (while held books are not).

Can confirm on 1.16.4

1.16.4 is not out yet tho

Updated command usage for /item:

/item entity @p container.10 replace minecraft:brick

Steven W.d.V.

boq

Confirmed

Normal

Inventory, Networking

/clear, /replaceitem, inventory

Minecraft 15w34d, Minecraft 15w36c, Minecraft 15w37a, Minecraft 15w38b, Minecraft 15w39b, ..., 1.16.2 Pre-release 1, 1.16.2 Pre-release 2, 1.16.2 Release Candidate 1, 1.16.2, 1.16.3

21w10a

Retrieved