Minecraft gamerules explained, with the commands

By Kosy · · 2 min read

Gamerules change how the world behaves while it runs. They are saved with the world and set with /gamerule. You need to be an operator, see how to op yourself.

/gamerule keepInventory true
/gamerule keepInventory

The first form changes it, the second shows the current value. Rule names are case-sensitive, and newer versions rename some of them, the game suggests the right names as you type.

The ones people change most

  • keepInventory: keep your items and experience when you die. A common setting for friendly servers.
  • mobGriefing: whether creepers, endermen and other mobs can change blocks. Turn it off to stop creepers wrecking builds, and note it also stops villagers farming and zombies breaking doors.
  • doDaylightCycle: the sun moves. Set to false to freeze the time, and use /time set day first.
  • doWeatherCycle: the weather changes. Set to false for permanent clear skies after /weather clear.
  • doMobSpawning: turn off for a peaceful lobby or a creative build world.
  • pvp is not a gamerule: it is the pvp setting in server.properties.
  • playersSleepingPercentage: how many players must sleep to skip the night. 0 or 1 lets one player skip it on a big server.
  • randomTickSpeed: how fast crops, leaves and fire update. The default is 3. Raising it grows farms faster but costs performance, see how to fix server lag.
  • doFireTick: whether fire spreads. Set to false to protect wooden builds.
  • announceAdvancements: stop the chat messages for advancements.
  • commandBlockOutput: hide command block messages from the chat.
  • spawnRadius: how far from the world spawn new players appear.
  • maxEntityCramming: how many mobs can be squashed into a block before they take damage. A trick to stop mob farms getting out of hand.

Per world and per server

Gamerules belong to a world. A server with several worlds, such as a hub and a survival world, needs the rule set in each, using a world-aware plugin or the console for each dimension. A plugin like Multiverse can set them per world.

Time in ticks

Gamerules and commands such as /time use ticks, 20 a second and 24000 a day. The ticks converter turns them into real time.

More to read