Commands/infobox
Sets or queries a game rule value.
- Syntax
- Java Edition
gamerule <rule name> [value]
- Pocket Edition
gamerule <rule: string> <value: bool>gamerule <rule: string> <value: int>gamerule [rule: string]
- Arguments
- rule name (PE: rule: string)
- Specifies the game rule to set or query. May be any value, but only certain predefined game rules will affect gameplay (see Predefined Game Rules below).
- value (PE: value: bool or value: int) (optional)
- Specifies the value to set the game rule to. May be any value, though only
trueorfalsespecified for predefined game rules will really affect gameplay, except in the case ofmaxEntityCramming,randomTickSpeedandspawnRadius, where any integer 0 or greater will affect gameplay (see Predefined Game Rules below).
- Specifies the value to set the game rule to. May be any value, though only
Predefined Game Rules Rule Name Description Default Value Java Edition Pocket Edition announceAdvancementsWhether advancements should be announced in chat trueYes No commandBlockOutput
(PE:commandblockoutput)Whether command blocks should notify admins when they perform commands trueYes Yes disableElytraMovementCheckWhether the server should skip checking player speed when the player is wearing elytra. Often helps with jittering due to lag in multiplayer, but may also be used to travel unfairly long distances in survival mode (cheating). falseYes No doDaylightCycle
(PE:dodaylightcycle)Whether the day-night cycle and moon phases progress trueYes Yes doEntityDrops
(PE:doentitydrops)Whether entities that are not mobs should have drops trueYes Yes doFireTick
(PE:dofiretick)Whether fire should spread and naturally extinguish trueYes Yes doLimitedCraftingWhether players should only be able to craft recipes that they've unlocked first falseYes No doMobLoot
(PE:domobloot)Whether mobs should drop items trueYes Yes doMobSpawning
(PE:domobspawning)Whether mobs should naturally spawn. Does not affect monster spawners. trueYes Yes doTileDrops
(PE:dotiledrops)Whether blocks should have drops trueYes Yes doWeatherCycle
(PE:doweathercycle)Whether the weather will change trueYes Yes drowningdamageWhether the player should take damage when drowning trueNo Yes falldamageWhether the player should take fall damage trueNo Yes firedamageWhether the player should take fire damage trueNo Yes gameLoopFunctionThe function to run every game tick -Yes No keepInventory
(PE:keepinventory)Whether the player should keep items in their inventory after death falseYes Yes logAdminCommandsWhether to log admin commands to server log trueYes No maxCommandChainLengthDetermines the number at which the chain command block acts as a "chain". 65536Yes No maxEntityCrammingThe maximum number of other pushable entities a mob or player can push, before taking 3 
suffocation damage per half-second. Setting to 0 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.
24Yes No mobGriefing
(PE:mobgriefing)Whether creepers, zombies, endermen, ghasts, withers, ender dragons, rabbits, sheep, and villagers should be able to change blocks and whether villagers, zombies, skeletons, and zombie pigmen can pick up items trueYes Yes naturalRegenerationWhether 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.) trueYes No pvpWhether the player can fight with other player trueNo Yes randomTickSpeedHow often a random block tick occurs (such as plant growth, leaf decay, etc.) per chunk section per game tick. 0 will disable random ticks, higher numbers will increase random ticks. Setting to a high integer results in high speeds of decay and growth 3Yes No reducedDebugInfoWhether the debug screen shows all or reduced information; and whether the effects of F3 + B (entity hitboxes) and F3 + G (chunk boundaries) are shown. falseYes No sendCommandFeedbac`k
(PE:sendcommandfeedback)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 trueYes Yes showDeathMessagesWhether 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. trueYes No spawnRadiusThe number of blocks outward from the world spawn coordinates that a player will spawn in when first joining a server or when dying without a spawnpoint. 10Yes No spectatorsGenerateChunksWhether players in spectator mode can generate chunks trueYes No
- Result
- Fails if rule name is not defined and value is not provided (i.e., attempting to query an undefined game rule).
- On success, returns the value of the game rule (if value is not provided) or sets the game rule to the specified value (if value is provided).
- New game rules may be defined and set (by providing a value) or queried (by not providing a value).
- Examples
- To stop the day-night cycle:
gamerule doDaylightCycle false
- To stop natural healing:
gamerule naturalRegeneration false
- To define a new game rule called
myNewRuleand sets its value to 10:gamerule myNewRule 10 - 1.3.1 (Pocket Edition)
- To show your position: /gamerule showcoordinates true
- Hide postion: /gamerule showcoordinates false