QtCraft API C++ classes QML types Handbook

QcRecipeDefinition Struct

Crafting recipe from content data. More...

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

Public Functions

int height() const
QString itemAt(int column, int row) const
int width() const

Public Variables

QList<QString> ingredients
QList<std::pair<QChar, QString>> keys
QString name
QList<QString> pattern
int resultCount
QString resultItem
bool shaped

Detailed Description

Shaped recipes have rows of single-character keys (space = empty); shapeless recipes list their ingredients.

Member Function Documentation

int QcRecipeDefinition::height() const

Returns the number of pattern rows.

QString QcRecipeDefinition::itemAt(int column, int row) const

Returns the item name at the pattern cell in column and row, empty for a blank cell and for a cell outside the pattern.

int QcRecipeDefinition::width() const

Returns the width of the pattern; 0 without one.

Member Variable Documentation

QList<QString> QcRecipeDefinition::ingredients

Ingredients of a shapeless recipe ("ingredients", 1 to 9): qualified item names or "#tag".

QList<std::pair<QChar, QString>> QcRecipeDefinition::keys

Item name per pattern key character, in key order.

QString QcRecipeDefinition::name

Qualified name ("name", required).

QList<QString> QcRecipeDefinition::pattern

Rows of the pattern after trimming, all of equal width.

int QcRecipeDefinition::resultCount

Items it makes ("count" in "result", 1 to 64).

QString QcRecipeDefinition::resultItem

Qualified name of the item it makes ("item" in "result", required).

bool QcRecipeDefinition::shaped

Whether it has a pattern ("type": "shaped", the default) or lists its ingredients ("shapeless").