Respawning causes your hotbar to reset to the first space
The Bug:
Hotbar selection resets to slot 0 upon death.
Steps to Reproduce:
- Give yourself two different items held in different hotbar slots.
/item replace entity @s hotbar.0 with minecraft:dirt /item replace entity @s hotbar.1 with minecraft:deepslate
- Hold the deepslate in your hand and set the "keepInventory" gamerule to "true".
/gamerule keepInventory true
- Run the "/kill" command.
- Take note as to whether or not hotbar selection resets to slot 0 upon death.
Observed Behavior:
Hotbar selection resets to slot 0 upon death.
Expected Behavior:
Hotbar selection would not reset to slot 0 upon death.
Linked Issues
is duplicated by1
Created Issue:
respawning causes your hotbar to reset to the first space
im not sure if this is a bug, but thats only my opinion. as shown in the pictures, respawning causes the hotbar to reset to the first slot.
respawning causes your hotbar to reset to the first spaceRespawning causes your hotbar to reset to the first space
im not sure if this is a bug, but thats only my opinion. as shown in the pictures, respawning causes the hotbar to reset to the first slot.As shown in the pictures, respawning causes the hotbar to reset to the first slot.
is duplicated by
relates to
As shown in the pictures, respawning causes the hotbar to reset to the first slot.The Bug:
Hotbar selection resets to slot 0 upon death.
Steps to Reproduce:
- Give yourself two different items held in different hotbar slots.
/item replace entity @s hotbar.0 with minecraft:dirt /item replace entity @s hotbar.1 with minecraft:deepslate
- Hold the deepslate in your hand and set the "keepInventory" gamerule to "true".
/gamerule keepInventory true
- Run the "/kill" command.
- Take note as to whether or not hotbar selection resets to slot 0 upon death.
Observed Behavior:
Hotbar selection resets to slot 0 upon death.
Expected Behavior:
Hotbar selection would not reset to slot 0 upon death.
Duplicate of MC-143474.


Affects 20w30a
Can confirm in 20w51a.
Can confirm in 21w03a.
Can confirm in 21w05b.
Can confirm in 21w06a.
Can confirm in 1.16.5 and 21w08b.
Can confirm in 1.17.1.
Can confirm this in 21w43a. Here are some extra details regarding this problem.
The Bug:
Hotbar selection resets to slot 0 upon death.
Steps to Reproduce:
/gamerule keepInventory trueObserved Behavior:
Hotbar selection resets to slot 0 upon death.
Expected Behavior:
Hotbar selection would not reset to slot 0 upon death.
Can confirm in 1.18.2 and 22w18a.
Code analysis
Yarn 1.19 mappings - net.minecraft.client.network.ClientPlayNetworkHandler
As you can see this is where the player is re-created. In this method there is no call to set the selected slot to the previous. I suggest the following.
Can confirm in 1.19.2.
Why should it be the case that the hotbar slot is preserved? Other things, like orientation, aren't. If keepInventory is disabled then it's extra silly to preserve the slot.
Map makers may trigger things based on selected slot/item, causing you to unwillingly trigger said system.