Updated:
The setup by version
| Setting | Java 1.21.11+ | Java 1.21.10 and earlier | Bedrock |
|---|---|---|---|
| Keep inventory | minecraft:keep_inventory true | keepInventory true | keepinventory true |
| Stop the day cycle | minecraft:advance_time false | doDaylightCycle false | dodaylightcycle false |
| Stop weather changes | minecraft:advance_weather false | doWeatherCycle false | doweathercycle false |
| No natural mob spawning | minecraft:spawn_mobs false | doMobSpawning false | domobspawning false |
Each goes after /gamerule. Java 1.21.11 renamed every game rule and only accepts the new names; see the gamerule list.
Copy-ready sets
# Java 1.21.11+
/gamerule minecraft:keep_inventory true
/gamerule minecraft:advance_time false
/time set day
/weather clear
/gamerule minecraft:advance_weather false
/gamerule minecraft:spawn_mobs false
# Java 1.21.10 and earlier
/gamerule keepInventory true
/gamerule doDaylightCycle false
/time set day
/weather clear
/gamerule doWeatherCycle false
/gamerule doMobSpawning false
# Bedrock
/gamerule keepinventory true
/gamerule dodaylightcycle false
/time set day
/weather clear
/gamerule doweathercycle false
/gamerule domobspawning false
Set the time and weather first, then freeze them. /weather clear alone lasts only a while. Bedrock can also lock daytime with /alwaysday true.
Optional rules for testing
| Goal | Java 1.21.11+ | Java 1.21.10 and earlier | Bedrock |
|---|---|---|---|
| Creepers and endermen do not break blocks | minecraft:mob_griefing false | mobGriefing false | mobgriefing false |
| No fall damage | minecraft:fall_damage false | fallDamage false | falldamage false |
| Respawn instantly | minecraft:immediate_respawn true | doImmediateRespawn true | doimmediaterespawn true |
| Quiet command blocks | minecraft:command_block_output false | commandBlockOutput false | commandblockoutput false |
These are handy while building and testing, but turn them back on before others play, since they change normal gameplay.
Java 26.1 time changes
Java 26.1 added /time pause and /time resume, and /time set day now moves forward to the next morning, which can add a day to the day count. The game rule method still works. Details in the time command guide.
When it does not work
- "Unknown game rule": the name does not match your version.
- Settings seem to reset on a server: game rules are saved per world; check you are looking at the right one.
- Mobs still appear: spawners and events are not affected by natural spawning rules.
Common questions
- Check a current value? Run the rule without a value, such as
/gamerule minecraft:keep_inventory. - Does keep inventory keep XP too? Yes, items and experience are both kept. See keep inventory.
- Weather options? See the weather guide.
Check your command
The Command Error Doctor checks common syntax mistakes in your browser.