Skip to content

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

world/generators/datadriven/javaStructureBeard ​

Interfaces ​

BeardPiece ​

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureBeard.ts:22

One structure piece the terrain is adapted around.

Properties ​

adaptation ​

readonly adaptation: TerrainAdaptation

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureBeard.ts:26

box ​

readonly box: BoundingBox

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureBeard.ts:23

groundLevelDelta ​

readonly groundLevelDelta: number

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureBeard.ts:25

How far above the piece's floor its ground sits, Java's getGroundLevelDelta.


Beardifier ​

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureBeard.ts:266

What createBeardifier builds for one chunk.

Properties ​

reaches ​

readonly reaches: (minX, maxX, minZ, maxZ) => boolean

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureBeard.ts:274

Whether any piece or junction reaches a block in these columns. Where none does, Beardifier.sampler is exactly 0 at every height, so the terrain there is the terrain of a chunk no structure reaches. Install as SampleContext.beardifierReaches.

Parameters ​
minX ​

number

maxX ​

number

minZ ​

number

maxZ ​

number

Returns ​

boolean

sampler ​

readonly sampler: DensitySampler

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureBeard.ts:268

The density contribution, to install as SampleContext.beardifier.

Type Aliases ​

BeardJunction ​

BeardJunction = JigsawJunction

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureBeard.ts:30

A jigsaw junction Java includes as a smaller beard contribution.


TerrainAdaptation ​

TerrainAdaptation = "none" | "bury" | "beard_thin" | "beard_box" | "encapsulate"

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureBeard.ts:19

The four terrain_adaptation values Java registers, plus the none every other structure has.

Variables ​

BEARD_RADIUS ​

const BEARD_RADIUS: 12 = 12

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

How far from a piece the adaptation reaches.

Functions ​

createBeardifier() ​

createBeardifier(pieces, junctions?): Beardifier | undefined

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureBeard.ts:202

Builds the density contribution for the pieces near one chunk.

This sampler is the right operand of the top-level add in the overworld's final_density, so it runs on all 98304 samples of a chunk and its per-sample cost is multiplied by that. The pieces are therefore indexed by column: every adaptation's contribution is exactly zero once the column is more than BEARD_RADIUS from the piece's box in x or in z, so a sample only has to visit the pieces whose reach covers its own bucket. The index preserves the order the pieces were given in, because the sum of several float contributions depends on it.

Parameters ​

pieces ​

readonly BeardPiece[]

Every piece whose box comes within BEARD_RADIUS of the chunk. Pieces further away contribute nothing, so filtering before building this is what keeps the per block cost proportional to what is actually nearby.

junctions? ​

readonly JigsawJunction[] = []

Junction source positions in Java's structure-piece and connection order.

Returns ​

Beardifier | undefined

The sampler and its reach, or undefined when no structure reaches the chunk, which is the common case and the one worth not paying for.


fastInverseSqrt() ​

fastInverseSqrt(value): number

Defined in: packages/prismarine/src/world/generators/datadriven/javaStructureBeard.ts:53

Java's Mth.fastInvSqrt: the Quake trick with one Newton step.

Reproduced rather than replaced by 1 / Math.sqrt(x) because its answer is about four decimal digits accurate, and the kernel it builds decides where the terrain under a village ends up.

Parameters ​

value ​

number

Returns ​

number

Java Source ​

Mth.fastInvSqrt


terrainAdaptationOf() ​

terrainAdaptationOf(value): TerrainAdaptation

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

The adaptation a worldgen/structure document asks for.

Parameters ​

value ​

unknown

Returns ​

TerrainAdaptation