QtCraft API C++ classes QML types Handbook

QcBlockEntityRecords Namespace

Turns the block entities of a running world into the records saved per chunk and back (decision E-358): ticks become ticks left (or since) at now and absolute ticks again when read. More...

Header: #include <server/storage/QcBlockEntityRecords.h>

Functions

QStringList apply(const QList<QcBlockEntityRecord> &records, QcBlockEntities &entities, QcCircuitState &circuits, QcHopperQueue &hoppers, quint64 now)
QList<QcBlockEntityRecord> collect(const QcBlockEntities &entities, const QcCircuitState &circuits, quint64 now, const QHash<QcChunkPos, QcBlockEntityKept> &kept = {})

Detailed Description

Function Documentation

QStringList QcBlockEntityRecords::apply(const QList<QcBlockEntityRecord> &records, QcBlockEntities &entities, QcCircuitState &circuits, QcHopperQueue &hoppers, quint64 now)

Puts records into the world (entities, circuits, hoppers; ticks again absolute from now): containers, machines and saplings with their contents and timers, memories, scheduled ticks; hoppers resting wake when their cooldown ends, positions the circuits were going to look at are changes again (waiting for any chunk they read that is not loaded). The limits do not refuse entries of a save; returns what had to be left out (taken positions). The records' kept parts are left to the caller (QcBlockEntityExtras::keepParts).

QList<QcBlockEntityRecord> QcBlockEntityRecords::collect(const QcBlockEntities &entities, const QcCircuitState &circuits, quint64 now, const QHash<QcChunkPos, QcBlockEntityKept> &kept = {})

Returns a record for every chunk with something to keep in entities and circuits, sorted by x, then z; ticks count from now. An entry with a kept tail of a newer version (kept, QcBlockEntityExtras::keptParts) is saved even when it holds nothing else.