QtCraft API C++ classes QML types Handbook

QcChunkLoading Class

Which chunks the server keeps loaded and how they come and go (decisions E-374 to E-377). More...

Header: #include <server/chunks/QcChunkLoading.h>

Public Types

struct Numbers

Public Functions

void admitArrivals()
void beginTick()
QList<QcChunkIo::Departure> departuresForSave()
QcChunkGroups::Group groupOf(QcChunkPos pos) const
void loadGroupNow(QcChunkPos pos)
void loadStraysNow()
QSet<QcChunkPos> neededChunks() const
void noteSimulated()
QcChunkLoading::Numbers numbers() const
void request(QcChunkPos pos)
void requestStrays(const QSet<QcChunkPos> &strays)
const QcChunkTickets &tickets() const
void unloadUnneeded()
quint64 upcomingTick() const
void updateTickets()

Detailed Description

Needed are the chunks around the players (their view and what was sent to them), forced chunks (/forceload), the spawn chunks (game rule spawnChunkRadius), the chunks of chunk loader blocks and those with a load ticket of the circuits. Chunks come in whole groups (QcChunkGroups): an arrived chunk waits until every chunk of its group has arrived, then all enter the world in the same tick. A group leaves the world when none of its chunks is needed any more: everything attached to its chunks (block entities, scheduled ticks, the circuits' and hoppers' work, pending block updates and planned flow steps, burning fires, entities and whether the chunk got its animals) is taken out and handed to the storage with the blocks if they changed (QcChunkIo), and comes back when the chunk is read again.

Member Function Documentation

void QcChunkLoading::admitArrivals()

Lets the chunks that arrived in the background into the world, whole groups at a time.

void QcChunkLoading::beginTick()

QcServer: a tick started (after the clock advanced).

QList<QcChunkIo::Departure> QcChunkLoading::departuresForSave()

Returns what a save keeps of every loaded chunk (blocks only of changed ones; they count as unchanged then). The caller hands it to QcChunkIo::save.

QcChunkGroups::Group QcChunkLoading::groupOf(QcChunkPos pos) const

Returns the group of the loaded chunk pos as it is now (debug display).

void QcChunkLoading::loadGroupNow(QcChunkPos pos)

Loads the chunk pos and the chunks of its group now (QcServerWorld::loadChunk).

void QcChunkLoading::loadStraysNow()

Loads the chunks of stray entities now, so a save sees every entity in a loaded chunk.

QSet<QcChunkPos> QcChunkLoading::neededChunks() const

Returns the chunks needed now (see the class).

void QcChunkLoading::noteSimulated()

QcServer: the tick simulated.

QcChunkLoading::Numbers QcChunkLoading::numbers() const

Returns the numbers as they are now.

void QcChunkLoading::request(QcChunkPos pos)

Starts loading the chunk pos and the chunks of its group (background; streaming, tickets).

void QcChunkLoading::requestStrays(const QSet<QcChunkPos> &strays)

Loads the chunks of entities that are in no loaded chunk (strays, from QcEntities::settle).

const QcChunkTickets &QcChunkLoading::tickets() const

Returns the load tickets of the circuits.

void QcChunkLoading::unloadUnneeded()

Takes the groups no one needs out of the world (end of a tick).

quint64 QcChunkLoading::upcomingTick() const

Returns the tick of the next simulation step: the current one from its start until it has simulated, the next one after that and between ticks. What a chunk keeps is counted from it, so a chunk that leaves after a tick and comes back before one goes on with exactly the tick that follows (decision E-374).

void QcChunkLoading::updateTickets()

Asks the circuits' waiting chunks for load tickets and lets tickets run out (once per tick).