QtCraft API C++ classes QML types Handbook

QcServerHoppers Class

The Signal Hoppers of the server (decision E-344), run at the end of the signal phase. More...

Header: #include <server/signal/QcServerHoppers.h>

Public Types

struct Stats

Public Functions

bool fillsCell(QcBlockId block) const
const QcServerHoppers::Stats &lastTick() const
void tick()

Static Public Members

const double bowlHeight
const int unloadedRetryTicks

Detailed Description

Only awake hoppers whose cooldown has ended and that no power locks act, in two simultaneous steps on the world as it is: first every hopper pushes one item from its first slot that fits into the container it faces, then every hopper pulls one item from the container above it or, when there is none and the block above does not fill its cell with collision, one item entity (as much of its stack as fits) lying in its bowl or the space above. A hopper that moved something rests for the cooldown; one that found nothing sleeps until a block next to it changes, a container next to it changes its contents or an item moves into its pickup area.

Member Function Documentation

bool QcServerHoppers::fillsCell(QcBlockId block) const

Returns whether the collision of block state block fills its whole cell (then no item lies in the space above a hopper under it, and it does not search).

const QcServerHoppers::Stats &QcServerHoppers::lastTick() const

Returns what the hoppers did in the latest tick.

void QcServerHoppers::tick()

Runs the hopper steps of one server tick.

Member Variable Documentation

const double QcServerHoppers::bowlHeight

The pickup area starts at the bottom of the bowl (in the hopper's cell) and covers the cell above.

const int QcServerHoppers::unloadedRetryTicks

A hopper next to an unloaded chunk looks again after this many ticks.