QtCraft API C++ classes QML types Handbook

QcBlockPos Struct

Integer position of a block in the world, in blocks (= metres). More...

Header: #include <common/core/QcBlockPos.h>

Public Functions

QcChunkPos chunk() const
bool isInsideWorldHeight() const
int localX() const
int localZ() const
QcBlockPos offset(int dx, int dy, int dz) const

Public Variables

int x
int y
int z
size_t qHash(QcBlockPos pos, size_t seed = 0)

Detailed Description

Member Function Documentation

QcChunkPos QcBlockPos::chunk() const

Returns the chunk column that holds the block.

bool QcBlockPos::isInsideWorldHeight() const

Returns whether y lies within the world's height (0..QcWorld::worldHeight - 1).

int QcBlockPos::localX() const

Returns x within the chunk (0..QcWorld::chunkSize - 1).

int QcBlockPos::localZ() const

Returns z within the chunk (0..QcWorld::chunkSize - 1).

QcBlockPos QcBlockPos::offset(int dx, int dy, int dz) const

Returns the position moved by dx, dy and dz.

Member Variable Documentation

int QcBlockPos::x

East (+) and west (-).

int QcBlockPos::y

Height.

int QcBlockPos::z

South (+) and north (-).

Related Non-Members

[noexcept] size_t qHash(QcBlockPos pos, size_t seed = 0)

Returns the hash of pos for QHash, mixed with seed.