Skip to content

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? ​

readonly optional keep?: readonly RegionBlockPosition[]

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? ​

readonly optional yieldToEarlierWrites?: 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 ​

readonly columnTops: 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 ​

readonly palette: readonly RegionBlock[]

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:158

The palette the slots index into. Slot 0 is air.

slots ​

readonly slots: 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 ​

readonly biomeAt: (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 ​

readonly blocks: 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 ​

readonly chunkX: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:72

chunkZ ​

readonly chunkZ: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:73

height ​

readonly height: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:77

How many y levels the dimension generates.

isColdEnoughToSnow? ​

readonly optional isColdEnoughToSnow?: (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 ​

readonly minY: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:75

The lowest y the dimension generates.

radius? ​

readonly optional radius?: 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 ​

readonly seaLevel: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:80

seed ​

readonly seed: bigint

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:81

templates? ​

readonly optional templates?: 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? ​

readonly optional biomeCells?: 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? ​

readonly optional biomeSectionOffsets?: ArrayBuffer

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:200

Uint32Array offsets delimiting each uniform or nonuniform section in biomeSections.

biomeSections? ​

readonly optional biomeSections?: 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 ​

readonly blockEntities: 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? ​

readonly optional cached?: 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 ​

readonly chunkX: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:184

chunkZ ​

readonly chunkZ: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:185

entitySpawns ​

readonly entitySpawns: readonly RegionEntitySpawn[]

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:205

fluidTicks? ​

readonly optional fluidTicks?: readonly RegionFluidTick[]

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? ​

readonly optional frozenSurface?: 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 ​

readonly height: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:187

highest ​

readonly highest: ArrayBuffer

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:194

Int32Array of the highest non-air y per column.

minY ​

readonly minY: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:186

palette ​

readonly palette: readonly RegionBlock[]

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 ​

readonly radius: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:188

states ​

readonly states: 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 ​

readonly payload: GenerationRegionPayload

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:241

transferList ​

readonly transferList: readonly ArrayBuffer[]

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 ​

readonly ids: 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 ​

readonly offsets: 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 ​

readonly indices: 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 ​

readonly palette: readonly string[]

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? ​

readonly optional bedrock?: BedrockBlockState

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:111

Set only for a block a structure template placed.

java ​

readonly java: 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 ​

readonly request: 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 ​

readonly x: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:116

y ​

readonly y: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:117

z ​

readonly z: 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 ​

readonly x: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:125

y ​

readonly y: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:126

z ​

readonly z: 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 ​

readonly x: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:340

y ​

readonly y: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:341

z ​

readonly z: 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 ​

readonly block: RegionBlock

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:250

x ​

readonly x: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:247

y ​

readonly y: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:248

z ​

readonly z: 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 ​

readonly blockEntities: readonly RegionBlockEntity[]

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:387

blockEntityRemovals ​

readonly blockEntityRemovals: readonly RegionBlockEntityRemoval[]

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:386

blocks ​

readonly blocks: RegionBlockWrites

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:385

chunkX ​

readonly chunkX: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:383

chunkZ ​

readonly chunkZ: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:384

entitySpawns ​

readonly entitySpawns: readonly RegionEntitySpawn[]

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:388

fluidTicks? ​

readonly optional fluidTicks?: readonly RegionFluidTick[]

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 ​

readonly structureBlocks: readonly RegionBlockPosition[]

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? ​

readonly optional beamTarget?: 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? ​

readonly optional invulnerable?: boolean

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:144

Whether the entity ignores damage, Java's crystal_invulnerable.

showBottom? ​

readonly optional showBottom?: 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 ​

readonly type: 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 ​

readonly x: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:134

y ​

readonly y: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:135

yaw ​

readonly yaw: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:138

Which way it faces, in degrees.

z ​

readonly z: 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? ​

readonly optional postProcess?: 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 ​

readonly x: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:340

Inherited from ​

RegionBlockPosition.x

y ​

readonly y: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:341

Inherited from ​

RegionBlockPosition.y

z ​

readonly z: number

Defined in: packages/prismarine/src/world/generators/datadriven/GenerationRegion.ts:342

Inherited from ​

RegionBlockPosition.z

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 ​

const TRANSFER_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 ​

RegionBlockWrites

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 ​

RegionBlock

Returns ​

string


paletteOfWrites() ​

paletteOfWrites(writes): readonly RegionBlock[]

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 ​

RegionBlockWrites

Returns ​

readonly RegionBlock[]