If /gamerule keepInventory true stopped working for you, you are not doing anything wrong: the rule was renamed. Java Edition 1.21.11 moved every gamerule into a registry with snake_case names, so keepInventory became keep_inventory, doDaylightCycle became advance_time, and a few rules disappeared or were replaced. Most guides online still show the old names.
This page lists the current names for the rules people actually use, what each does, its default, and which ones are worth changing on a server or a world with friends.
Quick answers
- Keep inventory:
/gamerule keep_inventory true
- Stop the day/night cycle:
/gamerule advance_time false
- One player sleeps for everyone:
/gamerule players_sleeping_percentage 0
- Stop creepers blowing up blocks:
/gamerule mob_griefing false (this also stops other mobs changing blocks, see below)
- Check a rule's current value: leave the value off, for example
/gamerule keep_inventory
How the command works
/gamerule <rule> [<value>]
Rules are true/false switches or whole numbers. Names are resource locations, so the full form is minecraft:keep_inventory; the minecraft: part can be left out. You need operator permission (or cheats enabled in single player) to change them. Our guide to ops and permissions covers giving someone that access on a server.
Old name to new name
| Old name (before 1.21.11) |
New name |
keepInventory |
keep_inventory |
doDaylightCycle |
advance_time |
doWeatherCycle |
advance_weather |
doMobSpawning |
spawn_mobs |
doMobLoot |
mob_drops |
mobGriefing |
mob_griefing |
doInsomnia |
spawn_phantoms |
spawnRadius |
respawn_radius |
announceAdvancements |
show_advancement_messages |
naturalRegeneration |
natural_health_regeneration |
doImmediateRespawn |
immediate_respawn |
doFireTick |
removed, use fire_spread_radius_around_player |
The rules worth knowing
| Rule |
Default |
What it does |
keep_inventory |
false |
Keep your items and XP when you die |
mob_griefing |
true |
Lets mobs change blocks and pick up items |
advance_time |
true |
Day/night cycle and moon phases move on |
advance_weather |
true |
Weather changes by itself (/weather still works) |
players_sleeping_percentage |
100 |
Share of players in the Overworld who must sleep to skip the night |
spawn_phantoms |
true |
Phantoms appear when you skip sleep |
spawn_mobs |
true |
Natural mob spawning (spawners, structures and raids still spawn) |
mob_drops |
true |
Mobs drop items and XP |
fall_damage |
true |
Players take fall damage |
natural_health_regeneration |
true |
Health regenerates from a full hunger bar |
immediate_respawn |
false |
Skip the death screen |
random_tick_speed |
3 |
Speed of crop growth, leaf decay and other random ticks |
fire_spread_radius_around_player |
128 |
How far from players fire can spread; 0 turns spread off, -1 removes the limit |
tnt_explodes |
true |
TNT explodes when lit |
pvp |
true |
Players can hurt each other |
max_entity_cramming |
24 |
Mobs packed into one space before they take damage; 0 turns it off |
respawn_radius |
10 |
How far from world spawn new and respawning players can appear |
show_advancement_messages |
true |
Advancements are announced in chat |
command_block_output |
true |
Command blocks report what they run to operators |
reduced_debug_info |
false |
Hides coordinates and most of the F3 screen |
locator_bar |
true |
Shows the locator bar for other players |
ender_pearls_vanish_on_death |
true |
Thrown pearls disappear when you die |
allow_entering_nether_using_portals |
true |
Nether portals work |
What to change on a friends' world
players_sleeping_percentage 0 or 50. With 0, one person in bed skips the night for everyone. Every server with more than two players ends up wanting this.
keep_inventory true if dying and losing everything ruins the fun for your group. Many survival purists leave it off; it is a matter of taste.
mob_griefing false stops creeper holes in your base, but read the warning below first.
spawn_phantoms false if you keep forgetting to sleep and the phantoms annoy you.
The mob_griefing trap
Turning off mob_griefing does more than stop creeper damage. It also stops villagers farming crops, sheep eating grass (so they never regrow wool), endermen picking up blocks and snow golems leaving trails, and it affects mobs picking up items. Several farms rely on those behaviours, so check before you flip it on a world with automation. Our villager trades guide and wool farm guide both depend on it staying on.
Rules for testing and building
advance_time false plus /time set day: permanent daylight for building.
advance_weather false plus /weather clear: no more rain interrupting screenshots.
spawn_mobs false: a peaceful-feeling world without switching difficulty, while spawners and raids still work.
random_tick_speed: raising it makes crops and saplings grow faster for testing. Very high values make the game stutter and grow things far faster than anything you will see in survival, so put it back to 3 when you are done.
What about Bedrock?
Bedrock Edition has its own list and did not get the Java rename. It still uses its own names, and it has a few rules Java does not, such as showcoordinates for the coordinates display.
Frequently asked questions
Why does /gamerule keepInventory not work anymore?
Java Edition 1.21.11 renamed all gamerules to snake_case. The rule is now keep_inventory, so the command is /gamerule keep_inventory true.
How do you make one player skip the night in Minecraft?
Set /gamerule players_sleeping_percentage 0. Then a single player sleeping in a bed is enough to skip the night for the whole server.
What replaced doFireTick?
The rule fire_spread_radius_around_player. Set it to 0 to stop fire spreading, or -1 to let fire spread with no limit. The default is 128 blocks around players.
Does mob_griefing false stop creeper damage?
Yes, creepers no longer destroy blocks. It also stops villagers from farming, sheep from eating grass and endermen from moving blocks, which can break farms.
How do I see the current value of a gamerule?
Type the command without a value, for example /gamerule keep_inventory, and the game replies with the current setting.
Comments
Loading...