QtCraft API C++ classes QML types Handbook

QcChunkCodec Namespace

The blocks of one chunk as a blob of a region file (decision E-373): a palette of block state names ("name[property=value,...]") local to the chunk and the sections in the protocol's chunk encoding with indices into it, compressed. More...

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

Functions

QcResult<std::shared_ptr<QcChunk>> decode(const QByteArray &blob, QcChunkPos chunk, const QcContentRegistry &content, QcLoadWarnings &warnings)
QByteArray encode(const QcChunk &chunk, const QcContentRegistry &content)

Detailed Description

Content changes between sessions do not scramble a world: unknown names become air with a warning.

Function Documentation

QcResult<std::shared_ptr<QcChunk>> QcChunkCodec::decode(const QByteArray &blob, QcChunkPos chunk, const QcContentRegistry &content, QcLoadWarnings &warnings)

Returns the chunk read from blob, block states looked up in content, or the damage. chunk is where the blob says it belongs; anything else is damage. Each unknown name is reported once to warnings (which reads the whole world).

QByteArray QcChunkCodec::encode(const QcChunk &chunk, const QcContentRegistry &content)

Returns the blob of chunk, block states named after content.