/gamerule
Game rules control world-wide behavior: keepInventory on death, mob spawning, daylight cycle, command output, fall damage, etc. Without a value, /gamerule queries the current setting.
What is /gamerule used for?
What /gamerule is for
Sets or queries world-wide rules that change core behavior — things like keepInventory, mob griefing, daylight cycle, fire spread, and command output.
When to use /gamerule
Tailor a world to how you want to play: keep your items on death, stop creepers wrecking builds, lock the time or weather, or quiet down command-block spam.
Most-used gamerules
keepInventory true (no item loss on death), doDaylightCycle false (lock time), mobGriefing false (protect builds), and doMobSpawning false (stop new mobs).
Syntax
Parameters
- rule
- literal
- e.g. keepInventory, doDaylightCycle, mobGriefing.
- valueoptional
- boolean | integer
- New value. Omit to query.
Command builder
Configure the options below to generate a ready-to-paste /gamerule command.
Examples
Keep items on death.
Freeze the sun.
Stop creepers/endermen from breaking blocks.
Speed up plant growth, ore aging, etc.
Common questions
How do I keep my items when I die in Minecraft?
Run /gamerule keepInventory true. You'll keep your full inventory and XP on death until you turn it back off.
How do I stop creepers from destroying blocks?
Set /gamerule mobGriefing false. This also stops endermen picking up blocks and other mob-driven block changes.
Permission level
/gamerule requires Cheats (op level 2). In single-player you need the world's "Allow Cheats" toggle on. On a multiplayer server you need to be opped — see /op.