QtCraft API C++ classes QML types Handbook

QcChunk Class

Column of QcWorld::sectionCount sections at one chunk position. More...

Header: #include <common/world/QcChunk.h>

Public Functions

QcBlockId block(int x, int y, int z) const
int highestNonAir(int x, int z) const
QcChunkPos pos() const
QcChunkSection &section(int index)
const QcChunkSection &section(int index) const
void setBlock(int x, int y, int z, QcBlockId block)

Detailed Description

Member Function Documentation

QcBlockId QcChunk::block(int x, int y, int z) const

Returns the block at local x and z in [0, chunkSize) and y in [0, worldHeight). Outside the height range reads air.

See also setBlock().

int QcChunk::highestNonAir(int x, int z) const

Returns the highest y whose block is not air, or -1 for an empty column at (x, z).

QcChunkPos QcChunk::pos() const

Returns the chunk's position.

QcChunkSection &QcChunk::section(int index)

Returns section index (0 at the bottom) to change it.

const QcChunkSection &QcChunk::section(int index) const

Returns section index (0 at the bottom).

void QcChunk::setBlock(int x, int y, int z, QcBlockId block)

Sets the block at local x, y and z to block.

See also block().