How to Use the Gamerule Command – Wiki Guide
This Minecraft tutorial explains how to use the /gamerule command with screenshots and step-by-step instructions.
You can either set or check the value of a game rule using the /gamerule command in Minecraft. Let’s explore how to use this cheat (game command).
Requirements
To run game commands in Minecraft, you have to turn cheats on in your world.
Gamerule Command
Gamerule Command in Minecraft Java Edition (PC/Mac)
In Minecraft Java Edition (PC/Mac), the gamerule command has different syntaxes depending on whether you want to set or check the gamerule.
To set the value of a gamerule:
/gamerule <rule> <value>
To check the value of a gamerule:
/gamerule <rule>
Definitions
- rule is the name of the game rule that you would like to set or view. See list of choices below.
- value is the value to assign to a rule name. See possible values below.
Rule Description Possible Values Default Value announceAdvancements Whether advancements are announced true or false true blockExplosionDropDecay If true, blocks drop randomly depending on how far from the explosion center. If false, all blocks drop loot (available starting in 1.19.3) true or false true commandBlockOutput Whether command blocks notify admins when commands are executed true or false true commandModificationBlockLimit Maximum number of blocks modified by command (available starting in 1.19.4) <number> 32768 disableElytraMovementCheck Disables the check in a server whether a player is moving too fast true or false false disableRaids Disables Raids (available starting in 1.14.3) true or false false doDaylightCycle Whether time advances in the day/night cycle. If set to false, time will stop at the current moment. true or false true doEntityDrops Whether entities should have drops true or false true doFireTick Whether fire should naturally spread and then extinguish true or false true doImmediateRespawn Whether player immediately respawns without seeing the respawn menu (the respawn menu displays the message that you died with the options to respawn or go to the main menu) (available starting in 1.15) true or false false doInsomnia Whether phantoms will spawn at night if a player hasn’t slept (available starting in 1.15) true or false true doLimitedCrafting Limit crafting to recipes that are unlocked true or false false doMobLoot Whether mobs should have drops true or false true doMobSpawning Whether mobs should spawn naturally true or false true doPatrolSpawning Whether patrols should spawn (available starting in 1.15.2) true or false true doTileDrops Whether blocks should have drops true or false true doTraderSpawning Whether wandering traders should spawn (available starting in 1.15.2) true or false true doVinesSpread Whether vines should spread (available starting in 1.19.4) true or false true doWardenSpawning Whether the Warden should spawn naturally (available starting in 1.19) true or false true doWeatherCycle Whether weather changes. If set to false, weather will stop at current cycle. true or false true drowningDamage Whether drowning causes damage (available starting in 1.15) true or false true fallDamage Whether falls cause damage (available starting in 1.15) true or false true fireDamage Whether fire causes damage (available starting in 1.15) true or false true forgiveDeadPlayers Whether angered Neutral mobs will stop being angry when the targeted player dies (available starting in 1.16) true or false true freezeDamage Whether the player being in powder snow causes damage (available starting in 1.17) true or false true globalSoundEvents Whether certain gameplay movements are heard by all players regardless of location (available starting in 1.19.3) true or false true keepInventory Whether players keep their inventory after dying true or false false lavaSourceConversion Whether new sources of lava are allowed to form (available starting in 1.19.3) true or false true logAdminCommands Whether admin commands are added to the server log true or false true maxCommandChainLength Maximum length of command chain <number> 65536 maxEntityCramming Maximum number of entities that can be crammed <number> 24 mobExplosionDropDecay If true, mobs drop loot randomly depending on how far from the explosion center. If false, all mobs drop loot (available starting in 1.19.3) true or false true mobGriefing Whether mobs can pick up items or change blocks true or false true naturalRegeneration Whether players can regenerate health naturally through their hunger bar true or false true playersSleepingPercentage Percentage of players that must sleep in order to skip the Night (available starting in 1.17) <number> 100 randomTickSpeed Sets the speed of how fast things grow or decay (such as the growth of a sapling into a tree).
0 disables the random tick. The higher the value, the faster the random tick.<number> 3 reducedDebugInfo Whether debug screen hides some information true or false false sendCommandFeedback Whether feedback from player commands appears in the chat true or false true showDeathMessages Whether a message appears in the chat when a player dies true or false true snowAccumulationHeight When it is snowing, determines the maximum number of layers that can be accumulated in each block. If set to 0, no snow will form. If set to 8 or higher, the snow will accumulate up to a level that is the full height of a block (available starting in 1.19.3) <number> 1 spawnRadius Controls how far from the world spawn point you can spawn <number> 10 spectatorsGenerateChunks Whether spectators can generate chunks in the game true or false true tntExplosionDropDecay If true, loot drops randomly depending on how far from the explosion center. If false, all loot is dropped (available starting in 1.19.3) true or false true universalAnger Whether angered Neutral mobs will attack any nearby players (and not just the player that angered them) (available starting in 1.16) true or false true waterSourceConversion Whether new sources of water are allowed to form (available starting in 1.19.3) true or false true
Examples
Example in Java Edition (PC/Mac)
To set the doDayLightCycle gamerule to false and stop time in Minecraft Java Edition (PC/Mac):
/gamerule doDaylightCycle false
To check the value of the KeepInventory gamerule:
/gamerule KeepInventory
How to Enter the Command
1. Open the Chat Window
The easiest way to run a command in Minecraft is within the chat window. The game control to open the chat window depends on the version of Minecraft:
- For Java Edition (PC/Mac), press the T key to open the chat window.
- For Pocket Edition (PE), tap on the chat button at the top of the screen.
- For Xbox One, press the D-Pad (right) on the controller.
- For PS4, press the D-Pad (right) on the controller.
- For Nintendo Switch, press the right arrow button on the controller.
- For Windows 10 Edition, press the T key to open the chat window.
- For Education Edition, press the T key to open the chat window.
2. Type the Command
We will cover examples of how to use the /gamerule command to set a gamerule as well as how to see what the current setting is for a gamerule.
Set the Value of a Gamerule
In the first example, we will show you how to use the /gamerule command to stop time from advancing by setting the doDaylightCycle gamerule to false.
To set the doDayLightCycle gamerule to false and stop time, you would need to type the following command:
/gamerule doDaylightCycle false
Type the command in the chat window. As you are typing, you will see the command appear in the lower left corner of the game window. Press the Enter key to run the command.
This gamerule command would stop time at the current moment. Time would no longer advance. Since we are in daytime, it would remain daytime forever. You can run this command at any time of the day and it will stop time at that moment.
You will see the message “Game rule has been updated” appear in the lower left corner of the game window to indicate that the gamerule command has completed.
Check the Value of a Gamerule
In this next example, we will show you how to check the value of a gamerule for your world.
In this example, we want to see what our KeepInventory gamerule is currently set to. This is the gamerule that allows you to keep your inventory after dying.
To check the value of the KeepInventory gamerule, you would need to type the following command:
/gamerule KeepInventory
Type the command in the chat window and press the Enter key to run the command.
This command would display what the KeepInventory gamerule is currently set to. The value returned is either true or false.
In this example, you will see the message “KeepInventory = false” appear in the lower left corner of the game window. Since the KeepInventory gamerule is set to false, you lose all of your inventory when you die. You can use the gamerule command to set KeepInventory to true to retain your inventory after dying.
Congratulations, you have learned how to use the /gamerule command in Minecraft.