Short answer: it’s all in level.dat

Game mode (Survival/Creative/Adventure/Spectator), difficulty (Peaceful/Easy/Normal/Hard), and game rules — these are “world-level settings” that apply to the entire world, all stored in the level.dat file at the root of the world save. They aren’t scattered across individual chunks or separate config files; they’re recorded together in this single metadata file.

Note that level.dat uses the NBT (Named Binary Tag) format, not plain text — opening it directly in Notepad just shows gibberish, and you need a tool that can parse NBT to read it. To first understand what this file actually contains, see What is the level.dat file and What is the NBT format.

What game rules (gamerules) actually are

“Game rules” are a set of switches and values that control world behavior. Common ones include:

  • keepInventory — whether you keep your inventory after death.
  • doDaylightCycle — whether the day-night cycle advances over time.
  • doMobSpawning — whether mobs spawn.
  • mobGriefing, doFireTick, and so on.

These game rules, along with game mode and difficulty, are all written into level.dat as world-level metadata and apply uniformly across the whole map. When you change them in-game via the settings screen or commands like /gamerule and /difficulty, Minecraft writes the new values back to level.dat — and that step is done by the game itself.

How TopoBlocks uses this metadata

When you use TopoBlocks to open or diagnose a world, it reads this metadata from level.dat (version, game mode, difficulty, world name, etc.) to identify world information and check whether the file structure is healthy. This diagnosis runs locally by default, is free, and does not upload your world to the cloud.

It only reads — it doesn’t change your in-game settings for you. If you want to switch game mode or difficulty, the most direct way is still to change it in Minecraft. And even when it later performs structural repair (for example, when a world fails to import because the packaging hierarchy is wrong), TopoBlocks creates a new file and never overwrites your original world, keeping a traceable original version every time. To find out where world saves normally live on your device, see Where are Minecraft saves.