Skip to content

API reference / @jsprismarine/chunkgen / StepRegion

Class: StepRegion<TChunk> ​

Defined in: StepTasks.ts:26

What one status body is handed: its own chunk, and the neighbors its step declared.

This is Java's WorldGenRegion, narrowed to the part that makes the output reproducible. Every neighbor read goes through StepRegion.neighbor, which checks the offset and the status against the step table and throws rather than returning a chunk at the wrong status. An input the step did not declare is therefore a crash on the first chunk instead of a block that differs on the thousandth.

Type Parameters ​

TChunk ​

TChunk extends StagedChunk

Constructors ​

Constructor ​

new StepRegion<TChunk>(step, center, read): StepRegion<TChunk>

Defined in: StepTasks.ts:32

Parameters ​

step ​

ChunkStep

The rung being climbed, which carries the read window and the write radius.

center ​

TChunk

The chunk the body is advancing, at the status below.

read ​

NeighborReader<TChunk>

Fetches a neighbor, called only after the window check has passed.

Returns ​

StepRegion<TChunk>

Properties ​

center ​

readonly center: TChunk

Defined in: StepTasks.ts:34

The chunk the body is advancing, at the status below.


step ​

readonly step: ChunkStep

Defined in: StepTasks.ts:33

The rung being climbed, which carries the read window and the write radius.

Accessors ​

chunkX ​

Get Signature ​

get chunkX(): number

Defined in: StepTasks.ts:39

Chunk x coordinate of the chunk being advanced.

Returns ​

number


chunkZ ​

Get Signature ​

get chunkZ(): number

Defined in: StepTasks.ts:44

Chunk z coordinate of the chunk being advanced.

Returns ​

number

Methods ​

canWriteBlocksAt() ​

canWriteBlocksAt(dx, dz): boolean

Defined in: StepTasks.ts:63

Whether this step may write blocks into the chunk at that offset.

Parameters ​

dx ​

number

dz ​

number

Returns ​

boolean


neighbor() ​

neighbor(dx, dz, status): TChunk

Defined in: StepTasks.ts:56

A neighbor at a chunk offset, at or above the status the body needs.

Parameters ​

dx ​

number

Chunk offset on x from the chunk being advanced.

dz ​

number

Chunk offset on z from the chunk being advanced.

status ​

"empty" | "structure_starts" | "structure_references" | "biomes" | "terrain" | "features" | "initialize_light" | "light" | "spawn" | "full"

The status the body needs that neighbor to have reached.

Returns ​

TChunk

Throws ​

ChunkReadOutOfWindowError when the step did not declare that status at that distance.