types.Chunk
The chunk being generated: 16 by 16 columns from minY up to maxY. Positions are local, x and z 0-15, y in world blocks. It is all air until written, and stale once generate returns.
Fields
Methods
chunk:carve(cells: buffer, fromY: number, toY: number, threshold: number, block: number?)Turns every cell above threshold into block (default air), from fromY up to toY. cells holds 256 * (toY - fromY) f32s laid out as Noise:density and gen.interpolate write them.
chunk:column(x: number, z: number, fromY: number, toY: number, block: number)Fills one column from fromY up to, not including, toY.
Range: x: 0..15, z: 0..15
chunk:columns(records: buffer, count: number)Writes count column runs from records, five i32s each: x, z, fromY, toY, block. The fastest way to lay terrain: build every run in Luau, then make one call.
Range: count: 0..65536
chunk:fill(fromY: number, toY: number, block: number)Fills every column from fromY up to, not including, toY. Whole 16-block sections are the cheapest writes there are.
chunk:get(x: number, y: number, z: number) -> numberThe block at a position in this chunk, as a number; air outside the world's height.
Range: x: 0..15, z: 0..15
A random stream of its own for this chunk and salt: the same world seed and chunk give the same numbers.
chunk:set(x: number, y: number, z: number, block: number)Sets one block. x and z from -32 to 47 reach into the neighbouring chunks, which get the block when they generate, or now if they already have; use it for trees and structures that cross the edge. Outside the world's height it does nothing.
Range: x: -32..47, z: -32..47