Game rule

Game rules are a set of customizable options for a specific in-game world.

Modifying game rules
Game rules can be changed using the "Edit Game Rules" menu built into the "Create World" screen $$. This menu lists all available game rules along with toggle buttons next to them for enabling, disabling, or setting certain game rules. The menu lists game rules split into specific categories depending on the effects of those game rules; these categories are player, mobs, spawning, drops, world updates, chat, and miscellaneous.

When in-game, game rules can be changed using the command, using the syntax, where  is the name of the game rule and  is an allowed value, which depends on the type of the game rule. The types are boolean (where the allowed values are either ) and integer (where any whole number is able to be entered).

List of game rules
The following is a list of game rules available in-game, their allowed values, and their availability in, , or both.

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 by picking up dropped items; using the item on them still works.
 * 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.
 * When set to, night is skipped immediately without the falling asleep transition.
 * 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.
 * 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.
 * When set to, night is skipped immediately without the falling asleep transition.
 * 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 attack all nearby players when their beehive is broken, regardless of the setting of this gamerule.
 * Bees becoming angry when attacked works as expected.