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: Difference between revisions

From SAS Gaming Wiki
SyncBot (talk | contribs)
Remove broken links to missing pages
SyncBot (talk | contribs)
Fix template calls: add MC/ prefix
 
Line 17: Line 17:
: <code>gamerule <rule: BoolGameRule> [value: Boolean]</code>
: <code>gamerule <rule: BoolGameRule> [value: Boolean]</code>
: <code>gamerule <rule: IntGameRule> [value: int]</code><!--
: <code>gamerule <rule: IntGameRule> [value: int]</code><!--
: {{IN|bedrock}}, gamerules can also be changed in the world options and certain gamerules can be toggled on and off with the command without cheats enabled. This only works in singleplayer, server gamerules and server settings cannot be adjusted using the client settings, even if a player is opped.-->
: {{MC/In|bedrock}}, gamerules can also be changed in the world options and certain gamerules can be toggled on and off with the command without cheats enabled. This only works in singleplayer, server gamerules and server settings cannot be adjusted using the client settings, even if a player is opped.-->


==Arguments==
==Arguments==


Arguments {{in|java}} are case sensitive. Arguments {{in|bedrock}} are shown for tab autocompletion as lowercase, but when typed are case-insensitive.  
Arguments {{MC/In|java}} are case sensitive. Arguments {{MC/In|bedrock}} are shown for tab autocompletion as lowercase, but when typed are case-insensitive.  


{{el|je|short=1}}: {{argument|''rule name''}}<br>
{{MC/El|je|short=1}}: {{MC/Argument|''rule name''}}<br>
{{el|be|short=1}}: {{argument|be=1|rule: BoolGameRule|enum}} and {{argument|be=1|rule: IntGameRule|enum}}
{{MC/El|be|short=1}}: {{MC/Argument|be=1|rule: BoolGameRule|enum}} and {{MC/Argument|be=1|rule: IntGameRule|enum}}
: Specifies the game rule to set or query.
: Specifies the game rule to set or query.
: Must be one of the predefined game rules; see Game rule.
: Must be one of the predefined game rules; see Game rule.


{{el|je|short=1}}: {{argument|value}}<br>
{{MC/El|je|short=1}}: {{MC/Argument|value}}<br>
{{el|be|short=1}}: {{argument|be=1|value: Boolean|enum}} and {{argument|be=1|value: int|int}}
{{MC/El|be|short=1}}: {{MC/Argument|be=1|value: Boolean|enum}} and {{MC/Argument|be=1|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.
: Specifies the value to set the game rule to. If not specified, queries the value of the game rule instead of setting it.
: Only <code>true</code> or <code>false</code> specified for predefined game rules can affect gameplay, except in the case of <code>maxEntityCramming</code>, <code>randomTickSpeed</code>, <code>spawnRadius</code>, <code>playersSleepingPercentage</code>, <code>functionCommandLimit</code> and <code>maxCommandChainLength</code> where any integer (-2147483648~2147483647) affects gameplay; see Game rule.
: Only <code>true</code> or <code>false</code> specified for predefined game rules can affect gameplay, except in the case of <code>maxEntityCramming</code>, <code>randomTickSpeed</code>, <code>spawnRadius</code>, <code>playersSleepingPercentage</code>, <code>functionCommandLimit</code> and <code>maxCommandChainLength</code> where any integer (-2147483648~2147483647) affects gameplay; see Game rule.
Line 42: Line 42:
== Output ==
== Output ==


{{Output table}}
{{MC/Output table}}
{{Output table|edition=je|On success|1|1|the current value of the game rule}}
{{MC/Output table|edition=je|On success|1|1|the current value of the game rule}}
{{Output table|edition=be|On success|1}}
{{MC/Output table|edition=be|On success|1}}
{{Output table}}
{{MC/Output table}}


==Examples==
==Examples==
Line 61: Line 61:
=== ''Java Edition'' ===
=== ''Java Edition'' ===
{{HistoryTable
{{HistoryTable
|{{HistoryLine|java}}
|{{MC/HistoryLine|java}}
|{{HistoryLine||1.4.2|dev=12w32a|Added {{cmd|gamerule|link=none}}.}}
|{{HistoryLine||1.4.2|dev=12w32a|Added {{MC/Cmd|gamerule|link=none}}.}}
|{{HistoryLine||1.8|dev=14w29a|Added the ability to create custom dummy gamerules.}}
|{{MC/HistoryLine||1.8|dev=14w29a|Added the ability to create custom dummy gamerules.}}
|{{HistoryLine||1.13|dev=17w45a|{{cmd|gamerule|link=none}} no longer accepts unknown values (dummy gamerules).
|{{HistoryLine||1.13|dev=17w45a|{{MC/Cmd|gamerule|link=none}} no longer accepts unknown values (dummy gamerules).
|Values to {{cmd|gamerule|link=none}} are now type-checked.}}
|Values to {{MC/Cmd|gamerule|link=none}} are now type-checked.}}
}}
}}


=== ''Bedrock Edition'' ===
=== ''Bedrock Edition'' ===
{{HistoryTable
{{HistoryTable
|{{HistoryLine|pocket}}
|{{MC/HistoryLine|pocket}}
|{{HistoryLine||1.0.5|dev=alpha 1.0.5.0|Added {{cmd|gamerule|link=none}}.}}
|{{HistoryLine||1.0.5|dev=alpha 1.0.5.0|Added {{MC/Cmd|gamerule|link=none}}.}}
|{{HistoryLine|bedrock}}
|{{MC/HistoryLine|bedrock}}
|{{HistoryLine||?|Command segments <code>rule: BoolGameRule</code> or <code>rule: IntGameRule</code> no longer accept dummy gamerules.}}
|{{MC/HistoryLine||?|Command segments <code>rule: BoolGameRule</code> or <code>rule: IntGameRule</code> no longer accept dummy gamerules.}}
}}
}}


==See also==
==See also==
* {{cmd|mobevent}} – a command {{in|bedrock}} for controlling the spawning of raids, patrols, and wandering traders
* {{MC/Cmd|mobevent}} – a command {{MC/In|bedrock}} for controlling the spawning of raids, patrols, and wandering traders


== External links ==
== External links ==
Line 84: Line 84:


== Navigation ==
== Navigation ==
{{Navbox commands}}
{{MC/Navbox commands}}


de:Befehl/gamerule
de:Befehl/gamerule

Latest revision as of 20:10, 9 April 2026

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