Skip to content

API reference / @jsprismarine/prismarine / world/Level

world/Level ​

Classes ​

Interfaces ​

LevelOptions ​

Defined in: prismarine/src/world/Level.ts:81

How a Level is built.

Properties ​

chunkHost? ​

readonly optional chunkHost?: "process" | "in-process"

Defined in: prismarine/src/world/Level.ts:115

Where chunk generation workers run, forwarded to generator factories.

chunkWorkers? ​

readonly optional chunkWorkers?: number

Defined in: prismarine/src/world/Level.ts:113

The chunk worker limit from server configuration, forwarded to generator factories.

config? ​

readonly optional config?: Partial<WorldData>

Defined in: prismarine/src/world/Level.ts:119

The worlds.<name> entry as configured, which a provider may read when generating.

dimensionTypes ​

readonly dimensionTypes: ReadonlyMap<string, DimensionTypeDefinition>

Defined in: prismarine/src/world/Level.ts:102

The Java dimension_type definitions the stems may name, keyed by type id. The level resolves each one a stem uses into a DimensionType, handing out Bedrock ids from FIRST_CUSTOM_DIMENSION_ID to the types the overlay does not list.

factories ​

readonly factories: GeneratorFactories

Defined in: prismarine/src/world/Level.ts:106

The generator kinds this server can build a stem with.

handlers? ​

readonly optional handlers?: WorldHandlersFactory

Defined in: prismarine/src/world/Level.ts:121

The handlers each world runs; see WorldHandlersFactory.

load? ​

readonly optional load?: ReadonlyMap<string, DimensionLoad>

Defined in: prismarine/src/world/Level.ts:104

When each stem's world is built, by dimension id. A stem left out is lazy.

name ​

readonly name: string

Defined in: prismarine/src/world/Level.ts:83

The folder name under worlds/, which is also the worlds.<name> key.

onWorldBuilt? ​

readonly optional onWorldBuilt?: (world) => void

Defined in: prismarine/src/world/Level.ts:127

Called with each world the level builds, before the world is enabled. Where the owner registers the world and attaches what the world must not build itself, such as its change sink.

Parameters ​
world ​

World

Returns ​

void

path ​

readonly path: string

Defined in: prismarine/src/world/Level.ts:85

The level folder, where the legacy level.json and the fallback player records live.

provider ​

readonly provider: BaseProvider

Defined in: prismarine/src/world/Level.ts:89

The one provider for every dimension of this save. The level opens and closes it.

seed ​

readonly seed: bigint

Defined in: prismarine/src/world/Level.ts:91

The world seed, as a 64-bit value. See import('../utils/Seed').worldSeedOf.

server ​

readonly server: Server

Defined in: prismarine/src/world/Level.ts:87

The server the level belongs to. The level reads its content and logger and hands it to each world it builds.

stems ​

readonly stems: ReadonlyMap<string, LevelStem>

Defined in: prismarine/src/world/Level.ts:96

The resolved level stems, keyed by dimension id such as minecraft:the_nether, in the order a custom type gets its Bedrock id. Has to carry minecraft:overworld.

terrainCache? ​

readonly optional terrainCache?: TerrainCacheSettings

Defined in: prismarine/src/world/Level.ts:117

The terrain tile cache from server configuration, forwarded to generator factories.

worldgen? ​

readonly optional worldgen?: () => JavaWorldgenRegistries

Defined in: prismarine/src/world/Level.ts:111

Java's world generation registries, read when a stem's factory asks for them. Defaults to the Java data cache on disk, which a flat or void level never touches.

Returns ​

JavaWorldgenRegistries

Type Aliases ​

DimensionLoad ​

DimensionLoad = "eager" | "lazy"

Defined in: prismarine/src/world/Level.ts:65

When a stem's world is built: at Level.enable, or on the first Level.world.


WorldHandlersFactory ​

WorldHandlersFactory = (world, dimension) => Pick<WorldData, "randomTickHandlers" | "blockTickHandlers" | "redstoneUpdateHandlers">

Defined in: prismarine/src/world/Level.ts:75

The handlers a level's worlds run, built per world by whoever owns the content.

A world's random tick, scheduled tick and redstone handlers are closures over the world they run in, and the world does not exist until the level builds it. The level calls this with a thunk that answers the world once it is built, which is how WorldManager has always built them.

Parameters ​

world ​

() => World | undefined

dimension ​

DimensionType

Returns ​

Pick<WorldData, "randomTickHandlers" | "blockTickHandlers" | "redstoneUpdateHandlers">