Getting started
Keep inventory on death
Stop players from losing items when they die
- Edition
- Java Edition
- Version
- Java Edition 1.20.5 - 1.21.4
- Difficulty
- Beginner
- Prep time
- 1 minutes
- Copied
- 3 times
- Permission
- Requires cheats to be enabled or operator permission
When to use it
Use this in a shared world where death should not cost players their equipment. This is a world rule, not a per-player selection, and it does not recover items dropped before the rule was enabled.
Before running
Agree on the rule with players first, especially when losing equipment is part of the challenge. An operator only needs to enable it once; a repeating command block is unnecessary.
Follow in order
All commands
Enable the rule
/gamerule keepInventory trueTurns on the keepInventory rule for the whole world
Check the value
/gamerule keepInventoryWith no value on the end, this reads the current setting without changing it
What to customize
Change true to false to restore normal inventory-loss rules. Do not append @p or @a: keepInventory does not take a player selector.
Verify the result
Read the current value with /gamerule keepInventory without changing it. Test death behavior in a world copy using disposable items rather than valuable equipment.
When results differ
If items are still lost, confirm the command ran on the actual server and was not denied for permissions. Then check plugins or map logic that may restore another rule value.