API reference / @jsprismarine/prismarine / world/generators/datadriven/DataDrivenGenerator / DataDrivenGenerator
Class: DataDrivenGenerator
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:835
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
Generator
Constructors
Constructor
new DataDrivenGenerator(
options):DataDrivenGenerator
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:929
Parameters
options
Returns
DataDrivenGenerator
Methods
buildFeatureTile()
buildFeatureTile(
cx,cz,seed,terrain,key?): readonlyRegionChunkPatch[]
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1542
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:1500
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:1577
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:1375
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
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:1353
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:2412
Returns
GenerationControl | undefined
Inherit Doc
Implementation of
Generator.generationControl
installStructureStartPlans()
installStructureStartPlans(
entries,seed,key?):void
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1681
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): readonlystring[]
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1782
Parameters
kind
"biome" | "structure"
Returns
readonly string[]
Inherit Doc
Implementation of
Generator.locatableNames
locate()
locate(
request):StructureSearchResult|undefined
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1730
Parameters
request
StructureSearchRequest
Returns
StructureSearchResult | undefined
Inherit Doc
Implementation of
Generator.locate
locateBiome()
locateBiome(
request):BiomeSearchResult|undefined
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1751
Parameters
request
BiomeSearchRequest
Returns
BiomeSearchResult | undefined
Inherit Doc
Implementation of
Generator.locateBiome
membersOfTag()
membersOfTag(
registry,tag):ReadonlySet<string> |undefined
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1776
Parameters
registry
LocateTagRegistry
tag
string
Returns
ReadonlySet<string> | undefined
Inherit Doc
Implementation of
Generator.membersOfTag
raiseUrgency()
raiseUrgency(
cx,cz,urgency):void
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:2429
Parameters
cx
number
cz
number
urgency
"immediate" | "soon" | "idle"
Returns
void
Inherit Doc
Implementation of
Generator.raiseUrgency
spawnChunk()
spawnChunk(
seed?):SpawnChunkResult
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1798
Parameters
seed?
bigint = 0n
Returns
SpawnChunkResult
Inherit Doc
Implementation of
Generator.spawnChunk
stopGenerating()
stopGenerating():
void
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1592
Returns
void
Inherit Doc
Implementation of
Generator.stopGenerating
structureSpawnOverrideAt()
structureSpawnOverrideAt(
identifier,at,seed?):boolean|undefined
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1690
Parameters
identifier
string
at
x
number
y
number
z
number
seed?
bigint = 0n
Returns
boolean | undefined
Inherit Doc
Implementation of
Generator.structureSpawnOverrideAt
structureStartCandidatesForRegion()
structureStartCandidatesForRegion(
minChunkX,minChunkZ,maxChunkX,maxChunkZ,seed?,key?): readonlyStructureStartCandidate[]
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1642
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?): readonlyStructureStartPlanEntry[]
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1663
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?): readonlyStructureStart[]
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1623
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:1793
Parameters
x
number
z
number
seed?
bigint = 0n
Returns
SurfaceProbe
Inherit Doc
Implementation of
Generator.surfaceAt
unbuiltStructureTypes()
unbuiltStructureTypes(
seed?,key?):ReadonlySet<string>
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1725
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?): readonlystring[]
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:1610
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[]