Guide 1 Docs 2 Reference 3
7

Chunk type

A 16 by 16 column of blocks, handed to world.on_generate, world.on_populate and a room's generate to fill.

Functions 7

chunk:get(pos: Vec3) → string

Chunk X coordinate (16 blocks each). Chunk Z coordinate (16 blocks each). The chunk's lowest corner, inclusive; y runs 0..255 or the game version's height. The chunk's highest corner, inclusive. Returns the block there now, by name; air outside the chunk.

chunk:set(pos: Vec3, block: string)

Sets one block; positions outside the chunk are ignored.

chunk:fill(from: Vec3, to: Vec3, block: string)

Fills a box of blocks, clipped to the chunk.

chunk:paste(schem: Schematic, origin: Vec3, opts: { air: boolean?, part: string? }?)

Clipped to this chunk; air is skipped unless air is true. part names the paste for citadel render --part and citadel check; the build's own b:parts are then inside it ("house/roof").

chunk:get_biome(pos: Vec3) → string?

Returns the biome of the column at pos, by name; nil outside the chunk. A biome belongs to a column, so pos.y is not read.

chunk:set_biome(pos: Vec3, biome: string)

Sets the biome of one column: a vanilla name ("desert") or the name game.biomes.define returned.

chunk:fill_biome(from: Vec3, to: Vec3, biome: string)

Sets the biome of every column in a box, clipped to the chunk.