Skip to content

API reference / @jsprismarine/prismarine / DataDrivenGenerator

Class: DataDrivenGenerator ​

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:833

The chunk generator that reads Java's data.

One instance covers one server. Its own Generator methods fill the dimension the options name, and DataDrivenGenerator.forStem returns a Generator for any other stem that shares this instance's registries, caches and worker pool. Everything that depends on a PipelineKey and a seed is compiled once per pair and kept, plus recent terrain tiles shared by neighboring feature regions.

Implements ​

Constructors ​

Constructor ​

new DataDrivenGenerator(options): DataDrivenGenerator

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:927

Parameters ​

options ​

DataDrivenGeneratorOptions

Returns ​

DataDrivenGenerator

Methods ​

buildFeatureTile() ​

buildFeatureTile(cx, cz, seed, terrain, key?): readonly RegionChunkPatch[]

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1540

Runs one features status body over the nine terrain tiles it reads.

This is the worker half of the shared-status pool. The main scheduler owns the holder map and sends immutable terrain payloads; this method owns the feature view and returns the writes grouped by destination chunk.

Parameters ​

cx ​

number

Center chunk x.

cz ​

number

Center chunk z.

seed ​

bigint

The world seed.

terrain ​

readonly GenerationRegionPayload[]

The nine tiles in FEATURE_VIEW_TILES order.

key? ​

PipelineKey = ...

The stem's settings and dimension. Defaults to the instance's own.

Returns ​

readonly RegionChunkPatch[]

The center chunk's own feature writes and its eight outbound patches.

Throws ​

RangeError when the task does not carry the complete 3 by 3 terrain view.


buildFullTile() ​

buildFullTile(cx, cz, seed, key?, structureStartPlans?): Promise<GenerationRegionTransfer>

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1498

One finished chunk's merged region, packed for the thread that asked for it.

What a worker runs when the whole ladder is pooled. It climbs to full exactly as the main thread would and stops one step short of the Bedrock translation, which stays on the thread that holds the mapping tables.

The region is copied rather than moved. Moving it would leave this worker's holder with a detached chunk, and a second request for the same position - two worlds on one seed, a chunk the main thread let go of - would find nothing there. A copy is about 60 microseconds against a chunk that costs a couple of hundred milliseconds to build.

Parameters ​

cx ​

number

Chunk x.

cz ​

number

Chunk z.

seed ​

bigint

The world seed, which with the key pins the pipeline.

key? ​

PipelineKey = ...

The stem's settings and dimension. Defaults to the instance's own.

structureStartPlans? ​

readonly StructureStartPlanEntry[] = []

Layout data already built by their stable owner shards.

Returns ​

Promise<GenerationRegionTransfer>

The merged region, copying its cached terrain buffers and transferring its new biome buffers.

Throws ​

When the ladder reached full without leaving a region, which would mean a status body stopped writing one.


buildTerrainTile() ​

buildTerrainTile(cx, cz, seed, beard, junctions?, key?): Promise<GenerationRegionTransfer>

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1575

One chunk's terrain tile, packed for the thread that asked for it.

What a worker runs. It is the same buildTerrain the main thread runs, called the same way, which is the point: two implementations of the noise fill would be two worlds, and nothing short of a digest comparison would say which.

The structure pieces come in rather than being looked up, because laying structures out belongs to whichever thread owns the starts and is far too expensive to repeat per worker.

Parameters ​

cx ​

number

Chunk x.

cz ​

number

Chunk z.

seed ​

bigint

The world seed, which with the key pins the pipeline.

beard ​

readonly BeardPiece[]

The structure pieces that push this chunk's terrain around.

junctions? ​

readonly JigsawJunction[] = []

The jigsaw junctions to add after all piece contributions.

key? ​

PipelineKey = ...

The stem's settings and dimension. Defaults to the instance's own.

Returns ​

Promise<GenerationRegionTransfer>

The tile and the buffers to transfer. The tile is spent: its bytes belong to the receiving thread.


forStem() ​

forStem(stem): Generator

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1373

A Generator for one stem over this instance's registries, caches and worker pool.

This is how three dimensions share one pool of workers: each gets a view that tags its tasks with its key, and the pipelines the key compiles are kept here, one per seed. The view's stopGenerating stops this whole generator, because a shutdown is the only caller and it is stopping the server's one pool.

Parameters ​

stem ​

StemKey

Returns ​

Generator

Throws ​

When the key's biome source cannot be built, which is the moment a misconfigured stem should fail rather than at its first chunk. The noise settings id is checked when the first pipeline compiles; a factory that wants it checked earlier looks it up first.


generateChunk() ​

generateChunk(cx, cz, seed?, _config?, options?): Promise<Chunk>

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1351

Parameters ​

cx ​

number

cz ​

number

seed? ​

bigint = 0n

_config? ​

Partial<WorldData>

options? ​

ChunkRequestOptions

Returns ​

Promise<Chunk>

Inherit Doc ​

This

implementation returns its retained mutable chunk. Repeated requests for the same seed and position share one object until the generation holder is evicted.

Implementation of ​

Generator.generateChunk


generationControl() ​

generationControl(): GenerationControl | undefined

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:2410

A handle on the generator's worker pools, for measurement.

Optional, because a generator with no pool has nothing to hold back or count. The handle does not change what is generated: pausing only delays when a queued task reaches a worker.

Returns ​

GenerationControl | undefined

The handle, or undefined when no pool is running.

Implementation of ​

Generator.generationControl


installStructureStartPlans() ​

installStructureStartPlans(entries, seed, key?): void

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1679

Installs coordinator-produced plans before a worker starts generating a chunk.

Parameters ​

entries ​

readonly StructureStartPlanEntry[]

The starts and rejected candidates returned by owner workers.

seed ​

bigint

The world seed.

key? ​

PipelineKey = ...

The dimension and settings. Defaults to the instance's own.

Returns ​

void


locatableNames() ​

locatableNames(kind): readonly string[]

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1780

Every identifier and #tag a /locate of one kind may name, for its suggestions.

Registry-wide rather than per dimension, as Java's suggestions are: a Nether player is offered minecraft:village_plains and told it is not nearby.

Optional, because a generator without Java's registries has nothing to suggest beyond Mojang's published list.

Parameters ​

kind ​

"biome" | "structure"

Returns ​

readonly string[]

Implementation of ​

Generator.locatableNames


locate() ​

locate(request): StructureSearchResult | undefined

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1728

The nearest structure a search accepts, without generating anything.

This is what /locate asks. A structure's position is a function of the seed and the placement grid alone, so the answer comes from laying candidates out against the bare noise terrain: no chunk is built, nothing is written, and a search over thousands of blocks costs a few hundred layout attempts rather than thousands of chunks.

Synchronous, like Generator.surfaceAt and for the same reason: the command layer that asks is synchronous, and the work is arithmetic rather than a chunk.

Optional, because a generator that places no structures has nothing to find.

Parameters ​

request ​

StructureSearchRequest

Where to search from, how far, and which structures count.

Returns ​

StructureSearchResult | undefined

The nearest match, or undefined when the radius held none.

Implementation of ​

Generator.locate


locateBiome() ​

locateBiome(request): BiomeSearchResult | undefined

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1749

The nearest cell of a biome a search accepts, without generating anything.

This is what /locate biome asks: Java's BiomeSource.findClosestBiome3d, a grid laid over the climate sampler and walked outward from the origin. Synchronous for the same reason Generator.locate is.

Optional, because a generator with no biome source of its own has nothing to walk.

Parameters ​

request ​

BiomeSearchRequest

Returns ​

BiomeSearchResult | undefined

The first grid cell met that holds a wanted biome, or undefined when the radius held none or no wanted biome can occur in this dimension.

Implementation of ​

Generator.locateBiome


membersOfTag() ​

membersOfTag(registry, tag): ReadonlySet<string> | undefined

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1774

The identifiers a #tag of one registry names, which is how /locate structure #minecraft:village and an eye of ender's #minecraft:eye_of_ender_located are read.

Optional, because only a generator built from Java's data carries its tags.

Parameters ​

registry ​

LocateTagRegistry

tag ​

string

The tag's identifier without the #, for example minecraft:village.

Returns ​

ReadonlySet<string> | undefined

The members, or undefined when the generator knows no tag by that name.

Implementation of ​

Generator.membersOfTag


raiseUrgency() ​

raiseUrgency(cx, cz, urgency): void

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:2427

Says that a chunk already asked for is wanted more than it was.

A chunk is requested once and waited on by everybody who wants it, so the band it was given is whoever asked first. A rim chunk queued as idle is the chunk a player is standing on a moment later, and nothing else would move it up.

Only affects a request still waiting for a worker. One already being built finishes at the speed it was going to finish at either way.

Optional, because a generator with no queue has no turn to move.

Parameters ​

cx ​

number

Chunk x of the request.

cz ​

number

Chunk z of the request.

urgency ​

"idle" | "immediate" | "soon"

The band to move it into. Never lowers one.

Returns ​

void

Implementation of ​

Generator.raiseUrgency


spawnChunk() ​

spawnChunk(seed?): SpawnChunkResult

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1796

Selects the spawn chunk from the generator's climate targets without sampling terrain columns. The world resolves a safe block position from that chunk after it is generated.

Parameters ​

seed? ​

bigint = 0n

Returns ​

SpawnChunkResult

Implementation of ​

Generator.spawnChunk


stopGenerating() ​

stopGenerating(): void

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1590

Gives up every chunk request that has not started yet, for a server that is shutting down.

A generator that answers one request at a time holds a queue, and a start region fills that queue thirty-two chunks at a time. Waiting for it to drain means a shutdown spends seconds generating terrain that the save it is about to run will not even look at. The request that is already running finishes, so no half-generated chunk is handed back; everything behind it rejects with GenerationStopped.

Optional, because a generator that answers immediately has no queue to give up.

Returns ​

void

Implementation of ​

Generator.stopGenerating


structureSpawnOverrideAt() ​

structureSpawnOverrideAt(identifier, at, seed?): boolean | undefined

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1688

Whether Java structure spawn overrides reserve an entity type at one position.

Generators without Java structure data omit the query. A generator with Java data returns undefined for an entity that also appears in Java's biome spawn tables or has no structure override. Structure-only entities return false outside matching overrides and true inside one.

Parameters ​

identifier ​

string

The Bedrock entity identifier used by the live spawner.

at ​

The entity's candidate spawn position in blocks.

x ​

number

y ​

number

z ​

number

seed? ​

bigint = 0n

The world seed used to lay out structures.

Returns ​

boolean | undefined

Implementation of ​

Generator.structureSpawnOverrideAt


structureStartCandidatesForRegion() ​

structureStartCandidatesForRegion(minChunkX, minChunkZ, maxChunkX, maxChunkZ, seed?, key?): readonly StructureStartCandidate[]

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1640

Candidate starts in the reference window of a rectangular chunk region, without building them.

Parameters ​

minChunkX ​

number

The region's minimum chunk x.

minChunkZ ​

number

The region's minimum chunk z.

maxChunkX ​

number

The region's maximum chunk x.

maxChunkZ ​

number

The region's maximum chunk z.

seed? ​

bigint = 0n

The world seed.

key? ​

PipelineKey = ...

The dimension and settings. Defaults to the instance's own.

Returns ​

readonly StructureStartCandidate[]

Candidate starts whose layout may be referenced by a chunk in the region.


structureStartPlansFor() ​

structureStartPlansFor(candidates, seed, key?): readonly StructureStartPlanEntry[]

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1661

Builds structure starts on this worker and returns their cloneable layout plans.

Parameters ​

candidates ​

readonly StructureStartCandidate[]

The starts this worker owns.

seed ​

bigint

The world seed.

key? ​

PipelineKey = ...

The dimension and settings. Defaults to the instance's own.

Returns ​

readonly StructureStartPlanEntry[]

Each accepted layout, or a null result when Java rejects the candidate.


structureStartsAt() ​

structureStartsAt(chunkX, chunkZ, seed?, key?): readonly StructureStart[]

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1621

The structure starts that reach into a chunk, without generating it.

A start is laid out against the bare noise terrain and touches no chunk, so this is the cheap way to ask where a structure is: a comparison against Java's /locate needs the generation point and the box, and neither needs a block placed.

Parameters ​

chunkX ​

number

chunkZ ​

number

seed? ​

bigint = 0n

key? ​

PipelineKey = ...

The stem's settings and dimension. Defaults to the instance's own.

Returns ​

readonly StructureStart[]


surfaceAt() ​

surfaceAt(x, z, seed?): SurfaceProbe

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1791

The topmost block of one column, without generating the chunk it is in.

The answer comes from the bare terrain: no surface rule has run and nothing has decorated, so a flooded column reads as water and a wooded one reads as the ground under the trees rather than as a canopy. That is Java's ChunkGenerator.getBaseHeight, and it is what a spawn search wants - whether a player can stand here is a question about the land, and answering it by generating a finished chunk costs four orders of magnitude more.

Optional, because a generator with no cheaper answer than its own chunks has nothing to add here and a caller falls back to generating one.

Parameters ​

x ​

number

z ​

number

seed? ​

bigint = 0n

Returns ​

SurfaceProbe

Implementation of ​

Generator.surfaceAt


unbuiltStructureTypes() ​

unbuiltStructureTypes(seed?, key?): ReadonlySet<string>

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1723

The structure types this server has no builder for, which therefore generate nothing.

Parameters ​

seed? ​

bigint = 0n

key? ​

PipelineKey = ...

The stem's settings and dimension. Defaults to the instance's own.

Returns ​

ReadonlySet<string>


unmappedStates() ​

unmappedStates(seed, key?): readonly string[]

Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1608

Every Java state the translator could not place, for a caller that wants to report them.

Parameters ​

seed ​

bigint

key? ​

PipelineKey = ...

The stem's settings and dimension. Defaults to the instance's own.

Returns ​

readonly string[]