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 toggle buttons on the "Edit Game Rules" menu built into the "Create World" screen. The game rules are split into categories named "Player", "Mobs", "Spawning", "Drops", "World updates", "Chat", and "Miscellaneous".
, about half of the game rules can be changed using toggles on the "World settings" and "Cheats" sections of the world's Game settings screen. The remainder can be changed only with commands.
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 and .
 List of game rules
Rule name	Description 	Default value	Type	Availability	Availability
Rule name	Description 	Default value	Type	Java 	Bedrock
 	Whether advancements should be announced in chat. 	 	Bool	 	
 	Whether block loot is dropped by all blocks () or randomly () depending on how far the block is from the center of a block explosion (e.g. clicking a bed in dimensions other than the Overworld). 	 	Bool	 	
 	Whether command blocks should be enabled in-game. 	 	Bool	 	
 	Whether command blocks should notify admins when they perform commands. 	 	Bool	 	
 	Controls the maximum number of blocks changed when using , , or . 	 	Int 	 	
 	Whether the server should skip checking player speed when the player is wearing elytra. Often helps with jittering due to lag in multiplayer. 	 	Bool	 	
 	Whether raids are disabled. 	 	Bool	 	
 	Whether the daylight cycle and moon phases progress. 	 	Bool	 	
 	Whether entities that are not mobs should have drops. 	 	Bool	 	
 	Whether fire should spread and naturally extinguish. 	 	Bool	 	
 	Whether phantoms can spawn in the nighttime. 	 	Bool	 	
 	Players respawn immediately without showing the death screen. 	 	Bool	 	
 	Whether players can craft only those recipes that they have unlocked. 	 	Bool	 	
 	Whether mobs should drop items and experience orbs. 	 	Bool	 	
 	Whether mobs should naturally spawn. Does not affect monster spawners. 	 	Bool	 	
 	Whether patrols can spawn. 	 	Bool	 	
 	Whether blocks should have drops. 	 	Bool	 	
 	Whether wandering traders can spawn. 	 	Bool	 	
 	Whether vines can spread to other blocks. Cave vines, weeping vines, and twisting vines are not affected. 	 	Bool	 	
 	Whether the weather can change naturally. The command can still change weather. 	 	Bool	 	
 	Whether wardens can spawn. 	 	Bool	 	
 	Whether the player should take damage when drowning. 	 	Bool	 	
 	Controls whether thrown ender pearls vanish when the player dies. 	 	Bool	 	
 	Whether the player should take fall damage. 	 	Bool	 	
 	Whether the player should take damage in fire, lava, campfires, or on magma blocks. 	 	Bool	 	
 	Makes angered neutral mobs stop being angry when the targeted player dies nearby. 	 	Bool	 	
 	Whether the player should take damage when inside powder snow. 	 	Bool	 	
 	Whether certain sound events are heard by all players regardless of location. 	 	Bool	 	
 	The maximum number of commands that can be executed by at once. 	 	Int 	 	
 	Whether the player should keep items and experience in their inventory after death. 	 	Bool	 	
 	Whether new sources of lava are allowed to form. 	 	Bool	 	
 	Whether to log admin commands to server log. 	 	Bool	 	
 	The maximum length of a chain of commands that can be executed during one tick. Applies to command blocks and functions. 	 	Int 	 	
 	The maximum number of pushable entities a mob or player can push, before taking entity cramming damage per half-second. Setting to 0 or lower disables the rule. Damage affects Survival-mode or Adventure-mode players, and all mobs but bats. Pushable entities include non-Spectator-mode players, any mob except bats, as well as boats and minecarts. 	 	Int 	 	
 	Whether block loot is dropped by all blocks () or randomly () depending on how far the block is from the center of a mob explosion (e.g. Creeper explosion). 	 	Bool	 	
 	Whether creepers, zombies, endermen, ghasts, withers, ender dragons, rabbits, sheep, villagers, silverfish, snow golems, and end crystals should be able to change blocks, and whether mobs can pick up items. When mobGriefing is disabled, piglins do not pick up gold ingots, but a player can still barter with them by the item on the mob. Similarly, villagers do not pick up food items but can still breed until they run out of any food already in their inventory. This also affects the capability of zombie-like creatures like zombified piglins and drowned to pathfind to turtle eggs.	 	Bool	 	
 	Whether the player can regenerate health naturally if their hunger is full enough (doesn't affect external healing, such as golden apples, the Regeneration effect, etc.). 	 	Bool	 	
 	What percentage of players in the Overworld must sleep to skip the night. A percentage value of 0 or less will allow the night to be skipped by just 1 player, and a percentage value more than 100 will prevent players from ever skipping the night. 	 	Int 	 	
 	Whether the player can fight with other players. 	 	Bool	 	
 	How often a random block tick occurs (such as plant growth, leaf decay, etc.) per chunk section per game tick. 0 and negative values disables random ticks, higher numbers increase random ticks. Setting to a high integer results in high speeds of decay and growth. Numbers over 4096 make plant growth or leaf decay instantaneous. 	 	Int 	 	
 	Controls whether the player needs to collect items to unlock recipes in the recipe book. 	 	Bool	 	
 	Whether the debug screen shows all or reduced information; and whether the effects of (entity hitboxes) and (chunk boundaries) are shown. 	 	Bool	 	
 	Prevents beds/respawn anchors from exploding in other dimensions. 	 	Bool	 	
 	Whether the feedback from commands executed by a player should show up in chat. Also affects the default behavior of whether command blocks store their output text. 	 	Bool	 	
 	Whether border blocks effects are shown. 	 	Bool	 	
 	Whether the player's coordinates are displayed. 	 	Bool	 	
 	Whether death messages are put into chat when a player dies. Also affects whether a message is sent to the pet's owner when the pet dies. 	 	Bool	 	
 	Hides the "Can place on" and "Can destroy" block lists from item lore, as well as item lock indicators. 	 	Bool	 	
 	The maximum number of snow layers that can be accumulated on each block. 	 	Int 	 	
 	The number of blocks outward from the world spawn coordinates that a player spawns in when first joining a server or when dying without a personal spawnpoint. Has no effect on servers where the default game mode is Adventure. 	 	Int 	 	
 	Whether players in Spectator mode can generate chunks. 	 	Bool	 	
 	Whether TNT explodes after activation. 	 	Bool	 	
 	Whether block loot is dropped by all blocks () or randomly () depending on how far the block is from the center of a TNT explosion. 	 	Bool	 	
 	Makes angered neutral mobs attack any nearby player, not just the player that angered them. Works best if is disabled. 	 	Bool	 	
 	Whether new sources of water are allowed to form. 	 	Bool	 	
==Additional behavior==
This section explains more complex behaviors of certain gamerules.
* 
** When , the Bad Omen effect is not removed from a player when entering a village.
** Stops a raid if set to while a raid is in progress, but the existing raid mobs do not despawn.
* 
** When , items cannot be removed from item frames.
* 
** Does not affect drops not related to a mob's death, such as chicken laying eggs, or sheep dropping wool when sheared.
** Does not affect the dropping of wither roses when mobs are killed by the wither.
* 
** Affects only natural mob spawning. Mobs from structures, monster spawners, and events still spawn when set to . 
* 
** When , containers still drop their contents, but not themselves.
*** Shulker boxes do not drop anything, causing the items in them to be lost.
** When , destroying an armor stand does not drop it nor any armor it had equipped.
** When , item frames still drop themselves and their items.
** When , infested blocks do not spawn silverfish when broken.
* 
** When , the player still loses air, but does not take damage when the air is depleted.
* 
** When , the player may still be set on fire, but does not take damage when on fire.
* 
** Every neutral mob that can be aggravated remain aggravated even after the offending player dies, with the exception of piglins when a player does not wear golden armor and iron golems when it is created from a village where the player is unpopular.
* 
** When , players also retain their experience upon death.
** When , health and hunger are still reset as normal upon death.
** When , all effects are still removed upon death.
** When , items enchanted with Curse of Vanishing do not disappear upon death.
* 
** When , prevents all mobs from modifying the environment in any way. This includes trampling crops and turtle eggs, picking up items, destroying blocks, or moving blocks. Specifically, it prevents:
*** Allays from picking up dropped 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 infested blocks 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 , at least one player is still required to sleep to skip the night.
** When set to a number greater than , night is not skipped no matter how many players are sleeping.
* 
** Does not affect:
*** Cauldrons filling with water or powder snow while raining or snowing.
**** Still affects filling of water and lava in cauldrons below pointed dripstone.
*** Death of coral blocks, coral, and coral fan.
*** Hatching of frogspawn and sniffer eggs.
* 
** When set to , snow layers do not form at all.
** When set to or higher, snow forms up to the level of a full block, but no greater than that.
* 
** Every neutral mob that can be aggravated targets all nearby players whenever they are aggravated.
** 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.
== History ==
==Gallery==
Game rules.png|All the gamerules in 1.17.
== References ==
ja:ゲームルール
pt:Regra de jogo
zh:游戏规则