Choose a command Available editors: 23 / 23

Choose a command or select its information icon to see how it works.

Players and items

World and building

Display and game systems

/gamerule

Editor available

What does it do?

Minecraft has game rules that control how the world behaves. For example, you can keep items after death or change other gameplay mechanics.

When is it useful?

Useful when setting custom rules for a world, map, or server.

Example

/gamerule keep_inventory true

What will happen?

In Java 1.21.11 and newer, keeping inventory after death is enabled.

Good to know

Since Java 1.21.11 the rule is keep_inventory. Older Java versions use keepInventory.

Minecraft Java · 1.16+

/gamerule

Configure world rules: inventory, sleep, mob spawning and random ticks.

Total visits 30My visits 0

Rule settings

Generated command

What happens in-game

Examples
How to keep items after death

Select your server version. Find Keep inventory and XP, choose Change value and Enable. The command and its effect appear on the right. To check the world’s setting first, choose Read current value.

Why Minecraft rejects the rule ID

Older versions use keepInventory; Java 1.21.11 and later use minecraft:keep_inventory. Select the game version before copying. Console and command-block output omit the leading slash.

How to keep a map clear and sunny

Set daytime and clear the weather first. Then disable the day/night and weather cycles. Turning off the cycles first preserves the time and weather already in effect.

  1. /time set day
  2. /weather clear
  3. /gamerule minecraft:advance_time false
  4. /gamerule minecraft:advance_weather false
The last two lines are for Java 1.21.11+. Generate them for your selected version on older servers.
FAQ Frequently asked questions 30 questions
Survival and respawn 5
How do I keep items after death?

Enable Keep inventory and XP and run the generated command. It applies to future deaths.

Will the rule restore items I already lost?

It changes future deaths. Previously dropped items must be recovered separately.

How do I skip the death screen?

Enable Immediate respawn to respawn automatically.

How do I disable fall damage?

Disable Fall damage. Lava and drowning have separate rules.

Can I disable PvP?

Disable the PvP rule in Java 1.21.9+. On older dedicated servers, check pvp in server.properties.

Time, weather and growth 5
How do I keep it daytime?

Run /time set day and disable the day and night cycle. Turning off the cycle alone freezes the current time.

How do I stop rain returning?

Run /weather clear, then disable the weather cycle.

How can one player skip the night?

In Java 1.17+, set the sleeping percentage to 0.

Why did wheat stop growing?

Check random tick speed. Zero stops natural growth for crops that depend on random ticks.

Does randomTickSpeed speed up the whole server?

It changes how often blocks receive random updates. The server tick rate is separate.

Mobs and villages 5
How do I stop mob spawning?

Disable natural spawning. Existing mobs remain, and spawners are controlled separately.

How do I stop only phantoms?

Disable Phantom spawning. Other mobs use their own spawning rules.

How do I stop creepers breaking blocks?

Disable mob interaction with blocks. This also affects endermen, villagers, and other mob mechanics.

Can I prevent village raids?

Disable Raids. For older versions, the editor emits disableRaids true.

Why do mobs drop no loot?

Check Mob loot. Block drops are controlled separately.

Fire, explosions and chat 4
How do I stop fire spread?

Before 1.21.11 disable Fire spread. From 1.21.11 set the fire spread radius to 0.

How can TNT leave more item drops?

Check TNT explosion drop decay. False disables this decay for TNT explosions.

How do I hide death messages?

Disable Death messages. Advancement announcements have their own switch.

How do I hide command feedback?

Use Command feedback for player-facing command responses, or Command block output for operator notifications from blocks.

Server settings 3
Why are coordinates missing from F3?

Check Reduced F3 information. An operator controls this on a server.

Why does fill say there are too many blocks?

Adjust the block modification limit in versions that provide it. Larger operations can increase server load.

Why did a command block stop working?

Check command-block access, redstone, and whether the chunk is loaded. The enable setting depends on server version.

Commands and versions 4
How do I read the current rule value?

Choose Read current value and run the command in your world. Minecraft reports the value.

Why is keepInventory red in chat?

Java 1.21.11 switched rules to namespaced IDs. Select your version to generate minecraft:keep_inventory.

How do I enter a rule missing from the list?

Choose Enter ID manually. Check the name and type against Minecraft autocomplete for your version.

Do I need a slash in the console?

Use a slash in chat. Console, command block and .mcfunction output omit it.

Permissions and undo 4
Do I need operator permissions?

Minecraft Java requires command access and sufficient permissions. A server administrator grants them.

Does clicking Copy change the rule?

Copy places the text on your clipboard. Run it in-game or on the server to change the rule.

Does this work in Bedrock?

This editor targets Java. Bedrock has a different set of rules and IDs.

How do I restore the previous value?

Read and save the current value first. To undo the change, run the same rule command with that value.

Minecraft Wiki reference

Reviews for this page

No published reviews yet.

All WopBlockStudio reviews

Rate this tool

Did this tool work for you? Tell us what went well or what could improve.

Sign in to leave a review
Rating from 1 to 5