/gamerule
Sets or queries a game rule. Game rules control various world behaviors like mob griefing, fire spread, keep inventory, and many more.
Syntax
/gamerule <rule> [<value>]Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| rule | game_rule | Required | The game rule to query or modify (e.g., keepInventory, mobGriefing, doDaylightCycle). |
| value | boolean|integer | Optional | The value to set. Boolean rules accept true/false. Integer rules accept a number. If omitted, the current value is displayed. |
Examples
/gamerule keepInventory truePlayers keep their inventory and XP when they die.
/gamerule doDaylightCycle falseStops the day-night cycle, freezing time at the current position.
/gamerule randomTickSpeed 10Increases the random tick speed to 10 (default 3), making crops grow faster.
Common Mistakes
- Using the wrong case, game rule names are camelCase (keepInventory, not keepinventory).
- Setting randomTickSpeed too high, values over 1000 can cause severe lag from rapid block updates.
Notes
There are many game rules in Java Edition. Common ones: keepInventory, mobGriefing, doDaylightCycle, doWeatherCycle, doFireTick, commandBlockOutput, sendCommandFeedback, doInsomnia, playersSleepingPercentage.
Related Commands
Need a Minecraft server?
Try these commands on Astroworld or host your own server.
Try Astroworld Hosting