QtCraft API C++ classes QML types Handbook

QcBlockForecast Namespace

The blocks the local player's actions are expected to set, as the server will set them (decision E-853): the client shows them at once and the server's acknowledgement confirms or rolls them back (QcBlockMirror). More...

Header: #include <clientcore/player/QcBlockForecast.h>

Functions

QList<QcMsg::BlockUpdate> breaking(const QcBlockAccess &world, QcBlockPos pos)
bool placesPlainly(const QcItemDefinition &held)
QList<QcMsg::BlockUpdate> placing(const QcBlockAccess &world, const QcItemDefinition &held, const QcBlockRules::Aim &aim, const QcVec3 &eye, const QList<QcAabb> &bodies)

Detailed Description

Only what the client can work out exactly is forecast; an empty list means the client waits for the server's blocks.

Function Documentation

QList<QcMsg::BlockUpdate> QcBlockForecast::breaking(const QcBlockAccess &world, QcBlockPos pos)

Returns the blocks breaking the block at pos in world sets: air there and, for a door or bed, at its other half (both in creative and survival mode, decision E-282). Empty where nothing (or air) is loaded.

bool QcBlockForecast::placesPlainly(const QcItemDefinition &held)

Returns whether using held on a block does nothing but place its block (no bucket, food, stand, frame, cart, fire, dye or backpack with contents), so that the placement can be forecast.

QList<QcMsg::BlockUpdate> QcBlockForecast::placing(const QcBlockAccess &world, const QcItemDefinition &held, const QcBlockRules::Aim &aim, const QcVec3 &eye, const QList<QcAabb> &bodies)

Returns the blocks placing the block of held in world with aim from eye sets (QcBlockRules::placement): its cell and, for a door or bed, its other half. Empty when the item does not place plainly, the clicked block is a liquid or air, the block is a sapling or floats (their ground rules are the server's), the cell is out of reach or one of bodies (the living bodies nearby, the player's own too) would end up inside it.