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.

Related issues

MC-80609 /replaceitem command doesn't work with armour pieces when accessing an inventory MC-97819 Weird ghost items when items are picked up while in creative mode in a non-survival inventory tab. MC-108894 Replaceitem does not replace player inventory while viewing a container MC-133145 Replace offhand item while opening GUI cause render issue MC-147175 Offhand and armor items don't update client-side if they are put when the player has a container open MC-154254 While in creative inventory, if item is picked up it dissapears MC-190966 /replaceitem does not replace armor slots on players inside of other interfaces MC-192256 Tools in offhand do not repair with mending when accessing an inventory MC-193306 Items disappear when picked up in creative mode while looking at creative inventory MC-201900 Offhand slot items cannot update while a chest is open

Comments

marcono1234

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

migrated

Thanks

migrated

Why is the state of this issue still Unconfirmed?

migrated

This still affects 1.12.2. Very annoying for my game.

migrated

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.

j_p_smith

Confirmed in 1.15.2 and 1.16 Release Candidate 1.

GrifterMage

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.

pokechu22

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

migrated

Can confirm on 1.16.4

migrated

1.16.4 is not out yet tho

Avoma

Updated command usage for /item:

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

migrated

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