/

/gamerule

op 2World

/gamerule changes a world-level switch. Running it with no value reports the current setting instead of changing it. Rule names are case-sensitive, and in 1.21.9 every one of them was renamed from camelCase to snake_case — keepInventory became keep_inventory — so a command copied from an older guide will be rejected.

Command1 to fix
9
/gamerule
  • Game rule is required.
Press C to copy

Game rule is required.

optional

Leave empty to read the current value

Examples

  • Stop mob griefing
    /gamerule mobGriefing false
  • Keep inventory on death
    /gamerule keepInventory true

Common questions about /gamerule

How do I keep my items when I die?

On 1.21.9 and later, /gamerule keep_inventory true. Before that it was /gamerule keepInventory true. Either way it applies to every player in the world and takes effect on the next death.

Why does keepInventory say "Unknown game rule"?

Game rules were renamed in 1.21.9 from camelCase to snake_case: keepInventory became keep_inventory, doDaylightCycle became advance_time, doWeatherCycle became advance_weather. The names are case-sensitive either way, so the old spelling is simply not recognised on newer versions.