[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/prismarine](https://jsprismarine.dev/api/@jsprismarine/prismarine/index.md) / world/generators/datadriven/javaStructureWorld

# world/generators/datadriven/javaStructureWorld

## Interfaces

### StructureLevel

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:21](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L21)

What laying a structure out needs to know about the world, before any chunk exists.

#### Properties

##### height

> `readonly` **height**: `number`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:25](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L25)

How many y levels the dimension generates.

##### minY

> `readonly` **minY**: `number`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:23](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L23)

The lowest y the dimension generates.

##### seaLevel

> `readonly` **seaLevel**: `number`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:26](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L26)

#### Methods

##### baseBlock()

> **baseBlock**(`x`, `y`, `z`): [`BlockState`](https://jsprismarine.dev/api/@jsprismarine/features/index.md#blockstate)

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:39](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L39)

Java's `ChunkGenerator.getBaseColumn`, read one block at a time.

###### Parameters

###### x

`number`

###### y

`number`

###### z

`number`

###### Returns

[`BlockState`](https://jsprismarine.dev/api/@jsprismarine/features/index.md#blockstate)

###### Java See

ChunkGenerator.getBaseColumn

##### baseHeight()

> **baseHeight**(`x`, `z`, `heightmap`): `number`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:33](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L33)

Java's `ChunkGenerator.getBaseHeight`: the first y above the topmost block of the bare
noise terrain that matches the heightmap, with nothing decorated and no surface rule run.

###### Parameters

###### x

`number`

###### z

`number`

###### heightmap

[`HeightmapType`](https://jsprismarine.dev/api/@jsprismarine/features/index.md#heightmaptype)

###### Returns

`number`

###### Java See

ChunkGenerator.getBaseHeight

##### coldEnoughToSnow()?

> `optional` **coldEnoughToSnow**(`x`, `y`, `z`): `boolean`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:52](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L52)

Java's `Biome.coldEnoughToSnow(pos)`, which the ruined portal reads to decide whether its
lava is lava. Optional, because it needs the biome registry rather than the noise; a level
that cannot answer is treated as warm, which is the common case.

###### Parameters

###### x

`number`

###### y

`number`

###### z

`number`

###### Returns

`boolean`

###### Java See

Biome.coldEnoughToSnow

##### noiseBiome()

> **noiseBiome**(`quartX`, `quartY`, `quartZ`): `string`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:44](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L44)

The biome source's own answer at a quart position, which is the 4-block cell Java stores
biomes in. The structure biome check reads this rather than the fuzzed per-block lookup.

###### Parameters

###### quartX

`number`

###### quartY

`number`

###### quartZ

`number`

###### Returns

`string`

***

### StructurePiece

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:120](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L120)

One part of a structure: a box and the blocks it writes inside it.

#### Properties

##### boundingBox

> `readonly` **boundingBox**: [`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:122](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L122)

Where the piece sits, which decides the chunks it is written into.

##### groundLevelDelta?

> `readonly` `optional` **groundLevelDelta?**: `number`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:129](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L129)

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

Only a jigsaw pool piece has one, and only the terrain adaptation reads it. Absent is 0,
which is what Java answers for every other kind of piece.

##### ignoresTerrainAdaptation?

> `readonly` `optional` **ignoresTerrainAdaptation?**: `boolean`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:136](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L136)

Whether the terrain adaptation leaves this piece alone.

Java beards only the `rigid` pool elements of a jigsaw structure, because a
`terrain_matching` one is already following the ground it stands on.

##### junctions?

> `readonly` `optional` **junctions?**: readonly [`JigsawJunction`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#jigsawjunction)[]

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:138](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L138)

The source positions Java's beardifier reads from this jigsaw piece's junctions.

#### Methods

##### place()

> **place**(`writer`, `random`): `void`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:149](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L149)

Writes the piece.

The executable piece is rebuilt on the destination worker from a cloneable layout plan.
Each destination chunk gives it a different writer and structure random, so neither belongs
in that plan.

###### Parameters

###### writer

[`StructureWriter`](#structurewriter)

###### random

[`RandomSource`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#randomsource)

The chunk's structure random, reseeded per chunk the way Java reseeds it,
  so a piece that spans two chunks draws two streams exactly as Java does.

###### Returns

`void`

***

### StructurePiecePlan

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:159](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L159)

Cloneable layout data for one piece; executable methods and destination state stay local.

#### Properties

##### data

> `readonly` **data**: `unknown`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:163](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L163)

Cloneable fields captured when the structure was laid out.

##### type

> `readonly` **type**: `string`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:161](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L161)

Stable codec name registered by the module that owns the piece class.

***

### StructurePieceTransferCodec

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:167](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L167)

How one structure piece class crosses a worker boundary: its type id, prototype, encoder and decoder.

#### Type Parameters

##### T

`T` *extends* [`StructurePiece`](#structurepiece)

#### Properties

##### decode

> `readonly` **decode**: (`data`, `context`) => `T`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:171](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L171)

###### Parameters

###### data

`unknown`

###### context

[`StructurePieceTransferContext`](#structurepiecetransfercontext)

###### Returns

`T`

##### encode

> `readonly` **encode**: (`piece`) => `unknown`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:170](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L170)

###### Parameters

###### piece

`T`

###### Returns

`unknown`

##### prototype

> `readonly` **prototype**: `object`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:169](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L169)

##### type

> `readonly` **type**: `string`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:168](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L168)

***

### StructurePieceTransferContext

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:153](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L153)

Worker-local resources needed to rebuild executable pieces from a shared layout plan.

#### Properties

##### templates

> `readonly` **templates**: [`StructureTemplateStore`](https://jsprismarine.dev/api/@jsprismarine/prismarine/world/generators/datadriven/javaStructureTemplatePiece/index.md#structuretemplatestore)

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:155](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L155)

A receiving worker's own template store.

***

### StructureWriter

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:56](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L56)

Where a piece writes the blocks it decided on. Writes outside the chunk are dropped.

#### Properties

##### chunkBox?

> `readonly` `optional` **chunkBox?**: [`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:70](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L70)

The box of the chunk being written, Java's `postProcess` chunk box. Absent in a test.

##### level

> `readonly` **level**: [`StructureLevel`](#structurelevel)

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:58](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L58)

The level the structure was laid out against, for a piece that settles as it writes.

##### regionRandom?

> `readonly` `optional` **regionRandom?**: [`RandomSource`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#randomsource)

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:68](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L68)

Java's `WorldGenRegion.getRandom`: the stream the chunk being decorated hands a piece
that asks its level for one, which a desert pyramid's cellar draws from. Absent in a test,
where a piece draws from its own random instead.

###### Java See

WorldGenRegion.getRandom

##### seed?

> `readonly` `optional` **seed?**: `bigint`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:60](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L60)

The world seed, which a `capped` processor forks its draws from. Absent in a test.

#### Methods

##### blockAt()

> **blockAt**(`x`, `y`, `z`): [`BlockState`](https://jsprismarine.dev/api/@jsprismarine/features/index.md#blockstate)

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:78](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L78)

The state already at a position.

###### Parameters

###### x

`number`

###### y

`number`

###### z

`number`

###### Returns

[`BlockState`](https://jsprismarine.dev/api/@jsprismarine/features/index.md#blockstate)

##### hasTag()

> **hasTag**(`identifier`, `tag`): `boolean`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:101](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L101)

Whether a block identifier is in a Java block tag.

###### Parameters

###### identifier

`string`

###### tag

`string`

###### Returns

`boolean`

##### heightAt()

> **heightAt**(`heightmap`, `x`, `z`): `number`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:99](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L99)

The current surface of a column, which is the chunk's heightmap inside it.

###### Parameters

###### heightmap

[`HeightmapType`](https://jsprismarine.dev/api/@jsprismarine/features/index.md#heightmaptype)

###### x

`number`

###### z

`number`

###### Returns

`number`

##### isFaceSturdy()?

> `optional` **isFaceSturdy**(`state`, `face`): `boolean`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:106](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L106)

Whether a state has a sturdy face toward a side, Java's `isFaceSturdy`, which a fence, a
pane or a wall reads to join it. Absent answers no face as sturdy.

###### Parameters

###### state

[`BlockState`](https://jsprismarine.dev/api/@jsprismarine/features/index.md#blockstate)

###### face

`"south"` \| `"west"` \| `"north"` \| `"east"` \| `"down"` \| `"up"`

###### Returns

`boolean`

##### placeFeature()?

> `optional` **placeFeature**(`feature`, `x`, `y`, `z`): `boolean`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:116](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L116)

Runs a placed feature from a position, the way a jigsaw feature element grows a village's
trees and hay bales. The feature writes where any feature may, which reaches past the
chunk the piece is placed in.

Absent from a writer that has no features to run, such as a test's.

###### Parameters

###### feature

`PlacedFeatureReference`

###### x

`number`

###### y

`number`

###### z

`number`

###### Returns

`boolean`

Whether the feature placed anything.

##### setBedrockBlock()

> **setBedrockBlock**(`x`, `y`, `z`, `state`, `waterlogged?`): `boolean`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:87](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L87)

Writes a Bedrock state, which is what a structure template resolves to.

###### Parameters

###### x

`number`

###### y

`number`

###### z

`number`

###### state

[`BedrockBlockState`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#bedrockblockstate)

###### waterlogged?

`boolean`

Whether the block holds water, which Bedrock keeps on its second layer
  and Java in the block's `waterlogged` property. Ignored for a block that cannot hold it.

###### Returns

`boolean`

##### setBlock()

> **setBlock**(`x`, `y`, `z`, `state`): `boolean`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:80](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L80)

Writes a Java state. Returns whether it landed.

###### Parameters

###### x

`number`

###### y

`number`

###### z

`number`

###### state

[`BlockState`](https://jsprismarine.dev/api/@jsprismarine/features/index.md#blockstate)

###### Returns

`boolean`

##### setBlockEntity()

> **setBlockEntity**(`x`, `y`, `z`, `request`): `void`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:89](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L89)

Attaches block entity data to the block at a position.

###### Parameters

###### x

`number`

###### y

`number`

###### z

`number`

###### request

[`BlockEntityRequest`](https://jsprismarine.dev/api/@jsprismarine/features/index.md#blockentityrequest)

###### Returns

`void`

##### spawnEntity()

> **spawnEntity**(`type`, `x`, `y`, `z`, `yaw`): `void`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:97](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L97)

Records an entity a piece builds around, such as an igloo's villager.

The position is the entity's own, not the block's: a mob stands in the middle of its
block and a structure template saves fractional coordinates, so a caller naming a block
passes its center.

###### Parameters

###### type

`string`

###### x

`number`

###### y

`number`

###### z

`number`

###### yaw

`number`

###### Returns

`void`

##### widened()?

> `optional` **widened**(`box`): [`StructureWriter`](#structurewriter)

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:76](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L76)

A writer whose writes reach a box as well as the chunk, Java's `chunkBB.encapsulate`,
for a piece that places itself whole from one chunk as a ruined portal does. A box past
the chunks around this one still drops what lands outside them.

###### Parameters

###### box

[`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)

###### Returns

[`StructureWriter`](#structurewriter)

## Variables

### EMPTY\_BOX

> `const` **EMPTY\_BOX**: [`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:294](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L294)

A box holding nothing, which an empty piece list collapses to.

## Functions

### boxCenter()

> **boxCenter**(`box`): readonly \[`number`, `number`, `number`\]

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:343](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L343)

Java's `BoundingBox.getCenter`: the block half way along each axis, rounded up from the middle
of an even span.

#### Parameters

##### box

[`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)

#### Returns

readonly \[`number`, `number`, `number`\]

#### Java Source

BoundingBox.getCenter

***

### boxContains()

> **boxContains**(`box`, `x`, `y`, `z`): `boolean`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:367](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L367)

Whether a position sits inside an inclusive box.

#### Parameters

##### box

[`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)

##### x

`number`

##### y

`number`

##### z

`number`

#### Returns

`boolean`

***

### boxFromSize()

> **boxFromSize**(`x`, `y`, `z`, `sizeX`, `sizeY`, `sizeZ`): [`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:350](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L350)

A box from a corner and an extent.

#### Parameters

##### x

`number`

##### y

`number`

##### z

`number`

##### sizeX

`number`

##### sizeY

`number`

##### sizeZ

`number`

#### Returns

[`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)

***

### boxTouchesChunk()

> **boxTouchesChunk**(`box`, `chunkX`, `chunkZ`): `boolean`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:324](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L324)

Whether a box covers any block of a chunk, ignoring y.

#### Parameters

##### box

[`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)

##### chunkX

`number`

##### chunkZ

`number`

#### Returns

`boolean`

***

### firstOccupiedHeight()

> **firstOccupiedHeight**(`level`, `x`, `z`, `heightmap`): `number`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:290](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L290)

Java's `ChunkGenerator.getFirstOccupiedHeight`: the topmost block a heightmap stops above, one
below [StructureLevel.baseHeight](#baseheight). A structure that stands on the chunk's middle takes
its generation point here, which is where its biome is read.

#### Parameters

##### level

[`StructureLevel`](#structurelevel)

##### x

`number`

##### z

`number`

##### heightmap

[`HeightmapType`](https://jsprismarine.dev/api/@jsprismarine/features/index.md#heightmaptype)

#### Returns

`number`

#### Java Source

ChunkGenerator.getFirstOccupiedHeight

***

### freezeStructurePlanData()

> **freezeStructurePlanData**(`value`): `void`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:188](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L188)

Freezes cloneable plan records so the broker cannot accidentally cache placement mutations.

#### Parameters

##### value

`unknown`

The cloneable plan value to freeze recursively.

#### Returns

`void`

***

### inflated()

> **inflated**(`box`, `amount`): [`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:328](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L328)

A box grown outward by the same amount on every horizontal side.

#### Parameters

##### box

[`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)

##### amount

`number`

#### Returns

[`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)

***

### movedBox()

> **movedBox**(`box`, `dx`, `dy`, `dz`): [`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:371](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L371)

A box moved by a delta.

#### Parameters

##### box

[`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)

##### dx

`number`

##### dy

`number`

##### dz

`number`

#### Returns

[`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)

***

### registerStructurePieceFieldsCodec()

> **registerStructurePieceFieldsCodec**\<`T`\>(`type`, `prototype`): `void`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:232](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L232)

Registers the codec used by pieces whose own fields are all cloneable layout data.

#### Type Parameters

##### T

`T` *extends* [`StructurePiece`](#structurepiece)

#### Parameters

##### type

`string`

Stable piece codec name.

##### prototype

`object`

Exact runtime prototype used to select the codec.

#### Returns

`void`

***

### registerStructurePieceTransferCodec()

> **registerStructurePieceTransferCodec**\<`T`\>(`codec`): `void`

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:208](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L208)

Registers the data codec for one piece implementation.

Each worker has its own class prototype and template store. Only encoded fields cross the
boundary, then the receiver rebuilds a local piece that gets its writer and random stream only
when [StructurePiece.place](#place) runs for a destination chunk.

#### Type Parameters

##### T

`T` *extends* [`StructurePiece`](#structurepiece)

#### Parameters

##### codec

[`StructurePieceTransferCodec`](#structurepiecetransfercodec)\<`T`\>

The stable type, exact prototype, and plain-data encoder and decoder.

#### Returns

`void`

***

### structurePieceFromPlan()

> **structurePieceFromPlan**(`plan`, `context`): [`StructurePiece`](#structurepiece)

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:274](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L274)

Rebuilds a piece with the receiving worker's class code and world-local template store.

#### Parameters

##### plan

[`StructurePiecePlan`](#structurepieceplan)

The cloneable layout data for the piece.

##### context

[`StructurePieceTransferContext`](#structurepiecetransfercontext)

Worker-local resources needed by the piece.

#### Returns

[`StructurePiece`](#structurepiece)

An executable piece with no destination writer or random stream attached.

***

### structurePiecePlanOf()

> **structurePiecePlanOf**(`piece`): [`StructurePiecePlan`](#structurepieceplan)

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:255](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L255)

Copies one executable piece into its immutable, structured-clone-safe layout form.

#### Parameters

##### piece

[`StructurePiece`](#structurepiece)

The piece built during structure layout.

#### Returns

[`StructurePiecePlan`](#structurepieceplan)

A cloneable plan that contains no writer or random state.

***

### unionOf()

> **unionOf**(`pieces`): [`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)

Defined in: [packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts:304](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/generators/datadriven/javaStructureWorld.ts#L304)

The smallest box holding every piece, or [EMPTY\_BOX](#empty-box) for no pieces.

#### Parameters

##### pieces

readonly [`StructurePiece`](#structurepiece)[]

#### Returns

[`BoundingBox`](https://jsprismarine.dev/api/@jsprismarine/structures/index.md#boundingbox)
