QtCraft API C++ classes QML types Handbook

QcStonecutting Namespace

The stonecutter's recipes (decision E-784). More...

Header: #include <common/content/recipes/QcStonecutting.h>

Variables

const qsizetype maxRecipeName

Functions

void generate(QcContentRegistry &registry)
QcItemStack output(const QcContentRegistry &content, const QcItemStack &input, const QString &recipe)
QList<qsizetype> recipesFor(const QcContentRegistry &content, const QString &inputItem)

Detailed Description

Packs define them in stonecutting/ like smelting recipes; generate() adds those of building parts: a part family with a stonecutter count cuts the base block of every material of its stonecutter kinds into that many parts (stone into two stone slabs), and a block cut one to one into the base block of a material is cut into that material's parts too (stone into stone brick stairs). A recipe a pack defines under the same name wins over the generated one; a generated name longer than maxRecipeName is skipped with a warning.

Variable Documentation

const qsizetype QcStonecutting::maxRecipeName

The longest stonecutting recipe name the protocol carries (StonecutterState, SelectStonecutterRecipe); generate() skips a recipe whose name would be longer.

Function Documentation

void QcStonecutting::generate(QcContentRegistry &registry)

Registers in registry the generated recipes of building parts (see above), named <part>_from_<input path> (<part>_from_<namespace>:<path> when the input comes from another pack); a name a pack already uses, or an unknown input or part item, is skipped.

QcItemStack QcStonecutting::output(const QcContentRegistry &content, const QcItemStack &input, const QString &recipe)

Returns the stonecutter's output slot (decision E-785): what the recipe of content named recipe makes from one item of input, or an empty stack when the input is empty, the recipe unknown or for another input.

QList<qsizetype> QcStonecutting::recipesFor(const QcContentRegistry &content, const QString &inputItem)

Returns the indices of the stonecutting recipes of content that take inputItem, in the order of the registry.