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 nameSee possible values below.
    Rule Description
    announceAdvancements Whether advancements are announced
    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)
    commandBlockOutput Whether command blocks notify admins when commands are executed
    commandModificationBlockLimit Maximum number of blocks modified by command (available starting in 1.19.4)
    disableElytraMovementCheck Disables the check in a server whether a player is moving too fast
    disableRaids Disables Raids (available starting in 1.14.3)
    doDaylightCycle Whether time advances in the day/night cycle. If set to false, time will stop at the current moment.
    doEntityDrops Whether entities should have drops
    doFireTick Whether fire should naturally spread and then extinguish
    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)
    doInsomnia Whether phantoms will spawn at night if a player hasn’t slept (available starting in 1.15)
    doLimitedCrafting Limit crafting to recipes that are unlocked
    doMobLoot Whether mobs should have drops
    doMobSpawning Whether mobs should spawn naturally
    doPatrolSpawning Whether patrols should spawn (available starting in 1.15.2)
    doTileDrops Whether blocks should have drops
    doTraderSpawning Whether wandering traders should spawn (available starting in 1.15.2)
    doVinesSpread Whether vines should spread (available starting in 1.19.4)
    doWardenSpawning Whether the Warden should spawn naturally (available starting in 1.19)
    doWeatherCycle Whether weather changes. If set to false, weather will stop at current cycle.
    drowningDamage Whether drowning causes damage (available starting in 1.15)
    fallDamage Whether falls cause damage (available starting in 1.15)
    fireDamage Whether fire causes damage (available starting in 1.15)
    forgiveDeadPlayers Whether angered Neutral mobs will stop being angry when the targeted player dies (available starting in 1.16)
    freezeDamage Whether the player being in powder snow causes damage (available starting in 1.17)
    globalSoundEvents Whether certain gameplay movements are heard by all players regardless of location (available starting in 1.19.3)
    keepInventory Whether players keep their inventory after dying
    lavaSourceConversion Whether new sources of lava are allowed to form (available starting in 1.19.3)
    logAdminCommands Whether admin commands are added to the server log
    maxCommandChainLength Maximum length of command chain
    maxEntityCramming Maximum number of entities that can be crammed
    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)
    mobGriefing Whether mobs can pick up items or change blocks
    naturalRegeneration Whether players can regenerate health naturally through their hunger bar
    playersSleepingPercentage Percentage of players that must sleep in order to skip the Night (available starting in 1.17)
    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.
    reducedDebugInfo Whether debug screen hides some information
    sendCommandFeedback Whether feedback from player commands appears in the chat
    showDeathMessages Whether a message appears in the chat when a player dies
    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)
    spawnRadius Controls how far from the world spawn point you can spawn
    spectatorsGenerateChunks Whether spectators can generate chunks in the game
    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)
    universalAnger Whether angered Neutral mobs will attack any nearby players (and not just the player that angered them(available starting in 1.16)
    waterSourceConversion Whether new sources of water are allowed to form (available starting in 1.19.3)

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.

Click to rate this post!
[Total: 2 Average: 5]