Skip to main content
← All Guides
Gamerules · Death & Respawn

Keep Your Inventory on Death

Losing a full netherite kit to one bad jump is brutal. The keepInventory gamerule turns death into a minor setback: your items and XP stay with you when you respawn.

server console, overworld
> entered command:
$/gamerule keepInventory true
[Server] Game rule keepInventory is now set to: true
Steve was slain by Zombie
OFF, items drop
scattered at death point
ON, items kept
respawns with full inventory
[Server] Steve kept their inventory and XP on death
The one command

Run /gamerule keepInventory true as an operator. That single command tells the world to leave your inventory and experience untouched on death. It is per-world and saved with the save file, so set it once per world. To go back to vanilla drops, run the same command with false.

Quick answers

+Do I keep XP too?
Yes. keepInventory true preserves both your inventory and your experience levels on death. There is no separate gamerule for XP.
+Why does the command say I lack permission?
You are not opped. On a server run /op YourName from the console, or in single-player enable cheats for that world.
+Does it work in single-player?
Yes, if the world has cheats on. Open to LAN with Allow Cheats: On to enable it temporarily on an existing no-cheats world.
+Can I keep items for only some players?
Vanilla applies the rule to everyone. Use a plugin like EssentialsX or LuckPerms with a per-group setup, or a datapack scoreboard, for per-player control.
+Will mobs still take my dropped gear?
With keepInventory on, nothing drops, so there is nothing for mobs to pick up. Your gear stays equipped on respawn.
+Is keepInventory cheating?
It is a setting, not a cheat. Many SMPs use it to keep building fun while still punishing deaths with the walk back from spawn.
+Does it stop XP drops too, or just items?
Both. With keepInventory true you keep all experience levels, so a Mending or Unbreaking grind survives death. The green XP orbs that normally pop out of your corpse do not spawn at all.
+Will my items survive falling in lava or the void?
Yes. keepInventory ignores the death cause. Lava, void, fire, drowning, fall damage all respawn you with a full inventory. This is the main reason people set it before mining at the deep diamond layer around Y -59.
+I set it but still lost my stuff, what went wrong?
Most likely you typed keepinventory with a lowercase i, or you set it in a different world. The rule is case-sensitive and per-world. Run /gamerule keepInventory to read the current value, and confirm you are in the same save where you set it.
+How is keepInventory different from doImmediateRespawn?
They are separate rules. keepInventory protects your items and XP. doImmediateRespawn true skips the You Died screen and respawns you instantly. Set both with /gamerule doImmediateRespawn true if you want a fast, no-loss death loop.

Common mistakes and edge cases

  • Capitalization matters. keepInventory needs the capital I. keepinventory returns no such game rule and nothing changes. Tab-complete the name in chat to avoid typos.
  • The rule is per-world, not per-account. The Nether and the End share the same world save, so one setting covers all three dimensions, but a brand new save starts at false. Set it again in each new world.
  • You still drop nothing, but you do not respawn on the spot. Without a bed or respawn anchor you wake at world spawn, so the walk back is the only real cost. Set /spawnpoint or sleep in a bed near your base.
  • Items in the End dimension behave the same, but falling into the void still kills you. With keepInventory on you keep your gear after a void death, which makes End island runs far less punishing.
  • On a multiplayer server the change applies to every player at once. There is no vanilla way to limit it to one person. Use a permission plugin or a datapack if you need per-player rules.
  • Realms and most server hosts require operator status to run gamerule. If you rent a server, set it from the host control panel console or after running /op YourName once.
Hosting
Skip the setup
Get a managed server with one click instead of configuring it all yourself.
Database
Browse every item
Look up the gear, blocks and drops you want to protect across every Minecraft version.