QtCraft API C++ classes QML types Handbook

QcHanging Struct

Where an item frame or a painting hangs and what it shows (decisions E-790, E-791), the same for the server (placement, support, saving) and the client (targeting, drawing). More...

Header: #include <common/gameplay/QcHanging.h>

Public Functions

QcAabb box() const
QList<QcBlockPos> cells() const
QcVec3 centre() const
QcBlockPos supportOf(QcBlockPos covered) const

Public Variables

QcBlockPos cell
QcBlockFace face
int height
quint8 motif
quint8 rotation
QcHangingType type
int width

Static Public Members

const double frameDepth
const double frameSide
bool isWallFace(QcBlockFace face)
const double paintingDepth
QcFaceOffset rightOf(QcBlockFace face)
const int rotations

Detailed Description

It lies flat on face of the blocks behind its cells: a frame in one cell on any face, a painting of width x height cells on a side face.

Member Function Documentation

QcAabb QcHanging::box() const

Returns its thin box on the wall (targeting, hits).

QList<QcBlockPos> QcHanging::cells() const

Returns the cells it covers.

QcVec3 QcHanging::centre() const

Returns the middle of its front, the entity's position.

[static] bool QcHanging::isWallFace(QcBlockFace face)

Returns whether a painting may hang on face (the four side faces).

[static] QcFaceOffset QcHanging::rightOf(QcBlockFace face)

Returns the direction to the right as seen from the front of the side face face (the cells of a painting run this way from cell); for Up and Down the direction a frame's item points at rotation 0.

QcBlockPos QcHanging::supportOf(QcBlockPos covered) const

Returns the block behind covered (one of its cells) that holds it there.

Member Variable Documentation

QcBlockPos QcHanging::cell

A frame's cell; a painting's lower left cell as seen from the front.

QcBlockFace QcHanging::face

The face of the supporting blocks it lies on, pointing away from them into its cells.

const double QcHanging::frameSide

A frame covers this much of its face (centred).

quint8 QcHanging::motif

Paintings: index into the motifs of its item.

quint8 QcHanging::rotation

Item frames: the eighths the held item is turned (0 to rotations - 1).

const int QcHanging::rotations

Steps an item in a frame turns through (45 degrees each).

QcHangingType QcHanging::type

Item frame or painting.