Skip to content
MC Command Generator

/gamerule Command Generator

Beta

Pick the game rules you want to change and set them; the preview shows your world settings with the changed rules highlighted. Only rules that exist in the version you pick are offered, under the name that version uses.

Describe it — AI writes the command

Type what you want in plain words. The AI fills the form below, so you can see it and change anything. It follows the edition and version you picked.

Checking the AI…

Paste a command— edit it here or move it to another version
Game rules58 in Java 26.3
Edit Game Rules
Player
Keep inventory
keep_inventory
ON
Natural regeneration
natural_health_regeneration
ON
Immediate respawn
immediate_respawn
OFF
Fall damage
fall_damage
ON
Fire damage
fire_damage
ON
Mobs and spawning
Phantoms (insomnia)
spawn_phantoms
OFF
World updates
Daylight cycle
advance_time
OFF
World settings after the commands: 3 rules changed from the default (highlighted).

Your command · Java 26.3

89 characters
/gamerule keep_inventory true
/gamerule advance_time false
/gamerule spawn_phantoms false
  • One line per rule: run them all (a function file or a chain of command blocks does it in one go).

Raw editor

How it works

Each rule is one command: the rule name, then true/false or a number. The catch is the name, which changed over the years:

Java 1.21.11 and later (26.x too)

gamerule keep_inventory true
gamerule advance_time false
gamerule spawn_phantoms false

Java 1.21.11 renamed every rule to lowercase with underscores, and several got new names: doDaylightCycle is now advance_time, doMobSpawning is spawn_mobs, doInsomnia is spawn_phantoms. Three were flipped: disableRaids true became raids false, and the same goes for the elytra and player movement checks. doFireTick was replaced by fire_spread_radius_around_player (0 stops fire spreading).

Java 1.21.10 and older

gamerule keepInventory true
gamerule doDaylightCycle false
gamerule doInsomnia false

The 1.21.9 – 1.21.11 row writes the new names, because 1.21.11 is the newest release in it. On 1.21.9 or 1.21.10, pick the 1.21.6 – 1.21.8 row instead. Rules newer than your version are left out with a note — doInsomnia needs 1.15, playersSleepingPercentage 1.17, pvp 1.21.9.

Bedrock

gamerule keepinventory true
gamerule dodaylightcycle false
gamerule showcoordinates true

Bedrock names are all lowercase and some rules exist only there, like showcoordinates, showdaysplayed and respawnblocksexplode. Java-only rules such as raids, patrols or wandering traders are left out with a note. Bedrock’s random tick speed defaults to 1, Java’s to 3.

FAQ

How do I turn on keep inventory?

Java 1.21.11 and later: gamerule keep_inventory true. Older Java: gamerule keepInventory true. Bedrock: gamerule keepinventory true.

Why does gamerule keepInventory say unknown game rule?

Java 1.21.11 renamed all game rules to snake_case. Use keep_inventory on 1.21.11 and later (26.x included); keepInventory still works on 1.21.10 and older.

How do I stop the day-night cycle?

Java 1.21.11+: gamerule advance_time false. Older Java: gamerule doDaylightCycle false. Bedrock: gamerule dodaylightcycle false. Then set the time with /time set day.

How do I stop creepers blowing up blocks?

Set mob griefing to false: gamerule mob_griefing false (Java 1.21.11+), mobGriefing (older Java) or mobgriefing (Bedrock). It also stops endermen picking up blocks and villagers farming.

How do I skip the night with one player sleeping?

Set players sleeping percentage to 0 or a low number: gamerule players_sleeping_percentage 0 on Java 1.21.11+, playersSleepingPercentage on Java 1.17 – 1.21.10, playerssleepingpercentage on Bedrock 1.20.30+.