QtCraft API C++ classes QML types Handbook

QcBlockEntityRecord Struct

What is saved of the block entities of one chunk (decision E-358), with every tick counted from the moment of saving, so clocks go on where they stopped when the world opens again. More...

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

Public Types

struct Memory
struct Scheduled
enum class Table { Containers, Machines, Saplings, Memories, Scheduled, …, Signs }

Public Functions

bool isEmpty() const
void pruneKept()
void takeFrom(QcBlockEntities &entities, QcCircuitState &circuits, QcHopperQueue &hoppers, quint64 now)

Public Variables

QList<QcBlockPos> blockUpdates
QList<QcCampfires::Entry> campfires
QcChunkPos chunk
QList<QcBlockEntities::Container> containers
QList<QcFireQueue::Saved> fires
bool furnished
QcBlockEntityKept kept
QList<QcBlockEntities::Machine> machines
QList<QcBlockEntityRecord::Memory> memories
QList<QcBlockEntities::Sapling> saplings
QList<QcBlockEntityRecord::Scheduled> scheduled
QList<QcBlockPos> signalWakes
QList<QcSignTexts::Entry> signs
QList<QcSpawners::Entry> spawners
QList<QcBlockPos> wakes

Detailed Description

Member Type Documentation

enum class QcBlockEntityRecord::Table

The ids of the tables of a chunk's block entities (decision E-440); a later version adds ids below QcComponentFrames::firstModId, a mod from it on; none is ever reused.

ConstantValueDescription
QcBlockEntityRecord::Table::Containers1Containers with contents (containers).
QcBlockEntityRecord::Table::Machines2Machines with contents or a cooldown (machines).
QcBlockEntityRecord::Table::Saplings3Growing saplings (saplings).
QcBlockEntityRecord::Table::Memories4What circuit components remember (memories).
QcBlockEntityRecord::Table::Scheduled5Scheduled ticks of circuit components (scheduled).
QcBlockEntityRecord::Table::Wakes6Positions the circuits were going to look at (wakes).
QcBlockEntityRecord::Table::SignalWakes7Signals that were on their way (signalWakes).
QcBlockEntityRecord::Table::BlockUpdates8Pending neighbour updates and flow steps (blockUpdates).
QcBlockEntityRecord::Table::Fires9Burning fires (fires).
QcBlockEntityRecord::Table::Spawners10Monster spawners (decision E-520): kind, delay and confined per spawner.
QcBlockEntityRecord::Table::Furnished11A marker without entries: the chunk's generated block entities were put in (decision E-520).
QcBlockEntityRecord::Table::Campfires12The items on campfires (decision E-772) with their cooking time.
QcBlockEntityRecord::Table::Signs13The text on signs (decision E-766): the lines per sign with text.

Member Function Documentation

bool QcBlockEntityRecord::isEmpty() const

Returns whether the record holds nothing (no entries, not furnished, nothing kept).

void QcBlockEntityRecord::pruneKept()

Drops the kept tails of entries the record no longer holds (a container broken since it was read), once the record is complete (fires included): a tail goes back only with its entry.

void QcBlockEntityRecord::takeFrom(QcBlockEntities &entities, QcCircuitState &circuits, QcHopperQueue &hoppers, quint64 now)

Fills the record of a chunk that leaves the world (decision E-374), chunk, with everything of it taken out of entities, the work of circuits and the queue of hoppers, ticks counted from now; its kept parts, set by the caller, decide like in QcBlockEntityRecords::collect(). blockUpdates and fires are left to the caller. In QcBlockEntityRecords.cpp.

Member Variable Documentation

QList<QcBlockPos> QcBlockEntityRecord::blockUpdates

Neighbour updates and planned flow steps of the chunk not yet carried out when it was unloaded or saved (decision E-374); queued again when it comes back.

QList<QcCampfires::Entry> QcBlockEntityRecord::campfires

The items cooking on campfires (decision E-772).

QcChunkPos QcBlockEntityRecord::chunk

The chunk.

QList<QcBlockEntities::Container> QcBlockEntityRecord::containers

Containers with contents (or a cooldown); empty ones come back with their block. A container's readyAt holds the ticks left of a hopper's cooldown.

QList<QcFireQueue::Saved> QcBlockEntityRecord::fires

Burning fires with the ticks left to their next step (decision E-392), in the order of their steps.

bool QcBlockEntityRecord::furnished

The generator's chest loot and spawner kinds were put into the chunk (QcFurnishing); a chunk without the mark gets them when it arrives.

QcBlockEntityKept QcBlockEntityRecord::kept

What this version does not read, written back unchanged.

QList<QcBlockEntities::Machine> QcBlockEntityRecord::machines

Machines with contents (or a cooldown); empty ones come back with their block.

QList<QcBlockEntityRecord::Memory> QcBlockEntityRecord::memories

What circuit components remember.

QList<QcBlockEntities::Sapling> QcBlockEntityRecord::saplings

Saplings with the time left until they try to grow.

QList<QcBlockEntityRecord::Scheduled> QcBlockEntityRecord::scheduled

Scheduled ticks of circuit components.

QList<QcBlockPos> QcBlockEntityRecord::signalWakes

The same for signals that were on their way (decision E-376): they come back as signals.

QList<QcSignTexts::Entry> QcBlockEntityRecord::signs

Signs with text (decision E-766).

QList<QcSpawners::Entry> QcBlockEntityRecord::spawners

Monster spawners (decision E-520) with the ticks left to their next cycle.

QList<QcBlockPos> QcBlockEntityRecord::wakes

Positions the circuits were going to look at (changes not yet looked at, positions waiting for chunks): looked at again as changes when the chunk is back.