Skip to content

API reference / @jsprismarine/chunkgen / InboundFeaturePatches

Class: InboundFeaturePatches<TPatch> ​

Defined in: FeaturePatch.ts:84

The feature writes a chunk's eight neighbors owe it, kept until the chunk is finished.

This is the half of the patch merge that decides the answer, and the only thing it decides is order. A feature pass that reaches across a border records what it wrote rather than writing it, and the patch waits here until the target chunk is promoted. The target then applies its own post-features state first and these eight after it, in FEATURE_PATCH_ORDER, which is what makes a tree rooted in one chunk come out whole in the next.

Storing by source offset rather than appending to a list is the mechanism, not an implementation detail. A list would record arrival order, and arrival order is what the scheduler chooses.

Type Parameters ​

TPatch ​

TPatch

What a patch is, which this class never looks inside. The server's patch carries Java block states with properties; a worker's would carry palette indices.

Constructors ​

Constructor ​

new InboundFeaturePatches<TPatch>(): InboundFeaturePatches<TPatch>

Returns ​

InboundFeaturePatches<TPatch>

Accessors ​

size ​

Get Signature ​

get size(): number

Defined in: FeaturePatch.ts:88

How many of the eight neighbors have handed theirs over.

Returns ​

number

Methods ​

has() ​

has(dx, dz): boolean

Defined in: FeaturePatch.ts:93

Whether a neighbor at this offset has handed one over.

Parameters ​

dx ​

number

dz ​

number

Returns ​

boolean


inMergeOrder() ​

inMergeOrder(): readonly TPatch[]

Defined in: FeaturePatch.ts:119

The patches to apply, in FEATURE_PATCH_ORDER.

Returns ​

readonly TPatch[]

One entry per neighbor that wrote something, skipping those that wrote nothing. The order is positional, so it is the same list whatever order the patches arrived in.


receive() ​

receive(dx, dz, patch): void

Defined in: FeaturePatch.ts:106

Takes the patch a neighbor's feature pass wrote into this chunk.

Parameters ​

dx ​

number

Chunk offset on x from this chunk to the neighbor that wrote it.

dz ​

number

Chunk offset on z.

patch ​

TPatch

Returns ​

void

Throws ​

FeaturePatchOutOfRangeError when the offset is not one of the eight neighbors.

Throws ​

DuplicateFeaturePatchError when that neighbor already handed one over, which means its features body ran twice.