Offer Why us? How it works?
Guide

Minecraft Gamerules: Keep Inventory and the Full List

Gamerules are world settings you change with the /gamerule command: keep your items after death, stop the day-night cycle, turn off creeper damage or let one sleeping player skip the night. Since Java 1.21.11 most of them have new names, so commands copied from older tutorials often fail. Here is the keep inventory command for every version, the full list with default values and how to set gamerules on your server.

Updated: 7 min read
Table of contents
  1. What is the keep inventory command?
  2. What are gamerules in Minecraft?
  3. Why did the gamerule names change in 1.21.11?
  4. How do you use the /gamerule command?
  5. Full list of Minecraft gamerules
  6. How do you set gamerules on a Minecraft server?
  7. Why isn't keep inventory working on my server?
  8. What gamerules should you set for a friends' server?
  9. FAQ
  10. How do you turn on keep inventory in Minecraft?
  11. Do gamerules apply to the whole server?
  12. Do I need to restart the server after changing a gamerule?
  13. Can I set gamerules in server.properties?
  14. What is the gamerule for one player sleeping?
  15. Do gamerules work on Bedrock servers?

What is the keep inventory command?

On Minecraft Java 1.21.11 and newer (including 26.x) type /gamerule keep_inventory true; on 1.21.10 and older type /gamerule keepInventory true. From then on players keep their items and experience when they die. To turn it off again, use false instead of true.

Your Minecraft version Command
1.21.11, 26.1, 26.2, 26.3 and newer /gamerule keep_inventory true
1.21.10 and older (1.20.1, 1.21.1, 1.12.2…) /gamerule keepInventory true
Bedrock Edition /gamerule keepinventory true

You need operator permissions to run it in chat. In a server console, type the same command without the leading /.

What are gamerules in Minecraft?

Gamerules are on/off switches and numbers saved in the world itself that change how the game behaves – death, mobs, time, weather, fire, damage and more. They live in the world's level.dat, so they stay set after a restart and travel with the world when you move it to another server.

Gamerules are not the same as server.properties: the properties file configures the server (players, port, difficulty, view distance), while gamerules configure the world. Since Java 1.21.9, PvP, monster spawning and command blocks moved from server.properties to gamerules (pvp, spawn_monsters, command_blocks_work), which is why pvp=false in the file no longer does anything on new versions. The file itself is explained in Minecraft server.properties.

Why did the gamerule names change in 1.21.11?

In Java 1.21.11 (December 2025) Mojang renamed almost every gamerule from camelCase to snake_case identifiers, and several were renamed completely – for example doDaylightCycle became advance_time. Existing worlds are converted automatically, but commands and datapacks have to use the new names.

A few changes worth knowing:

  • Simple renames: keepInventory → keep_inventory, mobGriefing → mob_griefing, fallDamage → fall_damage.
  • New wording: doDaylightCycle → advance_time, doMobSpawning → spawn_mobs, doInsomnia → spawn_phantoms, doTileDrops → block_drops, naturalRegeneration → natural_health_regeneration.
  • Reversed meaning: disableRaids true became raids false; the same goes for the elytra and player movement checks.
  • Fire: doFireTick was replaced with fire_spread_radius_around_player – a number of blocks; 0 stops fire from spreading.

The names are identifiers, so /gamerule minecraft:keep_inventory true works too – the minecraft: prefix is optional. Type /gamerule and press Tab to see every rule your version knows.

How do you use the /gamerule command?

/gamerule <rule> <value> sets a rule, and /gamerule <rule> without a value shows its current value. Boolean rules take true or false, number rules take a whole number.

gamerule keep_inventory true
gamerule players_sleeping_percentage 1
gamerule keep_inventory

The first line turns keep inventory on, the second lets a single sleeping player skip the night, and the third only prints the current value. The change takes effect immediately – no restart needed.

Full list of Minecraft gamerules

These are the gamerules of Minecraft Java 26.3 with their old names (up to 1.21.10) and default values. The most useful ones for a survival server are at the top.

Gamerule (1.21.11+) Old name (≤ 1.21.10) Default What it does
keep_inventory keepInventory false Keep items and XP after death
players_sleeping_percentage playersSleepingPercentage 100 % of online players who must sleep to skip the night
mob_griefing mobGriefing true Creepers, Endermen, ghasts etc. can break or move blocks
pvp pvp true Players can damage each other (gamerule since 1.21.9)
advance_time doDaylightCycle true Day and night cycle
advance_weather doWeatherCycle true Weather changes
spawn_mobs doMobSpawning true Natural mob spawning
spawn_monsters spawnMonsters true Hostile mob spawning (since 1.21.9)
spawn_phantoms doInsomnia true Phantoms for players who don't sleep
spawn_patrols doPatrolSpawning true Pillager patrols
spawn_wandering_traders doTraderSpawning true Wandering traders
spawn_wardens doWardenSpawning true Wardens in the Deep Dark
raids disableRaids (reversed) true Raids from Bad Omen
immediate_respawn doImmediateRespawn false Respawn without the death screen
show_death_messages showDeathMessages true Death messages in chat
show_advancement_messages announceAdvancements true Advancement messages in chat
natural_health_regeneration naturalRegeneration true Health regenerates when you're fed
fall_damage fallDamage true Fall damage
fire_damage fireDamage true Fire and lava damage
drowning_damage drowningDamage true Drowning damage
freeze_damage freezeDamage true Powder snow freezing damage
fire_spread_radius_around_player doFireTick – How far from players fire can spread; 0 = no spreading
tnt_explodes tntExplodes true TNT can be lit and explode
block_drops doTileDrops true Broken blocks drop items
mob_drops doMobLoot true Mobs drop loot and XP
entity_drops doEntityDrops true Minecarts, item frames etc. drop as items
random_tick_speed randomTickSpeed 3 Speed of crop growth, leaf decay and other random ticks
respawn_radius spawnRadius 10 Radius around world spawn where new players appear
max_entity_cramming maxEntityCramming 24 Mobs in one block before they start taking damage
locator_bar locatorBar true The player locator bar on screen
send_command_feedback sendCommandFeedback true Command results shown in chat
log_admin_commands logAdminCommands true Operators' commands shown to other operators and in the log
command_blocks_work commandBlocksEnabled (1.21.9–1.21.10) true Command blocks run (until 1.21.8: enable-command-block in server.properties)
spawner_blocks_work spawnerBlocksEnabled true Monster spawners work
universal_anger universalAnger false Angered neutral mobs attack every nearby player
forgive_dead_players forgiveDeadPlayers true Neutral mobs calm down when their target dies
spectators_generate_chunks spectatorsGenerateChunks true Spectators load new terrain
reduced_debug_info reducedDebugInfo false Hides coordinates and details on the F3 screen

Mods can add their own gamerules; they appear in the Tab list of /gamerule once the mod is installed.

How do you set gamerules on a Minecraft server?

Type the command in the server console without the /, or in game chat with / as an operator. On Spot.gg:

  1. Open the server panel and go to the "Console" tab. The server has to be running.
  2. Type, for example, gamerule keep_inventory true (no slash) and press Enter.
  3. Check the console output – the server confirms the new value.
  4. Done. The rule is saved in the world and stays after a restart.

To do it from inside the game, you need OP: run op YourName in the console first. How OP and permissions work is covered in Minecraft server commands.

Why isn't keep inventory working on my server?

Usually it's the old name on a new version, a separate world on Paper, or a mod that handles death drops itself. Check these in order:

Symptom Cause Fix
"Unknown or incomplete command" / incorrect argument Old name (keepInventory) on 1.21.11+ or new name on an older version Use the name for your version (table above)
Works in the Overworld but not in the Nether or End On Paper and Purpur the Nether and End are separate worlds (world_nether, world_the_end) with their own gamerules Run the command as an OP while standing in that dimension
Items still drop on a modded server A grave or corpse mod (or a modpack config) handles death Check the mod's config in the "Files" tab
The value resets The world was replaced (new seed, restored backup, new world name) Set the rule again on the new world

What gamerules should you set for a friends' server?

A popular relaxed setup: keep inventory on, one sleeping player skips the night, creepers don't destroy builds.

gamerule keep_inventory true
gamerule players_sleeping_percentage 1
gamerule mob_griefing false

Keep in mind that mob_griefing false also stops villagers from farming and sheep from eating grass, and some farms rely on it. For a building server you might also stop time and weather with advance_time false and advance_weather false. On older versions use the old names from the table.

FAQ

How do you turn on keep inventory in Minecraft?

Run /gamerule keep_inventory true (1.21.11 and newer) or /gamerule keepInventory true (1.21.10 and older). In singleplayer you need cheats enabled; on a server you need OP or the server console.

Do gamerules apply to the whole server?

To the world, which on Vanilla and mod loaders means the whole server, including the Nether and End. On Paper and Purpur each dimension is its own world, so some rules need to be set separately there.

Do I need to restart the server after changing a gamerule?

No. Gamerules take effect immediately and are saved automatically with the world.

Can I set gamerules in server.properties?

No. server.properties has no gamerules. You set them with /gamerule, and they're stored in the world's level.dat. Since 1.21.9 this also applies to PvP, which used to be a property.

What is the gamerule for one player sleeping?

/gamerule players_sleeping_percentage 1 (old name playersSleepingPercentage). Any value from 1 lets a single sleeping player skip the night on a small server; 0 has the same effect.

Do gamerules work on Bedrock servers?

Yes, but Bedrock uses its own lowercase names, for example keepinventory and dodaylightcycle. Bedrock servers are covered in how to make a Minecraft Bedrock server.

Other guides