API reference / @jsprismarine/prismarine / world/generators/datadriven/DataDrivenGenerator
world/generators/datadriven/DataDrivenGenerator
Classes
Interfaces
ChunkPoolOptions
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:267
Where a generator runs whole chunks.
Properties
onUnavailable?
readonlyoptionalonUnavailable?: (reason) =>void
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:294
Told once, with the reason, when the chunks end up on this thread after all.
Parameters
reason
string
Returns
void
pipeline
readonlypipeline:string
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:272
The module a worker imports to get its generator, which defaultChunkPipeline answers for this package's own.
regionChunks?
readonlyoptionalregionChunks?:number
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:284
How wide one worker's region is, in chunks.
Left to @jsprismarine/chunkgen's default unless a caller has measured something else. See ShardedGenerationPool: this is the trade between building a neighborhood twice and leaving a worker idle.
stealAfter?
readonlyoptionalstealAfter?:number
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:286
How far behind a region's owner falls before its work is given away.
worker?
readonlyoptionalworker?:string
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:276
The worker entry, which defaults to @jsprismarine/chunkgen's own.
workerHeapSnapshotDirectory?
readonlyoptionalworkerHeapSnapshotDirectory?:string
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:292
Optional directory where each worker writes one .heapsnapshot after its first task.
workerHeapStats?
readonlyoptionalworkerHeapStats?:SharedArrayBuffer
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:288
Optional benchmark buffer with one heap-used byte count per worker after its last task.
workers
readonlyworkers:number
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:274
How many workers.
workerStartupStats?
readonlyoptionalworkerStartupStats?:SharedArrayBuffer
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:290
First-task wall, thread CPU, and heap measurements for each worker.
DataDrivenGeneratorOptions
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:152
How a DataDrivenGenerator is built.
Properties
biomeSource?
readonlyoptionalbiomeSource?:BiomeSourceDefinition
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:180
The biome layout of the default key, as the biome_source of a level stem describes it.
A definition rather than a built BiomeSource, because the worker threads build their own generator and an object with closures cannot cross a thread. A multi_noise preset resolves through the reports/biome_parameters registry. Defaults to the minecraft:overworld preset.
carve?
readonlyoptionalcarve?:boolean
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:184
Whether to run the carvers. On by default.
chunks?
readonlyoptionalchunks?:ChunkPoolOptions
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:261
Where to run whole chunks, and how many at a time.
Absent by default, which builds them on this thread. This is the pool that pays: a terrain pool leaves the decoration pass and the structure layout here, which is 168 of the 239 milliseconds a chunk costs, so no worker count takes it past 1.33 times. A pool of whole chunks makes all but the Bedrock translation parallel.
Pool options are alternatives, not layers. DataDrivenGeneratorOptions.stages takes precedence when supplied; otherwise this option takes precedence over DataDrivenGeneratorOptions.terrain, because a worker running the whole ladder runs its own terrain inside it.
completionQueue?
readonlyoptionalcompletionQueue?:ChunkCompletionScheduler
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:263
Defers chunk translation when a tick can budget the non-gameplay completion work.
concurrency?
readonlyoptionalconcurrency?:number
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:225
How many chunks of one world are built at once.
Defaults to DEFAULT_CONCURRENCY. A shutdown refuses everything past this depth straight away, so a caller that wants a shutdown to drop a particular request has to keep the depth below the number of requests it makes.
decorate?
readonlyoptionaldecorate?:boolean
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:182
Whether to run the decoration pass. On by default; a terrain test turns it off.
dimension?
readonlyoptionaldimension?:DimensionType
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:169
The dimension the instance's own Generator methods fill. Defaults to the Overworld.
With DataDrivenGeneratorOptions.noiseSettings and DataDrivenGeneratorOptions.biomeSource this is the default PipelineKey; DataDrivenGenerator.forStem serves any other.
noiseSettings?
readonlyoptionalnoiseSettings?:string
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:171
The worldgen/noise_settings identifier of the default key. Defaults to minecraft:overworld.
onStructureStartBuild?
readonlyoptionalonStructureStartBuild?: (set,chunkX,chunkZ,elapsedMs) =>void
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:194
Observes each worker-local structure-start cache miss for generation profiling.
Parameters
set
string
chunkX
number
chunkZ
number
elapsedMs
number
Returns
void
onTerrainTileBuild?
readonlyoptionalonTerrainTileBuild?: (dimension,seed,chunkX,chunkZ) =>void
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:196
Observes each terrain tile build for cross-shard duplication measurements.
Parameters
dimension
string
seed
bigint
chunkX
number
chunkZ
number
Returns
void
persistentProtoCache?
readonlyoptionalpersistentProtoCache?:TerrainProtoCacheOptions
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:211
Persist immutable terrain status tiles across restarts and holder eviction.
This cache is off by default. Its directory should be dedicated to terrain records, and maxBytes sets the record budget. Custom template sources must provide a stable worldgenFingerprint; custom structure builders and worker pipelines cannot use this cache.
registries
readonlyregistries:JavaWorldgenRegistries
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:154
The Java registries, already read off disk.
shareClimateTables?
readonlyoptionalshareClimateTables?:boolean
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:159
Builds shared immutable climate search tables when a worker pool starts. Defaults to true. Set false to compare the worker-local table path or to force local parsing.
sharedClimateParameters?
readonlyoptionalsharedClimateParameters?:ReadonlyMap<string,SharedArrayBuffer>
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:161
Shared climate tables supplied by a parent worker pipeline.
sharedTerrainTileStore?
readonlyoptionalsharedTerrainTileStore?:SharedTerrainTileStore
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:213
Opt-in bounded process-local storage for terrain tiles shared by worker threads.
stages?
readonlyoptionalstages?:StagePoolOptions
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:247
Where pure terrain and features status bodies run, sharing one holder map on this thread. A worker receives the terrain tiles it reads and returns only its feature patches.
Use this when requests overlap: unlike DataDrivenGeneratorOptions.chunks, this keeps shared neighborhood work in one scheduler instead of rebuilding it in worker-local schedulers. It takes precedence over DataDrivenGeneratorOptions.chunks and DataDrivenGeneratorOptions.terrain when more than one pool option is supplied.
structureBuilders?
readonlyoptionalstructureBuilders?:ReadonlyMap<string,StructureBuilder>
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:192
Overrides the builder for a worldgen/structure type, which a test uses to isolate one.
structures?
readonlyoptionalstructures?:boolean
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:190
Whether to place structures. On by default, and only meaningful when the decoration pass runs, because Java places a structure's pieces inside the decoration step the structure names.
templates?
readonlyoptionaltemplates?:TemplateSource
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:203
Where the structure templates template and fossil stamp come from.
Absent by default: the templates are .nbt inside Mojang's server jar rather than in the datapack the rest of the registries are read from, so a caller that wants them says so.
terrain?
readonlyoptionalterrain?:TerrainPoolOptions
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:237
Where to run the terrain bodies, and how many at a time.
Absent by default, which runs them on this thread. A pool is worth about 4.7 times one thread at five or six workers on an Apple M1 Pro, and less past that, because six of its eight cores are performance cores and a worker is a whole V8 isolate.
Only terrain goes to a worker. It writes radius 0, its own chunk and nothing else, so two of them can never touch the same block. Use DataDrivenGeneratorOptions.stages to move features as well.
PipelineDimension
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:417
The dimension as a chunk task carries it: the bounds every chunk takes and the two ids the pool and the cache key read.
A DimensionType also holds its Java definition, attributes map included, and a task is structured-cloned into a worker per chunk, so the key carries this record instead. pipelineDimensionOf makes one from a type.
Properties
bedrockId
readonlybedrockId:number
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:421
The Bedrock dimension id, which the pool shards tasks by.
height
readonlyheight:number
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:425
How many blocks tall the dimension is.
id
readonlyid:string
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:419
The Java dimension_type id, which keys the compiled pipeline.
minY
readonlyminY:number
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:423
The lowest block y.
PipelineKey
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:445
What picks one compiled pipeline out of a generator shared between dimensions: the settings a level stem names and the dimension it fills. The seed is the other half of the cache key and travels separately, because one key serves every world on the server that uses that stem.
Plain data, because every task carries its key across the worker boundary and the worker compiles the pipeline from it. One generator and one worker pool therefore serve the Overworld, the Nether and the End instead of three of each.
Properties
biomeSource
readonlybiomeSource:BiomeSourceDefinition
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:458
The biome layout, as the stem's biome_source describes it.
dimension
readonlydimension:PipelineDimension
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:460
The dimension whose bounds every chunk of this key takes.
inlineNoiseSettings?
readonlyoptionalinlineNoiseSettings?:Readonly<Record<string,unknown>>
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:456
The document PipelineKey.noiseSettings stands for when the stem carried its settings inline instead of naming a registered id.
Part of the key because the workers' registries are bundled when the pool opens, which may be before a lazily loaded dimension is built; the first task that names an inline id registers it where it runs.
noiseSettings
readonlynoiseSettings:string
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:447
The worldgen/noise_settings identifier.
StagePoolOptions
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:298
Where the shared generation scheduler runs independent status bodies.
Properties
host?
readonlyoptionalhost?:"process"|"in-process"
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:324
Where the stage workers run. process starts a generation host process and falls back to threads in this process when it cannot; absent or in-process keeps threads here. The benchmark buffers above are shared memory and do not reach a host process.
javaTemplates?
readonlyoptionaljavaTemplates?:boolean
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:312
The standard Java jar templates, when the main generator uses that same source.
Arbitrary TemplateSource callbacks cannot cross the worker boundary. Leave this unset for a custom source; terrain still runs in workers, while feature placement stays here.
onHostFallback?
readonlyoptionalonHostFallback?: (reason) =>void
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:326
Told when a requested host process could not be used and stages run in threads here.
Parameters
reason
string
Returns
void
onUnavailable?
readonlyoptionalonUnavailable?: (reason) =>void
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:328
Told once when the worker module cannot be loaded and stages fall back to this thread.
Parameters
reason
string
Returns
void
pipeline
readonlypipeline:string
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:300
The worker module, which defaultChunkPipeline answers for this package.
worker?
readonlyoptionalworker?:string
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:304
The worker entry, which defaults to @jsprismarine/chunkgen's own.
workerHeapSnapshotDirectory?
readonlyoptionalworkerHeapSnapshotDirectory?:string
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:318
Optional directory where each generation worker writes a heap snapshot after its first task.
workerHeapStats?
readonlyoptionalworkerHeapStats?:SharedArrayBuffer
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:314
Optional benchmark buffer with one heap-used byte count per worker after its last task.
workers
readonlyworkers:number
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:302
How many workers may run terrain and feature bodies concurrently.
workerStartupStats?
readonlyoptionalworkerStartupStats?:SharedArrayBuffer
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:316
First-task wall, thread CPU, and heap measurements for each worker.
StemKey
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:468
What DataDrivenGenerator.forStem takes: a PipelineKey whose dimension is the whole type. The generator slims it for the tasks it sends and keeps the type for the chunks it hands back, which carry it as Chunk.getDimension().
Extends
Omit<PipelineKey,"dimension">
Properties
biomeSource
readonlybiomeSource:BiomeSourceDefinition
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:458
The biome layout, as the stem's biome_source describes it.
Inherited from
dimension
readonlydimension:DimensionType
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:470
The dimension the stem fills.
inlineNoiseSettings?
readonlyoptionalinlineNoiseSettings?:Readonly<Record<string,unknown>>
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:456
The document PipelineKey.noiseSettings stands for when the stem carried its settings inline instead of naming a registered id.
Part of the key because the workers' registries are bundled when the pool opens, which may be before a lazily loaded dimension is built; the first task that names an inline id registers it where it runs.
Inherited from
TerrainTaskInput.inlineNoiseSettings
noiseSettings
readonlynoiseSettings:string
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:447
The worldgen/noise_settings identifier.
Inherited from
TerrainTaskInput.noiseSettings
TerrainPoolOptions
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:332
Where a generator runs its terrain bodies.
Properties
onUnavailable?
readonlyoptionalonUnavailable?: (reason) =>void
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:357
Told once, with the reason, when the terrain bodies end up on this thread after all.
A generator that cannot run workers still generates. Whoever asked for a pool is the only one who can say so where a person will read it, so the reason comes back out here rather than being swallowed or thrown.
Parameters
reason
string
Returns
void
pipeline
readonlypipeline:string
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:339
The module a worker imports to get its terrain pipeline, which defaultTerrainPipeline answers for this package's own.
A path rather than a resolved module, because the worker imports it itself.
worker?
readonlyoptionalworker?:string
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:343
The worker entry, which defaults to @jsprismarine/chunkgen's own.
workerHeapSnapshotDirectory?
readonlyoptionalworkerHeapSnapshotDirectory?:string
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:349
Optional directory where each terrain worker writes a heap snapshot after its first task.
workerHeapStats?
readonlyoptionalworkerHeapStats?:SharedArrayBuffer
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:345
Optional benchmark buffer with one heap-used byte count per worker after its last task.
workers
readonlyworkers:number
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:341
How many workers. Five or six on this machine; more is worse.
workerStartupStats?
readonlyoptionalworkerStartupStats?:SharedArrayBuffer
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:347
First-task wall, thread CPU, and heap measurements for each worker.
TerrainTaskInput
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:402
What a terrain task carries besides its position, its seed and its pipeline key.
Extends
ChunkTaskInput
Properties
beard
readonlybeard: readonlyBeardPiece[]
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:404
The structure pieces that push this chunk's terrain around, laid out on the main thread.
biomeSource
readonlybiomeSource:BiomeSourceDefinition
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:458
The biome layout, as the stem's biome_source describes it.
Inherited from
ChunkTaskInput.biomeSource
dimension
readonlydimension:PipelineDimension
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:460
The dimension whose bounds every chunk of this key takes.
Inherited from
ChunkTaskInput.dimension
inlineNoiseSettings?
readonlyoptionalinlineNoiseSettings?:Readonly<Record<string,unknown>>
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:456
The document PipelineKey.noiseSettings stands for when the stem carried its settings inline instead of naming a registered id.
Part of the key because the workers' registries are bundled when the pool opens, which may be before a lazily loaded dimension is built; the first task that names an inline id registers it where it runs.
Inherited from
ChunkTaskInput.inlineNoiseSettings
junctions
readonlyjunctions: readonlyJigsawJunction[]
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:406
The junction points that contribute after the pieces, in Java's order.
noiseSettings
readonlynoiseSettings:string
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:447
The worldgen/noise_settings identifier.
Inherited from
ChunkTaskInput.noiseSettings
seed
readonlyseed:string
Defined in: prismarine/src/world/generators/datadriven/chunkPipeline.ts:72
The world seed as a decimal string, because a bigint does not survive every clone.
Inherited from
ChunkTaskInput.seed
Functions
defaultChunkPipeline()
defaultChunkPipeline():
string
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:394
This package's shared-status and legacy whole-chunk pipeline module, beside this file or in a packaged executable.
Resolved the same way, and for the same reasons, as defaultTerrainPipeline.
Returns
string
The module path or embedded SEA asset specifier.
defaultTerrainPipeline()
defaultTerrainPipeline():
string
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:369
This package's own terrain pipeline module, beside this file or in a packaged executable.
.ts in a dev checkout, .js in a built package, or a SEA asset specifier in the packaged executable. A worker inherits process.execArgv, so a host started with --import tsx hands its workers the same loader, and the single executable loads its bundled asset from node:sea.
Returns
string
The module path or embedded SEA asset specifier.
isPipelineKey()
isPipelineKey(
value):value is PipelineKey
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:490
Whether a value cloned across the worker boundary has every field of a PipelineKey.
Parameters
value
unknown
Returns
value is PipelineKey
pipelineDimensionOf()
pipelineDimensionOf(
dimension):PipelineDimension
Defined in: prismarine/src/world/generators/datadriven/DataDrivenGenerator.ts:429
The record a task carries for a dimension type.
Parameters
dimension
DimensionType