QtCraft API C++ classes QML types Handbook

QcChunkExtras Class

What the server sends about the loaded chunks besides their blocks: the labels floating in them (decision E-222), the creature kinds spinning in their monster spawners (decision E-520) and the items lying on their campfires (decision E-772). More...

Header: #include <clientcore/session/QcChunkExtras.h>

Public Functions

void addExplosion(const QcMsg::Explosion &explosion, quint64 tick)
const QHash<QcBlockPos, QList<quint32>> &campfires() const
void chunkArrived(QcChunkPos pos)
const QcExplosionEffects &explosions() const
quint64 labelGeneration() const
const QHash<QcChunkPos, QList<QcWorldLabel>> &labels() const
void pruneExplosions(quint64 tick)
void removeChunk(QcChunkPos pos)
void setCampfire(const QcMsg::CampfireDisplay &display)
void setLabels(const QcMsg::ChunkLabels &labels)
void setSign(const QcMsg::SignText &message)
void setSpawner(QcMsg::SpawnerDisplay display)
quint64 signGeneration() const
const QHash<QcBlockPos, QcSignText::Text> &signs() const
const QHash<QcBlockPos, int> &spawners() const

Detailed Description

All go with their chunk's ChunkUnload; the spawners and campfires also with a new ChunkData of their chunk (the server sends them right after its blocks, so a chunk sent again, e.g. after /regenerate, keeps only those it still has). The text on signs (decision E-766) comes and goes the same way. The explosions near the player (decision E-604) stay as puffs of flash and smoke until they are over.

Member Function Documentation

void QcChunkExtras::addExplosion(const QcMsg::Explosion &explosion, quint64 tick)

Adds the puffs of explosion, which happened at client tick.

const QHash<QcBlockPos, QList<quint32>> &QcChunkExtras::campfires() const

Returns the items (content ids, 0 for an empty slot) on each campfire of the loaded chunks that holds any.

void QcChunkExtras::chunkArrived(QcChunkPos pos)

A chunk's ChunkData arrived at pos: forgets its spawners, campfires and signs (the server sends them again right after).

const QcExplosionEffects &QcChunkExtras::explosions() const

Returns the explosions near the player, as puffs of flash and smoke.

quint64 QcChunkExtras::labelGeneration() const

Returns a number that changes whenever a chunk's labels arrived or left.

const QHash<QcChunkPos, QList<QcWorldLabel>> &QcChunkExtras::labels() const

Returns the labels floating in each loaded chunk that has any.

See also setLabels().

void QcChunkExtras::pruneExplosions(quint64 tick)

Forgets the puffs that are over at client tick.

void QcChunkExtras::removeChunk(QcChunkPos pos)

The chunk at pos left: forgets its labels, spawners, campfires and signs.

void QcChunkExtras::setCampfire(const QcMsg::CampfireDisplay &display)

Takes the items on a campfire, display; one with only empty slots is forgotten.

void QcChunkExtras::setLabels(const QcMsg::ChunkLabels &labels)

Takes the labels of one chunk (replacing those it had).

See also labels().

void QcChunkExtras::setSign(const QcMsg::SignText &message)

Takes the text and colour of a sign from message; a blank sign is forgotten.

void QcChunkExtras::setSpawner(QcMsg::SpawnerDisplay display)

Shows the creature kind of the spawner display names, or none when its kind is negative.

quint64 QcChunkExtras::signGeneration() const

Returns a number that changes whenever a sign's text or colour arrived or left.

const QHash<QcBlockPos, QcSignText::Text> &QcChunkExtras::signs() const

Returns the lines and colour on each sign with text or a colour of the loaded chunks.

const QHash<QcBlockPos, int> &QcChunkExtras::spawners() const

Returns the kind (content index) shown in each spawner of the loaded chunks.