It happens to even the most cautious explorer: you’re far from home, you die, and all your precious loot is left sitting in a pile far, far away. Tired of losing your loot? No problem. Read on as we show you how to make your Minecraft inventory persist after death (along with some other handy game-changing tricks).
Note: This tutorial is focused on the PC edition of Minecraft as, presently, neither Minecraft Pocket Edition or Minecraft Console Edition support the editing of the in-game variables required for enabling persistent inventory or the like. Should this change, we will update the tutorial with instructions for the other editions.
Why Do I Want To Do This?
We’re huge proponents of playing a game the way you want to play it and in the case of a game like Minecraft, the game is outright designed to encourage players to do just that: to build, create, manipulate, and outright edit the world to create the game universe and play experience they want.
One particular aspect of the default play scheme that many players find quite frustrating is the way player inventory is dropped upon death. By default, when you die in Minecraft you lose experience (and some of that experience is dropped as experience orbs at the point of death) and you lose your entire personal inventory at that location too: all your armor, weapons, tools, and all the loot you’re carrying drop into a scattered pile (as seen in the screenshot below).
While some people enjoy the challenge of such an arrangement, there are plenty of times when it’s just downright annoying. If you die very far from home while exploring, for example, and you have no idea where you were when you died then your diamond armor and other hard earned loot is as good as gone.
Fortunately, it’s pretty easy to edit the in-game flag that specifies whether or not you keep your inventory upon death as well as several other very handy flags that change other game behaviors. Let’s take a look at how to keep our inventory and perform other useful edits now.
Changing Minecraft Game Rules
There are many commands you can execute in Minecraft via the in-game command console, but only around a dozen of them are persist changes to game variables. You can, for example, give yourself things in creative mode (or survival mode with the cheats turned on) using the /give command but doing so doesn’t alter the state of the game.
How To Use Commands
For truly game altering modifications we need to change the “game rules” variables with the /gamerules command. All game commands, including the /gamerules command are entered into Minecraft via the chat box (which functions as a command console when input is preceded by the “/” character).
Before we proceed it’s important to note that the /gamerule command and other powerful command options only work on servers if you are the administrator or one of the operators, and they only work on single player/open-to-LAN multiplayer games if you have enabled cheats either in the game creation menu when you first created your world or temporarily when via the open-to-LAN trick.
Open the chat box by pressing T (alternatively you can use the “/” key as a shortcut which will open the chat box and preseed it with the “/” character). The format for the /gamerules command is as follows.
/gamerules <rule> [value]
The <rule> is always single variable (no spaces in between multi-word rule names) and is always case sensitive. The [value] is always Boolean value of “true” or “false” to toggle the game rule on except in the case of a single game rule; the game rule “randomTickSpeed” which allows you to increase or decrease the number of random game clock ticks that cause plant growth and other changes by integer based adjustment (0 disables the random tick, any positive integer will increase it by X amount).
One of the most useful game rule tweaks you can make, by far, is to toggle the “keepInventory” rule. As we mentioned above (and as you’re well aware if you’ve taken the time to seek out this tutorial) when you die you drop all your items and loot around you, like so.
In the above screenshot you can see clearly that our quick access inventory bar is empty and all our loot is laying on the ground around us. That’s unfortunate (and if you die in a lava pit you’ll never get that loot back).
Let’s fix that now by editing the “keepInventory.” Pull up the chat window in your game and enter the following command (remembering that it is case sensitive).
/gamerule keepInventory true
Now look what happens when we die with the keepInventory flag set.
Look at that! We’re dead but we’re still holding our sword, the armor indicator above our toolbar indicates we’re still wearing our armor, and the toolbar itself is still loaded with our supplies. As an added bonus, above and beyond keeping our precious loot, you’ll also notice that there are no experience orbs floating around. When the keepInventory flag is on you don’t drop experience orbs either. (We wouldn’t mind a way to tweak this so you lost experience but not your loot, but as of now there isn’t a game rule for that).
Other Useful Game Rules
In addition to the very handy keepInventory game rule, there are fourteen other game rules you can easily edit in game. While some of the game rules are very specific to server administration (like the “commandBlockOutput” flag that specifies whether or not game administrators should be notified when command blocks perform game commands), many of them are very useful in local single player and simple local multiplayer games too.
You can read the full list of game rule commands in the Minecraft wiki, and you can also type /gamerules and hit the Tab key to list off all the available game rules as seen in the screenshot above. While we’re not going to list and explain all of them, here are our favorite useful-in-single-player commands.
Halt Fire Spread
We’ve all been there. You build your first house. You set up a working fireplace with lava or netherrack. You pat yourself on the back at a house well built and then the next thing you know, the roof is on fire. Unless carefully and properly contained fire in Minecraft will spread. Lava, netherrack, and lightning strikes can all start and spread fires, so if you don’t want to come back from your mine to find that your entire house has burned down this is a very handy command.
Disable the spread of fire with the following.
/gamerule doFireTick false
In addition to keeping lightning strikes and other natural fire sources from damaging things, it’s also very handy if you want to incorporate fire and lava into your designs without worrying about nearby flammable structures going up in smoke. With the fire spread disabled you can do improbable things like build a checkerboard made from wool and lava blocks as seen above.
Stop Mob Griefing
“Mob griefing” in Minecraft is the ability of game mobs to interact with in-game objects. Every time a zombie picks up an item and carries it, an enderman pulls a block from the surrounding landscape and zips off with it, or other any other mob interacts with an item or block, that’s a form of mob griefing.
If you would prefer that zombies can’t run off with your loot or enderman will never be able to pluck a block out a structure you carefully crafted in survival mode, you can turn off mob griefing with the following command.
/gamerule mobGriefing false
Be forewarned that turning off mob griefing disables all mob-on-block interactions including those that are benign or beneficial. For example, sheep will no longer destroy grass blocks while grazing (a relatively benign activity) and the villagers’ ability to replant crops (a beneficial activity) will vanish.
Enjoy Permanent Daylight
When you’re playing a survival game, the day/night cycle adds interest and challenge to the game. When you’re build, however, the constant cycling of day and night (and the difficulty of working in semi-darkness) can get real old. Thankfully, you can easily toggle the daylight cycle.
/gamerule doDaylightCycle false
It’s important to note that the above command doesn’t permanently set the game to daytime, it permanently sets the game to the time it is when you issue the command.
As such it’s useful not just for setting the game to be permanently fixed at bright noonday sun, but also to fix the game in permanent darkness if applied in the middle of the night. If you want a sort of six month Siberian darkness to fight off horde after horde of zombies you can lock the game at midnight until you tire of the adventure.
Craving more Minecraft articles? Check out our extensive collection of Minecraft tips, tricks, and guides. Have a Minecraft question or tutorial you’d like to see us write? Shoot us an email at email@example.com and we’ll do our best to help.