QtCraft API C++ classes QML types Handbook

QcItemDataCodec Namespace

The data of an item stack in save files (decision E-823): the components of QcItemData framed like the components of entities (QcComponentFrames, decision E-420), so a version keeps what it does not know. More...

Header: #include <server/storage/QcItemDataCodec.h>

Variables

const qint32 dataFlag
const qsizetype maxSavedName
const quint16 version

Functions

void write(QDataStream &stream, const QcItemData &data, const QcContentRegistry &content)

Detailed Description

A stack in a save is name, count, damage; when the count has dataFlag set, its data follows (QcSaveFile::writeStack, QcStackReader). Files without data read as before.

Variable Documentation

const qint32 QcItemDataCodec::dataFlag

Set in the saved count of a stack whose data follows; counts never come close.

const qsizetype QcItemDataCodec::maxSavedName

Names longer than this are damaged data; up to it a name is cut to QcItemData::maxNameLength (a later version may allow longer ones).

const quint16 QcItemDataCodec::version

The version every known component writes.

Function Documentation

void QcItemDataCodec::write(QDataStream &stream, const QcItemData &data, const QcContentRegistry &content)

Writes the components of data that are set to stream (item ids of content): the map id (quint32), the contents (quint16 count, then the stacks by QcSaveFile::writeStack), the name, the enchantments (quint16 count, then name and quint16 level of each), the anvil uses (quint16), then the kept ones.