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.
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.
keepInventoryneeds the capital I.keepinventoryreturns 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
/spawnpointor 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 YourNameonce.
Blocks and items in this guide
All 5 of these are named in the guide above, starting with Water Bucket. Look them up in the item database.
More guides on this site
Guides that go with this one
How to Survive a Long Fall
Fall damage is one heart per block past three. Water buckets, hay bales, slime blocks and Feather...
Multiverse, Per-World Inventories
Set up multiverse per world inventories to give each world its own player inventory, health, XP, and...
How to Safely Reload Plugins Without Restarting
A practical guide to reload plugins on a minecraft server safely, covering PlugManX, per-plugin reload...
How to Link Servers with Shared Chat, Economy & Inventory
Learn how to share player data across BungeeCord or Velocity servers using MySQL, Redis and cross-server...
How to Migrate Your Minecraft Server to a New Host
Step-by-step guide to moving your Minecraft server to a different hosting provider without losing...
How to Change the Time With Commands in Minecraft
Use /time set day, night, and midnight plus /time add to control the day-night cycle on your Minecraft...