When a player dies while holding any item(s) in their mouse cursor (in an inventory, or GUI for example) the stack will be removed from that player's inventory and drop as an item entity, even if the keepInventory
gamerule is enabled.
Steps to Reproduce:
(Must be in survival mode, with cheats enabled)
Enable 'keepInventory':
/gamerule keepInventory true
Take continuous damage (ie; stand near a cactus, in fire, falling. etc)
Before dying, open your inventory and hold an item in your cursor
Expected & Observed Behavior:
❌ - What ever you're holding will drop on the ground as an entity where you died.
✔ - The items would be returned to the player inventory.
Linked issues
is duplicated by 3
relates to 2
Attachments
Comments 18
The thing is, fill your enthire inventory with items, including offhand and armor slots.
Go stand in a dropped item and move a item out of a slot, there is no free space left, since you'll pickup the dropped item.
What slot is left to put it in?
As I mentioned in the description, that corner case cannot be solved this way. The item should be dropped as is the case right now. Doesn't mean the behavior is correct or intended for inventories that are not completely full.
IMO this should go to the reddit, post it that it should drop at spawn, when respawning instead, or something like that
As the current situation is the intended situation, as it's not stored in the inventory
I believe this is due to the fact that if you hold an item with you cursor and close a GUI including your inventory it drops the item even if you closed it because you died.
Can reproduce this in 24w04a. I'd like to request ownership of this issue, as it relates closely to another issue I maintain, MC-234511. @unknown has also been inactive for 4 years.
There is no inventory slot for a item you switch slots, so ther is no place in can place it in when you die
Most likely intended due to that reason