OGTOOLS

Minecraft /gamerule command

Turns world rules on or off, such as dropping items on death, mob spawning or the daylight cycle.

🌍 World and time Operator (level 2) Needs cheats enabled Java Edition 26.3

Syntax

/gamerule <rule>
/gamerule <rule> <value>

Parts in square brackets are optional, parts in angle brackets are required. You do not type the brackets: Put your own value in their place.

Arguments

ArgumentWhat it does
<rule> Rule names such as keep_inventory, advance_time, mob_griefing and fire_spread_radius_around_player; they can also be written with the minecraft: prefix.
<value> true/false or a number. Leave it out and the current value is printed.

Examples

/gamerule keep_inventory true

You do not lose your items when you die; it is the most used rule.

/gamerule advance_time false

Freezes time so it always stays the same hour.

/gamerule mob_griefing false

Creeper explosions and endermen moving blocks do not wreck the world.

/gamerule fire_spread_radius_around_player 0

Turns off fire spread (formerly doFireTick false).

/gamerule random_tick_speed 3

Sets how fast crops grow; 3 is the default value.

Good to know

  • Rule names changed in 1.21.11: keepInventory is now keep_inventory, doDaylightCycle is now advance_time and doMobSpawning is now spawn_mobs. The old spelling gives an error; old worlds are converted automatically when opened.
  • doFireTick was removed and fire_spread_radius_around_player replaced it (0 turns it off, -1 spreads everywhere).
  • Rules are saved with the world and stay even when the server shuts down.

How do I run this command?

Press T in game to open chat (or press / directly), type the command and press Enter. While typing, Tab completes the options. This command counts as a cheat: It needs cheats enabled in a singleplayer world, and operator permission on a server (operator (level 2)).

Related commands

🌍 More World and time

Another tool Minecraft crafting recipes Would rather make the item than give it with a command? See the recipe on the 3x3 grid.

Minecraft is a product of Mojang Studios. This tool is an independent helper made for players and is not affiliated with Mojang or Microsoft.