Skip to content

API reference / @jsprismarine/prismarine / world/generators/datadriven/mergedChunk

world/generators/datadriven/mergedChunk ​

Interfaces ​

MergedChunkParts ​

Defined in: packages/prismarine/src/world/generators/datadriven/mergedChunk.ts:41

What a merged chunk task hands back: everything the server thread builds the chunk from.

Properties ​

blockEntities ​

readonly blockEntities: readonly RegionBlockEntity[]

Defined in: packages/prismarine/src/world/generators/datadriven/mergedChunk.ts:45

The block entities the merge left in the chunk.

entitySpawns ​

readonly entitySpawns: readonly RegionEntitySpawn[]

Defined in: packages/prismarine/src/world/generators/datadriven/mergedChunk.ts:47

The entities features asked for inside the chunk, in the order they asked.

fluidTicks ​

readonly fluidTicks: readonly RegionFluidTick[]

Defined in: packages/prismarine/src/world/generators/datadriven/mergedChunk.ts:49

The fluid ticks and post-processing marks asked for inside the chunk, in the order they were asked for.

sections ​

readonly sections: readonly BedrockSection[]

Defined in: packages/prismarine/src/world/generators/datadriven/mergedChunk.ts:43

The non-empty Bedrock sections.


PaletteTranslation ​

Defined in: packages/prismarine/src/world/generators/datadriven/mergedChunk.ts:29

The Bedrock form of every palette entry a merge can produce, keyed by paletteKeyOf.

Properties ​

air ​

readonly air: number

Defined in: packages/prismarine/src/world/generators/datadriven/mergedChunk.ts:37

Air's runtime id.

keys ​

readonly keys: readonly string[]

Defined in: packages/prismarine/src/world/generators/datadriven/mergedChunk.ts:31

The entries' palette keys.

runtimeIds ​

readonly runtimeIds: Int32Array<ArrayBuffer>

Defined in: packages/prismarine/src/world/generators/datadriven/mergedChunk.ts:33

The Bedrock runtime id of each key, already air where this server maps nothing.

water ​

readonly water: Uint8Array<ArrayBuffer>

Defined in: packages/prismarine/src/world/generators/datadriven/mergedChunk.ts:35

1 where the entry is a waterlogged Java state, which Bedrock keeps in storage layer 1.

Functions ​

isMergedChunkParts() ​

isMergedChunkParts(value): value is MergedChunkParts

Defined in: packages/prismarine/src/world/generators/datadriven/mergedChunk.ts:112

Whether a worker's answer to a merged chunk task has the parts a chunk is built from.

Parameters ​

value ​

unknown

Returns ​

value is MergedChunkParts


isPaletteTranslation() ​

isPaletteTranslation(value): value is PaletteTranslation

Defined in: packages/prismarine/src/world/generators/datadriven/mergedChunk.ts:101

Whether a value that crossed a thread or process boundary is a translation table.

Parameters ​

value ​

unknown

Returns ​

value is PaletteTranslation


mergeFeatureWrites() ​

mergeFeatureWrites(final, inputs): void

Defined in: packages/prismarine/src/world/generators/datadriven/mergedChunk.ts:139

Lays a chunk's own feature writes and its neighbors' patches over its terrain.

The patches go in as if the world decorated its chunks in one order, row by row from north to south and west to east along a row, which FEATURE_PATCH_ORDER already follows: the neighbors before the chunk, then its own writes, then the neighbors after it. Every chunk of a border agrees on which of two overlapping trees grew second, so that tree's leaves win on both sides, as one Java run leaves them. Merging every chunk's own writes first let each side's neighbor win instead, and two canopies swapped halves across the border.

Each pass decorated against its neighbors' bare terrain, so a later write yields to a block an earlier one placed unless a tree could grow through it; see ApplyPatchOptions.yieldToEarlierWrites. A neighbor's ore vein or grass patch also chose its blocks without seeing the structure pieces this chunk placed, so those pieces are kept, which is the outcome Java reaches in either order.

Parameters ​

final ​

GenerationRegion

The chunk's terrain, which the writes land in.

inputs ​

MergeInputs

What the full body gathered.

Returns ​

void


translatePalette() ​

translatePalette(blocks, translate, air): PaletteTranslation

Defined in: packages/prismarine/src/world/generators/datadriven/mergedChunk.ts:57

Builds the table for a set of palette entries, each translated once.

Parameters ​

blocks ​

Iterable<RegionBlock>

The entries a merge can produce, repeats allowed.

translate ​

(block) => object

The server thread's mapping of one entry.

air ​

number

Returns ​

PaletteTranslation


translateSlots() ​

translateSlots(palette, translation): object

Defined in: packages/prismarine/src/world/generators/datadriven/mergedChunk.ts:83

Looks up each merged palette entry in the table, slot by slot.

Parameters ​

palette ​

readonly RegionBlock[]

translation ​

PaletteTranslation

Returns ​

object

runtimeIds ​

readonly runtimeIds: Int32Array

waterSlots ​

readonly waterSlots: Uint8Array

Throws ​

RangeError when an entry is missing, which means the table was built from other blocks than the merge read: a chunk built with it would hold air where the block belongs.