QcBlockUpdateQueue Class
Pending neighbour updates (connections, lost support, liquid flow) of the server, in a queue of player actions and a queue of commands and their cascades. More...
| Header: | #include <server/blocks/QcBlockUpdateQueue.h> |
Public Types
| struct | Update |
Public Functions
| bool | commandMode() const |
| QList<QcBlockPos> | commandUpdates() const |
| quint64 | droppedCount() const |
| void | forgetChunk(QcChunkPos chunk) |
| void | handleLoadedChunks() |
| qsizetype | pendingCommandCount() const |
| qsizetype | pendingCount() const |
| qsizetype | pendingPlayerCount() const |
| QList<QcBlockPos> | playerUpdates() const |
| quint64 | processedCount() const |
| void | queue(QcBlockPos pos) |
| void | queueNeighbours(QcBlockPos pos, bool self) |
| void | setCommandMode(bool on) |
| QHash<QcChunkPos, QList<QcBlockPos>> | takeChunks(const QSet<QcChunkPos> &chunks) |
| std::optional<QcBlockUpdateQueue::Update> | takeNext() |
| void | waitForChunk(QcChunkPos chunk, QcBlockPos pos) |
| qsizetype | waitingCount() const |
| QList<QcBlockPos> | waitingUpdates() const |
Static Public Members
| const qsizetype | maxWaitingBlockUpdates |
Detailed Description
Updates of positions in chunks that are not loaded wait for the chunk.
Member Function Documentation
bool QcBlockUpdateQueue::commandMode() const
Returns whether new updates go to the command queue (a command runs or a command update cascades).
See also setCommandMode().
QList<QcBlockPos> QcBlockUpdateQueue::commandUpdates() const
Returns the pending updates of commands in order.
quint64 QcBlockUpdateQueue::droppedCount() const
Returns the waiting updates dropped beyond maxWaitingBlockUpdates.
void QcBlockUpdateQueue::forgetChunk(QcChunkPos chunk)
Drops every pending and waiting update inside chunk (it was generated again).
void QcBlockUpdateQueue::handleLoadedChunks()
Re-queues waiting updates of chunks that loaded since the last tick and the blocks along their borders that connect or hang across them.
qsizetype QcBlockUpdateQueue::pendingCommandCount() const
Returns the number of pending updates of commands.
qsizetype QcBlockUpdateQueue::pendingCount() const
Returns the number of updates of loaded chunks waiting for the next ticks, of player actions and of commands.
qsizetype QcBlockUpdateQueue::pendingPlayerCount() const
Returns the number of pending updates of player actions.
QList<QcBlockPos> QcBlockUpdateQueue::playerUpdates() const
Returns the pending updates of player actions in order.
quint64 QcBlockUpdateQueue::processedCount() const
Returns the updates processed since the server started.
void QcBlockUpdateQueue::queue(QcBlockPos pos)
Queues an update of pos.
void QcBlockUpdateQueue::queueNeighbours(QcBlockPos pos, bool self)
Queues pos itself (unless self is false) and its six neighbours.
void QcBlockUpdateQueue::setCommandMode(bool on)
Sets command mode on or off.
See also commandMode().
QHash<QcChunkPos, QList<QcBlockPos>> QcBlockUpdateQueue::takeChunks(const QSet<QcChunkPos> &chunks)
Returns every pending and waiting update inside chunks by chunk and takes them out (they leave the world, decision E-374); they come back with their chunk.
std::optional<QcBlockUpdateQueue::Update> QcBlockUpdateQueue::takeNext()
Returns the next update to process, those of player actions first; counts it as processed.
void QcBlockUpdateQueue::waitForChunk(QcChunkPos chunk, QcBlockPos pos)
Remembers an update of pos until chunk loads.
qsizetype QcBlockUpdateQueue::waitingCount() const
Returns the number of updates waiting for their chunk.
QList<QcBlockPos> QcBlockUpdateQueue::waitingUpdates() const
Returns the updates waiting for their chunk to load.
Member Variable Documentation
const qsizetype QcBlockUpdateQueue::maxWaitingBlockUpdates
Updates waiting for their chunk to load at most; loading a chunk also re-checks every block on its borders that connects or hangs across them, so dropping beyond this loses nothing. Updates waiting for unloaded chunks by default (QcServerLimits::waitingBlockUpdates).