Skip to content

Worlds and saves

Changing. Follow: #81, #139, #140, #141, #168, #175, #177, #178, #179, #291, #738, #910, #968

This page is for an admin who wants to point the mcrs server at a world. The server reads a Java Edition world of the same game version, and it saves the world and its players. Changed chunks go back to the region files of the folder, so a block edit survives a restart.

AreaStateWorksMissing
Saving and AnvilPartialReads an existing Java Edition world and writes changed chunks back to its region files. Autosave runs every 6000 ticks, and a clean shutdown saves the world and the players. A damaged region is copied aside before anything is written over it.Container contents changed in play and entities in chunks are not saved yet. A world of another data version does not load, and there are no datafixers. WIP#910

Give the server a folder as the first argument. The README Quick start shows how to build and start the server.

The server has no authentication and listens on all network interfaces. Keep it on your machine or a trusted local network; do not open its port to the internet.

Terminal window
cargo run --release -- "<path to a world folder>"

The folder must exist, or the server prints “not a world folder” and exits. When the folder holds a world, the server takes the seed and the list of dimensions from the world generation settings of the save, and a seed in MCRS_WORLD_SEED or a preset in MCRS_WORLD_PRESET does not override them. The game mode of a new player then comes from level.dat. If level.dat is missing and only its backup level.dat_old is left, the server opens the world from the backup. The chunks come from the region files of the save, which Java Edition stores in the Anvil format.

A folder with neither level.dat nor saved world generation settings, such as an empty one, becomes a new world. The server writes level.dat and the world generation settings into it from MCRS_WORLD_SEED, MCRS_WORLD_PRESET and MCRS_DEFAULT_GAMEMODE, so the next start opens the same world with the same seed.1

While the server runs, it holds a lock on session.lock in the world folder, as the game does. When another process holds that lock, the server writes nothing to the folder and does not start.1

level.dat, every chunk and every player file carry a DataVersion, the number of the game version that wrote them. The server accepts a file only when that number matches the game version of this build, which is 26.4-snapshot-7 with world version 5127, as version.json states. The server refuses a file from any other version with an error that names the version it found and the version it expected. It also refuses a level.dat or a chunk that has no DataVersion.

mcrs has no converter for saves of older versions and will not get one, because it follows one snapshot at a time and keeps no compatibility chain.2 If you have an older world, open it once in a vanilla client of the right snapshot so that the game rewrites it, and then give the folder to mcrs. A field that no type claims also fails the load, so the server does not keep such a field as raw bytes.2

Without a folder, the server generates a world

Section titled “Without a folder, the server generates a world”

When you start the server with no argument, it generates a world from a preset. Nothing of that world reaches the disk, and there is no autosave. It has no player files either, because the server builds the path of a player file from the world folder. Three settings shape the world, and the server reads them once at start. The full list of settings is in server_settings.rs.

Variable Meaning Default
MCRS_WORLD_SEED The seed, as a signed or unsigned 64-bit number 0
MCRS_WORLD_PRESET The name of a world preset in the loaded data pack, such as normal, minecraft:normal or flat normal
MCRS_DEFAULT_GAMEMODE Game mode of a new player creative

World generation matches vanilla in parity tests on the reference seeds. Parity says what those tests cover.

A player without a saved position is placed by the spawn rules. When the join needs a surface search in a generated world, it waits for heightmaps from every column in the search square before choosing the position.3

MCRS_SPAWN sets a join position as x,y,z in blocks. It overrides both the saved player position and the level spawn, and the player joins the first dimension of the level, normally the overworld, even if the player file names another dimension. The rotation still comes from the player file, or from the level spawn when the file has none. The player starts flying when the saved game mode permits flight, falling back to the default mode when the file has no game mode. An embedded server sets the same override through the spawn field of DimensionWorldsPlugin.4

Data State
Player files Saved. The server writes each player to players/data/<uuid>.dat in the world folder on disconnect, and an autosave writes them every 6000 ticks, which is vanilla’s own interval
A clean stop with players Works#624. On the first SIGINT or SIGTERM the server disconnects every player with the vanilla shutdown reason, saves them and exits. A second signal exits at once
Chunks and block edits Saved. The server writes each changed chunk back to its region file in the world folder, and an autosave does this every 6000 ticks
A clean stop with the world On the first SIGINT or SIGTERM the server also saves every loaded chunk and the world state files before it exits. If a save fails, the exit status shows an error
World state files The server reads the spawn, the weather, the game rules, the world clocks and the world generation settings of the save at start, and writes them back on the autosave
Unreadable regions The server copies a chunk it cannot decode, or a region with a damaged slot, to <save>/quarantine/ before it replaces it. A file that cannot be read stays as it is on the disk

The server protects a player file that it cannot parse. The player joins empty, and the server never saves that player over the old file. From a file it can parse, the server reads the inventory, the ender chest, the selected hotbar slot, the equipment and the attributes of the player, and it writes them back on save.5 A key of the format that mcrs has no behavior for yet goes back to the file unchanged.6

Player health is also restored on join and written back on save. A new player without a file starts at maximum health.7

A short test checks the clean stop.

A shutdown request writes the player file
let player_file = player_dat_path(&world, offline_player_uuid("mcrs_test"));
assert!(!player_file.exists(), "saved before the shutdown");
requested.store(true, Ordering::Relaxed);
exited
.recv_timeout(Duration::from_secs(30))
.expect("the server exits by itself after the request");
server_thread.join().unwrap();
assert!(player_file.exists(), "{} is missing", player_file.display());

tests/it/shutdown.rs:77-86

For local pack setup, precedence, validation, terrain previews and reload limits, see Add and check data packs.

  1. Works#969 Makes a new world in a folder without level.dat and locks the world folder. ↩ ↩2

  2. Not planned#388 The decision that saves are read at exactly the targeted data version, with no datafixers. ↩ ↩2

  3. Works#1106 Places new joins on a surface after the search columns have heightmaps. ↩

  4. Works#1089 Adds extra local packs and a join position through server settings. ↩

  5. Partial#521 Tracks the specification and the plugin of the player inventory. ↩

  6. Works#744 Gives the player file a complete codec and saves the components that plugins register. ↩

  7. Works#1082 Gives players health, death and respawn, with persisted health. ↩

Sources and verification

Verified: 26.4-snapshot-7, 1cf84286c, 2026-11-30

Related open issues:

  • #81 WIP Keep structure state that is lost on reload
  • #139 WIP Place entities from jigsaw templates
  • #140 WIP Features and template modifiers that still place nothing
  • #141 WIP Parity coverage for carvers, biomes and Nether and End terrain
  • #168 WIP Region files read from a save are released
  • #175 WIP Find the world spawn as vanilla does
  • #177 WIP Grass under carved overhangs matches vanilla
  • #178 WIP Melt icebergs in warm biomes
  • #179 WIP Post-processing marks and face updates from features
  • #291 WIP Read, query and edit a saved world without the engine
  • #738 WIP Typed save layouts for block entities and nested entities
  • #910 WIP Save block entities from live state and entities in their chunks
  • #968 WIP Stop a dedicated server on a held world folder before it binds