QtCraft API C++ classes QML types Handbook

QcPrecipitationTable Class

Which block states keep rain and snow out of the cells below them (decision E-395): those that keep sky light coming straight down out (QcLightPassage::skyStop: opaque blocks, leaves, covered tops), solid blocks with a collision shape (glass, fences, slabs) and liquids. More...

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

Public Functions

QcPrecipitationTable()
bool stops(QcBlockId id) const
int top(const QcChunk &chunk, int lx, int lz) const

Detailed Description

Torches, flowers, tall grass and other blocks without collision let it through. The server and the client read the same table, so rain falls in the same places for both. Immutable after construction.

Member Function Documentation

[constexpr noexcept default] QcPrecipitationTable::QcPrecipitationTable()

Without content every id reads as air.

bool QcPrecipitationTable::stops(QcBlockId id) const

Returns whether the block state id stops precipitation; unknown ids read as air.

int QcPrecipitationTable::top(const QcChunk &chunk, int lx, int lz) const

Returns the highest cell of the column (lx, lz) of chunk that stops precipitation; -1 for none.