Commands/gamerule

Sets or queries a game rule value.

Syntax

 * Consle edidion 


 * Consle Edition
 * $$, gamerules can also be changed in the world options and every gamerule can be toggled on and only on with the command with cheats enabled. This only works in multiplayer, server gamerules and server settings can be adjusted using the client settings
 * $$, gamerules can also be changed in the world options and every gamerule can be toggled on and only on with the command with cheats enabled. This only works in multiplayer, server gamerules and server settings can be adjusted using the client settings
 * $$, gamerules can also be changed in the world options and every gamerule can be toggled on and only on with the command with cheats enabled. This only works in multiplayer, server gamerules and server settings can be adjusted using the client settings

Arguments
Arguments ⇭⇭⇭ are case sensitive. Arguments ⇭⇭⇭ are shown for tab autocompletion as lowercase, but when typed are case-insensitive.

(BE:  or  )
 * Specifies the game rule to set or query. Must be one of predefined game rules in the table below.

(BE:  or  ) (optional)
 * Specifies the value to set the game rule to. Only  or   specified for predefined game rules can affect gameplay, except in the case of ,  ,  , and   where any integer 0 or greater affects gameplay (see the table below).

Additional behavior
This section explains more complex behaviors of certain gamerules.
 * When true, the Bad Omen effect is not removed from a player when entering a village.
 * Stops a raid if set to true while a raid is in progress, but the existing raid mobs do not despawn.
 * When false, items cannot be removed from item frames.
 * Affects only natural mob spawning. Mobs from structures, spawners, and events still spawn when set to false.
 * When false, containers still drop their contents, but not themselves.
 * Shulker boxes do not drop anything, causing the items in them to be lost.
 * When false, destroying an armor stand does not drop it nor any armor it had equipped.
 * When false, item frames still drop themselves and their items.
 * When false, the player still loses air, but does not take damage when the air is depleted.
 * When false, the player may still be set on fire, but does not take damage when on fire.
 * When true, players also retain their experience upon death.
 * When true, health and hunger are still reset as normal upon death.
 * When false, prevents:
 * All mobs from:
 * Trampling crops.
 * Trampling turtle eggs.
 * Picking up items.
 * Blazes from creating fire or lighting campfires.
 * Creepers from destroying blocks when they explode, although they still damage entities.
 * End crystals from destroying blocks when they explode, although they still damage entities.
 * The ender dragon from destroying blocks, causing it to just fly through them instead.
 * Endermen from picking up or placing blocks.
 * Evoker from turning blue sheep red.
 * Foxes from picking sweet berries from a sweet berry bush.
 * Ghast fireballs from exploding blocks and creating fire. They still damage entities.
 * Piglins from attempting to barter.
 * Rabbits from eating carrot crops.
 * Ravagers from destroying crops and leaves.
 * Sheep from turning grass blocks into dirt, but does not prevent the regrowth of wool. They still act as if they are eating the grass and regrow their wool upon doing so, but the grass remains and the grass breaking sound does not play.
 * Silverfish from hiding in stone and destroying those blocks when hatching.
 * Snow golems from creating snow trails.
 * Villagers from farming and picking up items. However, they can still open doors and throw items.
 * The wither and its heads from destroying blocks with their explosions. Entities are still damaged, and a wither rose drops as an item.
 * Zombies from breaking doors and attacking turtle eggs.
 * Has no effect on the player.
 * Bees attack all nearby players when their beehive is broken, regardless of the setting of this gamerule.
 * Bees becoming angry when attacked works as expected.
 * Silverfish from hiding in stone and destroying those blocks when hatching.
 * Snow golems from creating snow trails.
 * Villagers from farming and picking up items. However, they can still open doors and throw items.
 * The wither and its heads from destroying blocks with their explosions. Entities are still damaged, and a wither rose drops as an item.
 * Zombies from breaking doors and attacking turtle eggs.
 * Has no effect on the player.
 * Bees attack all nearby players when their beehive is broken, regardless of the setting of this gamerule.
 * Bees becoming angry when attacked works as expected.
 * Bees becoming angry when attacked works as expected.

Result
Fails if the arguments are not specified correctly.

On success, returns the value of the game rule (if  is not provided) or sets the game rule to the specified value (if   is provided).

Examples

 * To stop the day-night cycle:
 * To stop natural healing:
 * To stop creepers, ghasts and other mobs from modifying blocks:
 * To stop the natural cycle of weather:
 * For the player, so that they can keep all of their valuables when they die:
 * To stop TNT from exploding:

History
Befehl/gamerule Comandos/gamerule Команды консоли/gamerule Команди консолі/gamerule 命令/gamerule