QtCraft API C++ classes QML types Handbook

QcBlockAccess Class

Read access to blocks, implemented by the server world and the client world mirror. More...

Header: #include <common/world/QcBlockAccess.h>
Inherited By:

QcClientWorld and QcServerWorld

Public Functions

virtual ~QcBlockAccess()
virtual std::optional<QcBlockId> blockAt(QcBlockPos pos) const = 0
virtual const QcContentRegistry &content() const = 0
virtual bool mayHaveLightSourceNear(QcBlockPos pos, int reach) const

Detailed Description

Member Function Documentation

[virtual constexpr noexcept default] QcBlockAccess::~QcBlockAccess()

Destroys the instance of QcBlockAccess. This destructor is virtual.

[pure virtual] std::optional<QcBlockId> QcBlockAccess::blockAt(QcBlockPos pos) const

Returns the block state at pos; std::nullopt when the chunk is not loaded. Positions above the world read air.

[pure virtual] const QcContentRegistry &QcBlockAccess::content() const

Returns the content the block ids refer to.

[virtual] bool QcBlockAccess::mayHaveLightSourceNear(QcBlockPos pos, int reach) const

Returns whether a block light source may lie within reach blocks of pos; worlds with chunk palettes answer cheaply, the default always says yes.