Skip to content

API reference / @jsprismarine/prismarine / world/GeneratorFactories

world/GeneratorFactories ​

Classes ​

Interfaces ​

GeneratorBuildContext ​

Defined in: prismarine/src/world/GeneratorFactories.ts:20

Everything a factory may read while building one dimension's generator.

Properties ​

completionQueue? ​

readonly optional completionQueue?: ChunkCompletionScheduler

Defined in: prismarine/src/world/GeneratorFactories.ts:39

Server-wide tick queue for non-gameplay work that finishes a generated chunk.

content ​

readonly content: () => ServerContent

Defined in: prismarine/src/world/GeneratorFactories.ts:28

The server's loaded content, read when a block is placed.

Returns ​

ServerContent

dimension ​

readonly dimension: DimensionType

Defined in: prismarine/src/world/GeneratorFactories.ts:24

The dimension the generator fills, whose bounds every chunk takes.

host? ​

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

Defined in: prismarine/src/world/GeneratorFactories.ts:53

Where the workers run: process asks for a separate low-priority generation process and falls back to threads when it cannot start one. Absent means threads in this process.

logger ​

readonly logger: GeneratorLogger

Defined in: prismarine/src/world/GeneratorFactories.ts:37

Where a factory or its generator reports a decision a person should see.

seed ​

readonly seed: bigint

Defined in: prismarine/src/world/GeneratorFactories.ts:26

The world seed. A generator that is seeded per chunk request may ignore it.

stem ​

readonly stem: LevelStem

Defined in: prismarine/src/world/GeneratorFactories.ts:22

The stem naming the generator kind and its settings.

terrainCache? ​

readonly optional terrainCache?: TerrainCacheSettings

Defined in: prismarine/src/world/GeneratorFactories.ts:60

Where generated terrain tiles are kept between runs, and how much room they may take.

Absent keeps every tile in memory only. Like workers, the noise factory reads it once, from the first stem it builds, because one generator serves every dimension.

workers? ​

readonly optional workers?: number

Defined in: prismarine/src/world/GeneratorFactories.ts:48

How many worker threads the generator may start.

Defaults to the host's share, min(6, cores - 2). Zero keeps generation on the calling thread, which is what a test wants and what a host too small for a worker gets anyway. The noise factory shares one pool between every stem it builds, so the first stem's value sizes it and later ones are not read.

worldgen ​

readonly worldgen: () => JavaWorldgenRegistries

Defined in: prismarine/src/world/GeneratorFactories.ts:35

Java's world generation registries.

A function, because reading them costs about 1500 JSON files and a flat or void dimension never needs them. Throws when the Java data is not on disk.

Returns ​

JavaWorldgenRegistries


GeneratorFactory ​

Defined in: prismarine/src/world/GeneratorFactories.ts:74

Builds the generator for one kind of stem.

Properties ​

kind ​

readonly kind: string

Defined in: prismarine/src/world/GeneratorFactories.ts:76

The generator kind this factory answers, as a stem's generator.type spells it.

Methods ​

build() ​

build(context): Generator

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

Builds a generator for one dimension.

Parameters ​
context ​

GeneratorBuildContext

Returns ​

Generator

Throws ​

When the stem's settings cannot be honored, which is the moment a misconfigured world should fail rather than at its first chunk.


TerrainCacheSettings ​

Defined in: prismarine/src/world/GeneratorFactories.ts:64

A disk budget for generated terrain tiles.

Properties ​

codeVersion ​

readonly codeVersion: string

Defined in: prismarine/src/world/GeneratorFactories.ts:70

Identifies the code that builds the tiles, so an upgrade does not reuse older records.

directory ​

readonly directory: string

Defined in: prismarine/src/world/GeneratorFactories.ts:66

A directory used only for terrain records.

maxBytes ​

readonly maxBytes: number

Defined in: prismarine/src/world/GeneratorFactories.ts:68

The most bytes the records may take.