QtCraft API C++ classes QML types Handbook

QcStructureDefinition Struct

A building made of blocks, defined in data (structures/*.json, decision E-219): a palette of block states and the palette key of every cell, plus what a placed copy brings along: creatures, contents of chests and machines, armour stands, labels, block updates to run (liquids start to flow, sand falls) and saplings that grow. More...

Header: #include <common/content/worldgen/QcStructureDefinition.h>

Public Types

struct Boat
struct Cart
struct Choice
struct Contents
struct Guardian
struct Hanging
struct Label
struct Loot
struct Mob
struct Part
struct Sign
struct SpawnArea
struct Spawner
struct Stack
struct Stand
struct Surface

Public Functions

qsizetype cellIndex(int x, int y, int z) const

Public Variables

QcAdventureRules adventure
QList<QcStructureDefinition::Boat> boats
QList<qint16> cells
QList<QcStructureDefinition::Choice> choices
QList<QcStructureDefinition::Contents> contents
int groundLayer
QList<QcBlockPos> growing
QList<QcStructureDefinition::Guardian> guardians
QList<QcStructureDefinition::Hanging> hangings
QList<QcStructureDefinition::Label> labels
QList<QcStructureDefinition::Loot> loot
QList<QcStructureDefinition::Cart> minecarts
int mineshaftWeight
QList<QcStructureDefinition::Mob> mobs
QString name
QStringList palette
QList<QcStructureDefinition::Part> parts
bool showcase
bool showcaseFromFront
int showcaseOrder
QList<QcStructureDefinition::Sign> signs
int sizeX
int sizeY
int sizeZ
std::optional<QcStructureDefinition::SpawnArea> spawnArea
QList<QcStructureDefinition::Spawner> spawners
QList<QcStructureDefinition::Stand> stands
std::optional<QcStructureDefinition::Surface> surface
QString translationKey
QList<QcBlockPos> updates

Static Public Members

const qint16 keep
const int maxChoices
const int maxExtras
const int maxItemsPerContainer
const int maxOptions
const int maxPaletteEntries
const int maxParts
const int maxSize

Detailed Description

Coordinates are local: x east, y up, z south, origin at the north west bottom corner. Placement turns a structure in quarter turns about the vertical axis. Server side only; the showcase world (and later villages) place structures through the world generator.

Member Function Documentation

qsizetype QcStructureDefinition::cellIndex(int x, int y, int z) const

Returns the index in cells of the cell at x, y, z.

Member Variable Documentation

QcAdventureRules QcStructureDefinition::adventure

Allow-list entries of adventure mode (decision E-735) the showcase adds to the world when it places the structure ("adventure": {"canBreak": {item: [blocks]}, "canPlaceOn": {…}}); like every allow-list they hold in the whole world.

QList<QcStructureDefinition::Boat> QcStructureDefinition::boats

Boats lying on water or ground when the world is made (decision E-920).

QList<qint16> QcStructureDefinition::cells

Palette index per cell (x + sizeX * (z + sizeZ * y)), or keep.

QList<QcStructureDefinition::Contents> QcStructureDefinition::contents

Contents of chests and machines ("contents").

int QcStructureDefinition::groundLayer

The layer that lies at the ground's top block where the world generator places the structure by itself or in a village (decision E-590): the layers below it are buried (the desert temple's cellar). 0 for structures that stand on the ground.

QList<QcBlockPos> QcStructureDefinition::growing

Cells of saplings that grow after placing ("growing").

QList<QcStructureDefinition::Guardian> QcStructureDefinition::guardians

Zones whose guardians come back by themselves ("guardians", decision E-591).

QList<QcStructureDefinition::Hanging> QcStructureDefinition::hangings

Item frames and paintings ("hangings"); only showcase structures may have them.

const qint16 QcStructureDefinition::keep

Palette index of a cell that keeps what is there.

QList<QcStructureDefinition::Label> QcStructureDefinition::labels

Floating texts ("labels").

QList<QcStructureDefinition::Loot> QcStructureDefinition::loot

Chests filled from loot tables ("loot").

const int QcStructureDefinition::maxExtras

Creatures, contents, labels, updates and growing saplings each.

const int QcStructureDefinition::maxItemsPerContainer

Most item stacks in one "contents" entry.

const int QcStructureDefinition::maxPaletteEntries

Most palette entries (also the most swaps in one option of a choice).

const int QcStructureDefinition::maxSize

Most layers, rows per layer and cells per row.

QList<QcStructureDefinition::Cart> QcStructureDefinition::minecarts

Minecarts standing on rails when the world is made (decision E-382).

int QcStructureDefinition::mineshaftWeight

A room of the mine shafts with this weight (decision E-570; "mineshaft": {"weight": 2}), 0 for none: placed at dead ends, its door (the middle of its north side, one block above its bottom layer) towards the corridor.

QList<QcStructureDefinition::Mob> QcStructureDefinition::mobs

Creatures placed with it ("mobs").

QString QcStructureDefinition::name

Qualified name ("name").

QStringList QcStructureDefinition::palette

Block state names ("qtcraft:torch[attach=north]").

bool QcStructureDefinition::showcaseFromFront

The showcase tour looks at it from in front of its south side at eye height (a station behind glass, decision E-839; "showcase": {"front": true}) instead of from the lookout.

QList<QcStructureDefinition::Sign> QcStructureDefinition::signs

Texts of signs ("signs").

int QcStructureDefinition::sizeX

Size in cells along x (the length of a row of "layers").

int QcStructureDefinition::sizeY

Size in cells along y (the number of layers).

int QcStructureDefinition::sizeZ

Size in cells along z (the rows per layer).

std::optional<QcStructureDefinition::SpawnArea> QcStructureDefinition::spawnArea

The footprint as a spawn area of its own monsters ("spawnArea", decision E-871); none: an ordinary area.

QList<QcStructureDefinition::Spawner> QcStructureDefinition::spawners

Monster spawners ("spawners").

QList<QcStructureDefinition::Stand> QcStructureDefinition::stands

Armour stands ("stands").

std::optional<QcStructureDefinition::Surface> QcStructureDefinition::surface

Placed by the terrain generator by itself (decision E-590); std::nullopt: only where data places it (villages, mine shafts, the showcase).

QString QcStructureDefinition::translationKey

Translation key of its name ("translation", default made from the name with the prefix structure, QcContentFields::translationKey()).

QList<QcBlockPos> QcStructureDefinition::updates

Cells whose block update runs after placing ("updates"): liquids start to flow, sand falls.