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?
readonlyoptionalchunkHost?:"process"|"in-process"
Defined in: prismarine/src/world/Level.ts:115
Where chunk generation workers run, forwarded to generator factories.
chunkWorkers?
readonlyoptionalchunkWorkers?:number
Defined in: prismarine/src/world/Level.ts:113
The chunk worker limit from server configuration, forwarded to generator factories.
config?
readonlyoptionalconfig?:Partial<WorldData>
Defined in: prismarine/src/world/Level.ts:119
The worlds.<name> entry as configured, which a provider may read when generating.
dimensionTypes
readonlydimensionTypes: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
readonlyfactories:GeneratorFactories
Defined in: prismarine/src/world/Level.ts:106
The generator kinds this server can build a stem with.
handlers?
readonlyoptionalhandlers?:WorldHandlersFactory
Defined in: prismarine/src/world/Level.ts:121
The handlers each world runs; see WorldHandlersFactory.
load?
readonlyoptionalload?: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
readonlyname:string
Defined in: prismarine/src/world/Level.ts:83
The folder name under worlds/, which is also the worlds.<name> key.
onWorldBuilt?
readonlyoptionalonWorldBuilt?: (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
Returns
void
path
readonlypath:string
Defined in: prismarine/src/world/Level.ts:85
The level folder, where the legacy level.json and the fallback player records live.
provider
readonlyprovider: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
readonlyseed:bigint
Defined in: prismarine/src/world/Level.ts:91
The world seed, as a 64-bit value. See import('../utils/Seed').worldSeedOf.
server
readonlyserver: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
readonlystems: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?
readonlyoptionalterrainCache?:TerrainCacheSettings
Defined in: prismarine/src/world/Level.ts:117
The terrain tile cache from server configuration, forwarded to generator factories.
worldgen?
readonlyoptionalworldgen?: () =>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">