QtCraft API C++ classes QML types Handbook

QcShapeParser Namespace

Parses block shapes: shape files and the inline shapes of blocks. More...

Header: #include <common/content/blocks/QcShapeParser.h>

Functions

QList<QcShapeCondition> parseConditions(const QJsonObject &json, QcJsonFieldReader &reader)
QcResult<QcShapeDefinition> parseShape(const QJsonObject &json, const QString &packNamespace)
QcShapeDefinition parseShapeBody(const QJsonObject &json, QcJsonFieldReader &reader)

Detailed Description

Function Documentation

QList<QcShapeCondition> QcShapeParser::parseConditions(const QJsonObject &json, QcJsonFieldReader &reader)

Returns the conditions at "when" of json ({"property": value or [values]}), as shape parts and block drops use them; failures go to reader.

QcResult<QcShapeDefinition> QcShapeParser::parseShape(const QJsonObject &json, const QString &packNamespace)

Returns the shape file json with its "name" qualified in packNamespace, or the error.

QcShapeDefinition QcShapeParser::parseShapeBody(const QJsonObject &json, QcJsonFieldReader &reader)

Returns the shape body of json, shared by shape files and inline block shapes: "parts", or "boxes"/"crosses"/"collision" directly for a shape of one part, plus "rotate", "flip", "spin" and "lockTextures"; failures go to reader.