mojira.dev
MC-192212

Switching game modes while in inventory can delete items

The bug

If your gamemode is switched between survival and creative via a datapack when you pick up an item in your inventory with your cursor, that item will be unexpectedly deleted. This makes it difficult to create datapacks or gamemodes that involve switching between the two, especially if important items are involved, or if those items are supposed to trigger the gamemode change themselves.

How to reproduce

  1. Obtain an item in survival

  2. Make a datapack that changes your gamemode while your in your inventory screen (on an interval, triggered by another player, etc.)

  3. Attempt to move that item in your inventory, and hold it as your gamemode changes

What I'd expect to happen: The item remains under my cursor, or is dropped in front of me

What actually happens: The item disappears.

Comments 2

Confirmed, although the item was dropped when I closed my inventory afterwards

Issue still persists through 1.21.3.

Pacca

(Unassigned)

Confirmed

(Unassigned)

game-mode-switch

1.16.1, 1.16.4, 1.21.3

Retrieved