Game rules guide

keepInventory and other game rules without cheats

You can edit saved game rules without running a command, but the file location, rule name, and stored type depend on the Minecraft Java version. Choose the right file before changing keepInventory.

By ChunkweavePublished 2026-08-05Updated 6 min read

Editing a saved rule does not require running a command. You still need permission to manage the world files. On a hosted server, the owner or administrator must make the change while the server is stopped. This guide covers Java Edition; Bedrock has different storage and is not supported by this editor.

Where game rules are stored

Use the world layout that actually exists on disk. The legacy path below is not valid for every current version:

Java world layoutWhere to lookRule name
Before 1.21.11level.dat → Data → GameRuleskeepInventory
1.21.11level.dat → Data → game_rulesminecraft:keep_inventory
26.1 storage changedata/minecraft/game_rules.datSearch for minecraft:keep_inventory in the existing structure
Legacy NBT path (before 1.21.11)
Data/GameRules/keepInventory

Read the existing tag's type before editing. A String boolean uses the text true or false. A Byte boolean uses 1 or 0. Do not replace a String with a Byte or enter 1 into a String rule. The editor keeps the original type; a syntactically valid NBT value is not proof that Minecraft will interpret it as intended.

Legacy game-rule examples (before 1.21.11)

Legacy ruleMeaning of the valueEffect
keepInventorytrue enables; false disablesKeep items on death
doDaylightCycletrue advances; false pausesDay and night cycle
doWeatherCycletrue advances; false pausesWeather cycle
mobGriefingtrue allows; false preventsMob changes to the world
doMobSpawningtrue allows; false preventsNatural mob spawning
doFireTicktrue allows; false preventsLegacy fire spread
naturalRegenerationtrue enables; false disablesNatural health regeneration
randomTickSpeedA whole number, often stored as a String in legacy filesRandom block-update rate

The table describes rule meanings, not an instruction to change NBT types. Preserve the type found in the file. Several names also changed in 1.21.11: doDaylightCycle became minecraft:advance_time, and doFireTick was replaced rather than simply renamed.

Step by step with Chunkweave

  1. Back up the whole world folder and record its Minecraft version.
  2. Stop the game or server so it cannot overwrite your edit.
  3. Open level.dat or data/minecraft/game_rules.dat according to the version table.
  4. Find the existing keepInventory or minecraft:keep_inventory entry and inspect its type.
  5. For a String tag enter true; for a Byte boolean enter 1. Keep the tag type unchanged.
  6. Select Apply changes, then Download copy. Record the old value so you can undo the edit.
  7. Place the exported file at the same path in a backed-up test world, retaining the filename expected by Minecraft. Load it, verify the rule, and confirm it survives a save and restart before using it in the live world.
Inspect the existing rule

Change game rules in your browser

Open the file selected from the version table, inspect the original type, and export a separate copy.

Open the level.dat editor

Why not just use the gamerule command?

The gamerule command is the normal way to change rules, but it needs cheats in singleplayer or operator permission on a server. Editing level.dat changes the same saved values without any of that, which is why it is the standard answer for worlds where commands are locked.

Frequently asked questions

Does editing keepInventory in level.dat require cheats?

No. You are changing the saved world file directly, so it works on worlds with cheats disabled.

What type is keepInventory in level.dat?

Inspect the existing type. Legacy String boolean values use true or false; Byte booleans use 1 or 0. Java 1.21.11 also renamed the rule, and 26.1 moved rule storage into a separate file. Do not add an old-format rule to a newer world.

Will my game rule change survive a server restart?

It should persist if the correct file and rule were saved with the server stopped. Plugins, the wrong file path, or invalid serialization can undo or ignore it. Test a save and restart on a backup.

Which game rules can I set this way?

Rules actually stored by your Minecraft version. Older worlds use GameRules; current layouts can use namespaced names in a separate game_rules.dat file. Match the version rather than copying the legacy names from this article.

Ready when your file is

Inspect the structure before you change it.

Open a supported Minecraft Java Edition file, stage edits, and export a separate copy without sending world data to a server.

Open the NBT editor