Skip to content

World management ​

Started 2026-11-21. This plan is a working document: tick slices off, and add or reshape them as the work teaches us things. ADR 0029 records the model.

Goal ​

An owner creates, attaches, detaches and lists worlds while the server runs, and players move between them the way they move between dimensions today. A world is a level. The server owns each level's lifecycle, and commands, scripts and addons go through one API to reach it. The Multiverse addon then becomes a thin layer of commands and per-world rules over that API.

What done looks like:

  • Every level has a UUID in its save, and every custom dimension a UUID mapped to a Bedrock dimension number that the save keeps and never gives to another dimension.
  • worlds in the config lists the levels the owner declares. A level created at runtime is recorded in levels.json, which the server owns, never in the config. Detached levels may share a name; attached ones may not.
  • A level is detached, attaching, attached or detaching, and the kernel announces each change. Detaching a level moves its players out, stops its scripts, saves it and keeps its files.
  • /world list | create | attach | detach | tp manages levels, and @jsprismarine/server exposes the same operations to scripts.
  • Moving a player to another level gives the client that level's game rules, clock, weather and custom dimensions, and the player's record follows the level's, or the group's, player data.
  • No code reaches for "the default world" when it means the world of the player, command or block in hand.

Out of scope for now:

  • Deleting a level's files. Detaching keeps them; deleting can come as its own command later.
  • Linking portals between levels, as Multiverse-NetherPortals does.
  • Levels in more than one process.

Where WorldManager is today ​

packages/prismarine/src/world/WorldManager.ts, as of 72c76180eec:

  • loadLevel(worldData, folderName) takes a config entry, and prepareLevel writes a normalized entry back into the config. A level has no existence apart from its entry.
  • A level's identity is its config key, matched case-insensitively by getLevel and exactly by levelOf and getWorldByDimension. Script slots, closeLevel and every caller key on it.
  • Fourteen files call getDefaultWorld() or getDefaultLevel(), and levelOf(undefined) means the default level. #3641 was one such default in setScriptCommands.
  • prepareLevel checks isWorldLoaded before an await and registers the level after it, so two loads of one name can both pass. unloadWorld closes a level with its players in it. No event says a level came or went, and the scripts module reads getLevels() once at startup, so a level that debug loadWorld loads later runs no scripts.
  • It also holds the provider registry, the generator factories, the Java worldgen registries and presets, and dimension-name resolution.
  • Custom dimensions get their Bedrock numbers in stem order from 1000, so removing or reordering a dimension in the config files another dimension's chunks under its number.
  • PlayerSession.changeWorld moves a player to another level's world as if it were a dimension, without the level's game rules, clock, weather or custom dimensions.

Slices ​

Decided along the way ​

  • Every pack gets the whole of levels, as it gets the whole of permissions. Packs have no permission model of their own: the owner installs an addon and trusts it with the server.
  • The registry is levels.json, beside addons.json in the server directory.
  • A level name is unique among attached levels only. Detached levels may share a name with each other and with an attached one, and are told apart by UUID.
  • A shared player-data group chooses every part of the record it shares, the position included.