Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Commands/gamerule

From SAS Gaming Wiki
Revision as of 20:10, 9 April 2026 by SyncBot (talk | contribs) (Fix template calls: add MC/ prefix)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:Infobox command

Sets or queries a game rule value.

Syntax

  • Java Edition
gamerule <rule name> [<value>]
  • Bedrock Edition
gamerule <rule: BoolGameRule> [value: Boolean]
gamerule <rule: IntGameRule> [value: int]

Arguments

Arguments in Template:Editions are case sensitive. Arguments in Template:Editions are shown for tab autocompletion as lowercase, but when typed are case-insensitive.

  1. REDIRECT Template:Edition

Template:Rcat: <rule name>

  1. REDIRECT Template:Edition

Template:Rcat: rule: BoolGameRule: enum and rule: IntGameRule: enum

Specifies the game rule to set or query.
Must be one of the predefined game rules; see Game rule.
  1. REDIRECT Template:Edition

Template:Rcat: <value>

  1. REDIRECT Template:Edition

Template:Rcat: value: Boolean: enum and value: int: int

Specifies the value to set the game rule to. If not specified, queries the value of the game rule instead of setting it.
Only true or false specified for predefined game rules can affect gameplay, except in the case of maxEntityCramming, randomTickSpeed, spawnRadius, playersSleepingPercentage, functionCommandLimit and maxCommandChainLength where any integer (-2147483648~2147483647) affects gameplay; see Game rule.

Result

Template:Result table Template:Result table Template:Result table Template:Result table

Output

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|1}}{{#vardefine:output3-{{#var:output-table-lines}}|the current value of the game rule}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|je}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|be}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}}

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}

Examples

  • To stop the day-night cycle: gamerule advance_time false
  • To stop natural healing: gamerule natural_health_regeneration false
  • To stop creepers, ghasts and other Minecraft:mobs from modifying blocks: gamerule mob_griefing false
  • To stop the natural cycle of weather: gamerule advance_weather false
  • To make players keep all of their valuables when they die: gamerule keep_inventory true
  • To stop Minecraft:TNT from exploding: gamerule tnt_explodes false
  • To stop command blocks from showing what they do: gamerule command_block_output false
  • To stop phantoms spawning:gamerule spawn_phantoms false

History

Java Edition

Template:HistoryTable

Bedrock Edition

Template:HistoryTable

See also

  1. REDIRECT Template:Command

Template:Redr – a command in Template:Editions for controlling the spawning of raids, patrols, and wandering traders

External links

Navigation

All editions
Removed
Template:El only
Debug
Removed
Template:Els only
Template:El only
Removed
Template:El only
Removed
Template:Els only
Removed
Joke
Related

de:Befehl/gamerule es:Comandos/gamerule ja:コマンド/gamerule ko:명령어/gamerule pl:Polecenia/gamerule pt:Comandos/gamerule ru:Команды консоли/gamerule uk:Команди консолі/gamerule zh:命令/gamerule