API reference / @jsprismarine/worldgen / BlockArraySurfaceChunk
Class: BlockArraySurfaceChunk
Defined in: surface/SurfaceChunk.ts:53
A chunk held as 256 arrays of block state identifiers.
It takes a copy of the terrain the chunk sampler produced and computes the surface heightmap once, which is what the surface pass needs and all it needs. Java recomputes the heightmap as blocks are written; the surface pass does not, because the pass runs after the heightmap is primed and before anything else touches it.
Implements
Constructors
Constructor
new BlockArraySurfaceChunk(
options):BlockArraySurfaceChunk
Defined in: surface/SurfaceChunk.ts:66
Parameters
options
Returns
BlockArraySurfaceChunk
Properties
chunkX
readonlychunkX:number
Defined in: surface/SurfaceChunk.ts:55
The chunk x coordinate, in chunks.
Implementation of
chunkZ
readonlychunkZ:number
Defined in: surface/SurfaceChunk.ts:57
The chunk z coordinate, in chunks.
Implementation of
maxY
readonlymaxY:number
Defined in: surface/SurfaceChunk.ts:61
The highest y the chunk holds.
Implementation of
minY
readonlyminY:number
Defined in: surface/SurfaceChunk.ts:59
The lowest y the chunk holds.
Implementation of
Methods
getBlock()
getBlock(
x,y,z):string
Defined in: surface/SurfaceChunk.ts:94
The Java block state identifier at a block position, minecraft:air where empty.
Parameters
x
number
y
number
z
number
Returns
string
Implementation of
setBlock()
setBlock(
x,y,z,state):void
Defined in: surface/SurfaceChunk.ts:100
Writes a block state; a y outside the chunk is ignored, as it is in Java.
Parameters
x
number
y
number
z
number
state
string
Returns
void
Implementation of
surfaceHeight()
surfaceHeight(
localX,localZ):number
Defined in: surface/SurfaceChunk.ts:106
The y of the highest block in a column that is not air, or minY - 1 when the column is empty. This is Java's WORLD_SURFACE_WG heightmap, frozen at the end of the terrain fill.
Parameters
localX
number
localZ
number
Returns
number