QtCraft API C++ classes QML types Handbook

QcAdvancementCatalog Class

The advancements of the content (part of QcContentRegistry, decision E-923), in load order and replaced by name like other definitions. More...

Header: #include <common/content/registry/QcAdvancementCatalog.h>

Public Functions

void add(QcAdvancementDefinition advancement)
const QcAdvancementDefinition *find(const QString &name) const
std::optional<qsizetype> indexOf(const QString &name) const
const QList<QcAdvancementDefinition> &items() const
QStringList resolve(const QcContentRegistry &content)

Static Public Members

const qsizetype maxAdvancements

Detailed Description

A pack switches one off with "disabled": true; resolve() then takes it out and hangs its children on its parent, so a mod can drop a step of the base tree without cutting it.

Member Function Documentation

void QcAdvancementCatalog::add(QcAdvancementDefinition advancement)

Adds advancement, replacing one of the same name. A switched-off advancement keeps the parent of the one it replaces, so resolve() can hang its children there.

const QcAdvancementDefinition *QcAdvancementCatalog::find(const QString &name) const

Returns the advancement named name, or null if there is none.

std::optional<qsizetype> QcAdvancementCatalog::indexOf(const QString &name) const

Returns the position of the advancement named name in items(); none if there is none.

const QList<QcAdvancementDefinition> &QcAdvancementCatalog::items() const

Returns the advancements in load order.

QStringList QcAdvancementCatalog::resolve(const QcContentRegistry &content)

Once all packs are loaded (QcContentRegistry::finish): removes the switched-off advancements, keeps at most maxAdvancements, makes an advancement whose parent is unknown or part of a loop a root, and checks the rest against content: icons, handbook links, English texts and conditions naming nothing of the content (such a criterion never matches). Returns the warnings.

Member Variable Documentation

const qsizetype QcAdvancementCatalog::maxAdvancements

The most advancements a content holds (the content sync and the player files rely on it).