API reference / @jsprismarine/prismarine / world/generators/datadriven/GenerationRegion
world/generators/datadriven/GenerationRegion
Classes
Interfaces
ApplyPatchOptions
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:433
What GenerationRegion.applyPatch leaves alone.
Properties
keep?
readonlyoptionalkeep?: readonlyRegionBlockPosition[]
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:438
Positions the patch may not write. The chunk's own structure blocks, when the patch is a neighbor's; see RegionChunkPatch.structureBlocks.
yieldToEarlierWrites?
readonlyoptionalyieldToEarlierWrites?:boolean
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:451
Whether a write yields to a block an earlier patch placed. Set for a neighbor's patch: it was decorated against this chunk's bare terrain, so where this chunk's own pass, or a neighbor merged before it, already placed a block, the write was decided without seeing it. A structure piece's write never yields. It then lands only over air or a block a tree may grow through, Java's TreeFeature.validTreePos. That is the outcome Java reaches when the neighbor decorates second: its leaves fill around this chunk's trunk instead of cutting through it, and its ore or grass leaves this chunk's logs alone.
Java See
TreeFeature.validTreePos
CenterBlockSlots
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:156
The center chunk handed over as palette slots rather than as 98304 block states.
What the Bedrock chunk is filled from. Translating per block costs one mapping lookup for each of the column's blocks; translating the palette costs one for each of its few hundred entries, and the index buffer is then copied section by section. That is the difference between work proportional to the chunk and work proportional to the materials in it, and it is what makes the handover cheap enough to sit on the main thread behind a worker pool.
Properties
columnTops
readonlycolumnTops:Int32Array
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:162
The highest y holding a non-air block per column, indexed localX * 16 + localZ.
palette
readonlypalette: readonlyRegionBlock[]
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:158
The palette the slots index into. Slot 0 is air.
slots
readonlyslots:Uint16Array
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:160
One slot per block, indexed (localX * 16 + localZ) * height + (y - minY).
GenerationRegionOptions
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:71
How a GenerationRegion is built.
Properties
[READ_THROUGH_TERRAIN]?
optional[READ_THROUGH_TERRAIN]?:true
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:97
biomeAt
readonlybiomeAt: (x,y,z) =>string
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:85
The biome at a block position, as the surface pass and the features both read it.
Parameters
x
number
y
number
z
number
Returns
string
blocks
readonlyblocks:BlockOracle
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:83
The static block facts, which the features package reads through the world.
chunkX
readonlychunkX:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:72
chunkZ
readonlychunkZ:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:73
height
readonlyheight:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:77
How many y levels the dimension generates.
isColdEnoughToSnow?
readonlyoptionalisColdEnoughToSnow?: (x,y,z) =>boolean
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:91
Java's Biome.getTemperature(pos) < 0.15, which is what freeze_top_layer acts on.
Parameters
x
number
y
number
z
number
Returns
boolean
Java Source
Biome.getTemperature
minY
readonlyminY:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:75
The lowest y the dimension generates.
radius?
readonlyoptionalradius?:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:79
Chunk radius held in memory; zero is used for cached terrain tiles. Defaults to one.
seaLevel
readonlyseaLevel:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:80
seed
readonlyseed:bigint
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:81
templates?
readonlyoptionaltemplates?:TemplateSource
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:96
Where the structure templates come from. Absent on a server that carries none, which makes template and fossil report that they placed nothing.
GenerationRegionPayload
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:183
A region flattened into something postMessage moves rather than copies.
What a terrain body in a worker hands back. Everything is a number, a plain object or an ArrayBuffer: no class instance survives a structured clone, and a per-block object graph costs the main thread 298 microseconds a chunk against 20 for this shape.
The region's options do not travel. The block oracle, the biome lookup and the template source are functions, and the thread receiving this has its own.
Properties
biomeCells?
readonlyoptionalbiomeCells?:RegionBiomeCells
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:202
The Java biome of each of the chunk's 4 by 4 by 4 cells, as RegionBiomeCells.
biomeSectionOffsets?
readonlyoptionalbiomeSectionOffsets?:ArrayBuffer
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:200
Uint32Array offsets delimiting each uniform or nonuniform section in biomeSections.
biomeSections?
readonlyoptionalbiomeSections?:ArrayBuffer
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:198
Compact per-section Bedrock biome IDs, transferred separately from the terrain tile.
blockEntities
readonlyblockEntities: readonly (readonly [number,RegionBlockEntity])[]
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:204
The block entities, each with the state index it is attached to.
cached?
readonlyoptionalcached?:true
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:212
Set on a terrain task's result when the worker read the tile from the persistent terrain cache rather than building it, so the thread that asked counts only the tiles really built.
chunkX
readonlychunkX:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:184
chunkZ
readonlychunkZ:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:185
entitySpawns
readonlyentitySpawns: readonlyRegionEntitySpawn[]
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:205
fluidTicks?
readonlyoptionalfluidTicks?: readonlyRegionFluidTick[]
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:207
The fluid positions to tick once the chunk is in a world; see GenerationRegion.scheduleFluidTick.
frozenSurface?
readonlyoptionalfrozenSurface?:ArrayBuffer
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:196
Int32Array of the frozen WORLD_SURFACE_WG heights, absent before the fill froze them.
height
readonlyheight:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:187
highest
readonlyhighest:ArrayBuffer
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:194
Int32Array of the highest non-air y per column.
minY
readonlyminY:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:186
palette
readonlypalette: readonlyRegionBlock[]
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:190
The palette the state indices point into. A few hundred entries, not 98304.
radius
readonlyradius:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:188
states
readonlystates:ArrayBuffer
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:192
Uint16Array of palette slots, indexed the way the region indexes its own.
GenerationRegionTransfer
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:240
A payload and the buffers to hand postMessage so they move instead of being copied.
Properties
payload
readonlypayload:GenerationRegionPayload
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:241
transferList
readonlytransferList: readonlyArrayBuffer[]
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:242
PackedBiomeSections
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:166
A chunk's Bedrock biome sections, compacted for a single worker transfer.
Properties
ids
readonlyids:Uint16Array<ArrayBuffer>
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:168
One id for a uniform section, or 4096 block ids for a nonuniform section.
offsets
readonlyoffsets:Uint32Array<ArrayBuffer>
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:170
Start offsets for each section, with one trailing offset.
RegionBiomeCells
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:229
The Java biome of every 4 by 4 by 4 cell of a region's center chunk, sampled once with its terrain so the threads that read the tile later need not sample the biome source again.
Properties
indices
readonlyindices:ArrayBuffer
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:236
Uint16Array of palette slots, one per cell, ordered by y cell from the bottom of the dimension, then x, then z: (quartY - minQuartY) * 16 + (quartX & 3) * 4 + (quartZ & 3).
palette
readonlypalette: readonlystring[]
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:231
The distinct biome identifiers, which indices point into.
RegionBlock
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:108
One entry of the region's palette.
Almost every block is a Java state, which is what the terrain, surface and feature stages write. A block a structure template placed arrives already translated, because @jsprismarine/structures answers in Bedrock states, so it carries both: the Bedrock state the chunk gets, and the Java view the rest of generation reads it back through.
Properties
bedrock?
readonlyoptionalbedrock?:BedrockBlockState
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:111
Set only for a block a structure template placed.
java
readonlyjava:BlockState
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:109
RegionBlockEntity
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:115
A block entity a feature attached to a block it placed, in world coordinates.
Properties
request
readonlyrequest:BlockEntityRequest
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:120
What the feature asked for, still naming Java's block entity type and loot table.
x
readonlyx:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:116
y
readonlyy:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:117
z
readonlyz:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:118
RegionBlockEntityRemoval
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:124
A block entity a later feature write removed, in world coordinates.
Properties
x
readonlyx:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:125
y
readonlyy:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:126
z
readonlyz:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:127
RegionBlockPosition
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:339
A block position in world coordinates.
Extended by
Properties
x
readonlyx:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:340
y
readonlyy:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:341
z
readonlyz:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:342
RegionBlockWrite
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:246
A block state written during decoration, in world coordinates.
Properties
block
readonlyblock:RegionBlock
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:250
x
readonlyx:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:247
y
readonlyy:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:248
z
readonlyz:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:249
RegionChunkPatch
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:382
Decoration output that belongs to one chunk.
Properties
blockEntities
readonlyblockEntities: readonlyRegionBlockEntity[]
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:387
blockEntityRemovals
readonlyblockEntityRemovals: readonlyRegionBlockEntityRemoval[]
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:386
blocks
readonlyblocks:RegionBlockWrites
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:385
chunkX
readonlychunkX:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:383
chunkZ
readonlychunkZ:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:384
entitySpawns
readonlyentitySpawns: readonlyRegionEntitySpawn[]
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:388
fluidTicks?
readonlyoptionalfluidTicks?: readonlyRegionFluidTick[]
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:390
The fluid ticks a feature asked for in this chunk; see GenerationRegion.scheduleFluidTick.
structureBlocks
readonlystructureBlocks: readonlyRegionBlockPosition[]
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:401
The positions among RegionChunkPatch.blocks a structure piece wrote.
A structure's blocks win over a feature from another chunk, whichever of the two Java would have run first: decorated earlier, the feature tests against the structure's blocks and leaves them; decorated later, the piece writes over whatever the feature placed. A neighbor's pass here decorates against bare terrain and never sees the pieces, so the merge is where that outcome is kept - an inbound write at one of these positions is dropped.
RegionEntitySpawn
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:131
An entity a feature asked for, at the entity coordinates it stands on.
Properties
beamTarget?
readonlyoptionalbeamTarget?:BlockPos
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:140
The block an end crystal's beam points at, Java's crystal_beam_target.
invulnerable?
readonlyoptionalinvulnerable?:boolean
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:144
Whether the entity ignores damage, Java's crystal_invulnerable.
showBottom?
readonlyoptionalshowBottom?:boolean
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:142
Whether an end crystal renders its base plate; absent keeps the client default, true.
type
readonlytype:string
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:133
The Java entity type the feature named, for example minecraft:end_crystal.
x
readonlyx:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:134
y
readonlyy:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:135
yaw
readonlyyaw:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:138
Which way it faces, in degrees.
z
readonlyz:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:136
RegionFluidTick
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:351
A position generation asks the world to revisit once the chunk is in it: the fluid standing there is ticked, and a mark for post-processing also has the block settled against its neighbors. See GenerationRegion.scheduleFluidTick and GenerationRegion.markForPostProcessing.
Extends
Properties
postProcess?
readonlyoptionalpostProcess?:boolean
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:358
Whether this is Java's ChunkAccess.markPosForPostProcessing rather than a scheduled fluid tick, so LevelChunk.postProcessGeneration also runs Block.updateFromNeighbourShapes here.
Java See
ChunkAccess.markPosForPostProcessing
x
readonlyx:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:340
Inherited from
y
readonlyy:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:341
Inherited from
z
readonlyz:number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:342
Inherited from
Type Aliases
RegionBlockWrites
RegionBlockWrites = readonly
RegionBlockWrite[] |PackedBlockWrites
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:323
A patch's block writes, one record each or packed as a worker sends them.
Variables
TRANSFER_ONLY_FIELDS
constTRANSFER_ONLY_FIELDS: readonly ["biomeSections","biomeSectionOffsets","cached"]
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:219
The fields GenerationRegion.transfer carries that GenerationRegion.workerInput leaves out, so a transferred payload without them is the tile as a task input.
Functions
forEachBlockWrite()
forEachBlockWrite(
writes,visit):void
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:326
Calls visit for each of a patch's block writes in order, in either form.
Parameters
writes
visit
(x, y, z, block) => void
Returns
void
isOptionalFluidTickList()
isOptionalFluidTickList(
value): value is readonly RegionFluidTick[] | undefined
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:365
Whether a value that crossed a thread or came off disk is absent or a list of block positions, which is the shape a region's and a patch's fluid ticks travel in.
Parameters
value
unknown
Returns
value is readonly RegionFluidTick[] | undefined
isPackableY()
isPackableY(
y):boolean
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:260
Whether a packed write list can hold a write at height y.
Parameters
y
number
Returns
boolean
packWritePosition()
packWritePosition(
x,y,z):number
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:266
One write's position within its chunk as a packed word: y above the bias, then z and x. The caller checks y with isPackableY.
Parameters
x
number
y
number
z
number
Returns
number
paletteKeyOf()
paletteKeyOf(
block):string
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:483
Where one palette entry sits in the key space, whichever edition wrote it.
Parameters
block
Returns
string
paletteOfWrites()
paletteOfWrites(
writes): readonlyRegionBlock[]
Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:335
The blocks a patch's writes place: a packed list's palette, or each record's block once.
Parameters
writes
Returns
readonly RegionBlock[]