QcStructure Class
A structure whose palette is resolved to block states (decision E-219): read from a definition (structures/*.json) or assembled in code (the showcase's podium areas). More...
| Header: | #include <worldgen/structures/QcStructure.h> |
Public Types
Public Functions
| void | addCart(QcStructureDefinition::Cart cart) |
| void | addContents(QcStructure::Contents placed) |
| void | addGrowing(QcBlockPos cell) |
| void | addLabel(QcStructure::Label label) |
| void | addMob(QcStructure::Mob mob) |
| std::optional<QcBlockId> | block(int x, int y, int z) const |
| void | connectBlocks(const QcContentRegistry &content, const QList<bool> &loose) |
| bool | contains(int x, int y, int z) const |
| bool | hasSites() const |
| const QString & | name() const |
| const QList<QcBlockId> & | palette() const |
| qint16 | paletteIndex(int x, int y, int z) const |
| void | set(int x, int y, int z, QcBlockId state) |
| int | sizeX() const |
| int | sizeY() const |
| int | sizeZ() const |
| const QStringList & | warnings() const |
Public Variables
| QcAdventureRules | adventure |
| QList<QcStructureDefinition::Boat> | boats |
| QList<QcStructure::Contents> | contents |
| int | groundLayer |
| QList<QcBlockPos> | growing |
| QList<QcStructureDefinition::Guardian> | guardians |
| QList<QcStructureDefinition::Hanging> | hangings |
| QList<QcStructure::Label> | labels |
| QList<QcStructureDefinition::Loot> | loot |
| QList<QcStructureDefinition::Cart> | minecarts |
| QList<QcStructure::Mob> | mobs |
| QList<QcStructureDefinition::Sign> | signs |
| std::optional<QcStructureDefinition::SpawnArea> | spawnArea |
| QList<QcStructureDefinition::Spawner> | spawners |
| QList<QcStructure::Stand> | stands |
| QList<QcBlockPos> | updates |
Static Public Members
| QcStructure::Loaded | fromDefinition(const QcStructureDefinition &definition, const QcContentRegistry &content) |
| QList<bool> | looseCells(const QStringList &palette, const QList<qint16> &cells) |
| const QStringList & | warningsOf(const QcStructure::Loaded &loaded) |
Detailed Description
Cells hold a palette index or keep what is there; the extras (creatures, contents, labels, updates, growing saplings) are in local coordinates like the cells.
Member Type Documentation
[alias] QcStructure::Contents
The contents of a chest or machine of the structure (QcStructureDefinition::Contents).
[alias] QcStructure::Label
A floating label of the structure (QcStructureDefinition::Label).
[alias] QcStructure::Loaded
The result of fromDefinition(): the structure or why it failed.
[alias] QcStructure::Mob
A creature of the structure (QcStructureDefinition::Mob).
[alias] QcStructure::Stand
An armour stand of the structure (QcStructureDefinition::Stand).
Member Function Documentation
void QcStructure::addCart(QcStructureDefinition::Cart cart)
Adds the minecart cart to a structure assembled in code.
void QcStructure::addContents(QcStructure::Contents placed)
Adds the chest or machine contents placed to a structure assembled in code.
void QcStructure::addGrowing(QcBlockPos cell)
Adds the sapling at the local cell, which starts growing when the world is made.
void QcStructure::addLabel(QcStructure::Label label)
Adds the floating label label to a structure assembled in code.
void QcStructure::addMob(QcStructure::Mob mob)
Adds the creature mob to a structure assembled in code (the showcase's areas).
std::optional<QcBlockId> QcStructure::block(int x, int y, int z) const
Returns the state of the cell x, y, z, std::nullopt where the structure keeps what is there (or outside it).
void QcStructure::connectBlocks(const QcContentRegistry &content, const QList<bool> &loose)
Sets the connection properties of the connecting blocks (fences, walls, panes, bars) in the cells marked in loose from their neighbours inside the structure, with the rules of QcBlockRules::connectedState and the block definitions of content (decision E-867). Rails and stairs keep theirs. Cells outside the structure and cells that keep what is there count as air: a fence at the edge does not reach out into the terrain.
bool QcStructure::contains(int x, int y, int z) const
Returns whether the local cell x, y, z lies inside the structure.
[static] QcStructure::Loaded QcStructure::fromDefinition(const QcStructureDefinition &definition, const QcContentRegistry &content)
Returns the structure of definition with its palette resolved to block states of content, with the connection properties of its connecting blocks set (connectBlocks()) and its extras copied. Unknown blocks fail; unknown state properties or values keep their defaults with a warning (warnings(), or QcLoadFailure::warnings for the entries before an unknown block).
bool QcStructure::hasSites() const
Returns whether placed copies have guardian zones or a spawn area (QcStructureSites).
[static] QList<bool> QcStructure::looseCells(const QStringList &palette, const QList<qint16> &cells)
Returns per cell of cells (indices into palette, cell order of QcStructureDefinition::cellIndex): whether the cell takes its connection properties from its neighbours, that is its palette entry names none of north, east, south, west and up (decision E-867).
const QString &QcStructure::name() const
Returns the structure's name.
const QList<QcBlockId> &QcStructure::palette() const
Returns the block states the cells refer to, in the order they were first set.
qint16 QcStructure::paletteIndex(int x, int y, int z) const
Returns the palette index of the cell x, y, z (or QcStructureDefinition::keep); precondition: contains(x, y, z).
void QcStructure::set(int x, int y, int z, QcBlockId state)
Sets the cell x, y, z to state, adding the state to the palette when it is new. Precondition: contains(x, y, z).
int QcStructure::sizeX() const
Returns the size along x in blocks (negative sizes given to the constructor become 0).
int QcStructure::sizeY() const
Returns the size along y in blocks.
int QcStructure::sizeZ() const
Returns the size along z in blocks.
const QStringList &QcStructure::warnings() const
Returns what fromDefinition() kept at a default (unknown state properties or values).
[static] const QStringList &QcStructure::warningsOf(const QcStructure::Loaded &loaded)
Returns the warnings of the resolution loaded, whether it succeeded or not (callers report them before the outcome).
Member Variable Documentation
QcAdventureRules QcStructure::adventure
Allow-list entries of adventure mode the showcase adds to the world (decision E-735).
QList<QcStructureDefinition::Boat> QcStructure::boats
Boats lying on water or ground when the world is made (decision E-920).
QList<QcStructure::Contents> QcStructure::contents
The contents of chests and machines, at local cells.
int QcStructure::groundLayer
The layer at the ground's top block where the world generator places the structure (decision E-590); 0 for structures that stand on the ground.
QList<QcBlockPos> QcStructure::growing
Local cells of saplings that start growing when the world is made.
QList<QcStructureDefinition::Guardian> QcStructure::guardians
Zones whose guardians come back (decision E-591).
QList<QcStructureDefinition::Hanging> QcStructure::hangings
Item frames and paintings hung when the world is made (decision E-797).
QList<QcStructure::Label> QcStructure::labels
The floating labels, in local coordinates.
QList<QcStructureDefinition::Loot> QcStructure::loot
Chests filled from a loot table when their chunk first arrives (decision E-521).
QList<QcStructureDefinition::Cart> QcStructure::minecarts
Minecarts standing on rails when the world is made (decision E-382).
QList<QcStructure::Mob> QcStructure::mobs
The creatures, in local coordinates.
QList<QcStructureDefinition::Sign> QcStructure::signs
Sign texts written when the world is made (decision E-766).
std::optional<QcStructureDefinition::SpawnArea> QcStructure::spawnArea
The monsters of its footprint (decision E-871).
QList<QcStructureDefinition::Spawner> QcStructure::spawners
Monster spawners (decision E-520).
QList<QcStructure::Stand> QcStructure::stands
The armour stands, in local coordinates.
QList<QcBlockPos> QcStructure::updates
Local cells whose block updates are queued (and circuits woken) when the world is made.