Skip to content

API reference / @jsprismarine/chunkgen / ChunkStep

Class: ChunkStep ​

Defined in: ChunkStep.ts:80

One rung of the pyramid: what the status may read, and how far it may write blocks.

Constructors ​

Constructor ​

new ChunkStep(targetStatus, directDependencies, accumulatedDependencies, blockStateWriteRadius): ChunkStep

Defined in: ChunkStep.ts:81

Parameters ​

targetStatus ​

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

The status a chunk reaches once this step has run.

directDependencies ​

ChunkDependencies

What the running body may read, enforced by ChunkStep.requireReadable.

accumulatedDependencies ​

ChunkDependencies

The transitive closure, which is what the scheduler sizes each layer from.

blockStateWriteRadius ​

number

How far from its own chunk the step may write blocks, in chunks.

-1 for every step but two, and -1 excludes even the chunk itself, so those steps cannot write a block through the region at all. terrain is 0 and features is 1.

Returns ​

ChunkStep

Properties ​

accumulatedDependencies ​

readonly accumulatedDependencies: ChunkDependencies

Defined in: ChunkStep.ts:87

The transitive closure, which is what the scheduler sizes each layer from.


blockStateWriteRadius ​

readonly blockStateWriteRadius: number

Defined in: ChunkStep.ts:94

How far from its own chunk the step may write blocks, in chunks.

-1 for every step but two, and -1 excludes even the chunk itself, so those steps cannot write a block through the region at all. terrain is 0 and features is 1.


directDependencies ​

readonly directDependencies: ChunkDependencies

Defined in: ChunkStep.ts:85

What the running body may read, enforced by ChunkStep.requireReadable.


targetStatus ​

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

Defined in: ChunkStep.ts:83

The status a chunk reaches once this step has run.

Methods ​

accumulatedRadiusOf() ​

accumulatedRadiusOf(status): number

Defined in: ChunkStep.ts:121

How wide a scheduler layer is when it brings a neighborhood to status for this target.

Java's ChunkStep.getAccumulatedRadiusOf, which answers 0 for the target status itself rather than asking the accumulated dependencies. A step never lists its own status among its dependencies, so the plain lookup reads -1 there and the last layer would run on nothing.

Parameters ​

status ​

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

Returns ​

number

The radius in chunks, or -1 when the target does not depend on that status at all.


canWriteBlocksAt() ​

canWriteBlocksAt(dx, dz): boolean

Defined in: ChunkStep.ts:103

Whether the step may write blocks into the chunk at this offset from its own.

Java's WorldGenRegion.isWithinWriteZone. At the default radius of -1 this is false everywhere, including (0, 0).

Parameters ​

dx ​

number

dz ​

number

Returns ​

boolean


readableStatusAt() ​

readableStatusAt(dx, dz): "empty" | "structure_starts" | "structure_references" | "biomes" | "terrain" | "features" | "initialize_light" | "light" | "spawn" | "full" | undefined

Defined in: ChunkStep.ts:108

The highest status the chunk at this offset holds, or undefined when it is out of the window.

Parameters ​

dx ​

number

dz ​

number

Returns ​

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


requireReadable() ​

requireReadable(dx, dz, requested): "empty" | "structure_starts" | "structure_references" | "biomes" | "terrain" | "features" | "initialize_light" | "light" | "spawn" | "full"

Defined in: ChunkStep.ts:135

Checks a read against the declared window and returns the status that read is good for.

Parameters ​

dx ​

number

Chunk offset on x from the chunk this step is running on.

dz ​

number

Chunk offset on z from the chunk this step is running on.

requested ​

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

The status the body needs that neighbor to have reached.

Returns ​

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

The status that neighbor is guaranteed to be at, which is at or above requested.

Throws ​

ChunkReadOutOfWindowError when the offset is outside the window, or when the requested status is above what the window guarantees at that distance.