QtCraft API C++ classes QML types Handbook

QcClientEntity Struct

Client mirror of an entity the server reported (QcMsg::EntitySpawn). More...

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

Public Functions

std::optional<QcBlockId> cartBlock(const QcContentRegistry &content) const
const QcMobDefinition *creature(const QcContentRegistry &content) const
bool isArmourStand() const
bool isBlockEntity() const
bool isBoat() const
bool isCreature() const
bool isExperienceOrb() const
bool isFallingBlock() const
bool isHanging() const
bool isItem() const
bool isMinecart() const
bool isMovingBlock() const
bool isPlayer() const
bool isPrimedExplosive() const
bool isProjectile() const

Public Variables

QcAppearance appearance
QcBlockId block
QcCreatureKindId creatureType
int deathTicks
double drawStep
double drawTicks
QcEquipment equipment
quint16 flags
QcHanging hanging
double health
QcItemId held
std::optional<double> hurtAtMs
int hurtTicks
quint32 id
QcItemStack item
QcEntityKind kind
double lastStep
QString name
float pitch
QcVec3 position
float previousPitch
QcVec3 previousPosition
float previousYaw
double sinceStep
double speed
QcStandPose stand
int swingTicks
double walkDistance
float yaw

Detailed Description

Member Function Documentation

std::optional<QcBlockId> QcClientEntity::cartBlock(const QcContentRegistry &content) const

Returns the block a minecart carries (its item's cartBlock in content, decision E-386); nothing for a plain cart.

const QcMobDefinition *QcClientEntity::creature(const QcContentRegistry &content) const

Returns the definition of a creature in content; nothing for the other kinds.

bool QcClientEntity::isArmourStand() const

Returns whether the entity is an armour stand.

bool QcClientEntity::isBlockEntity() const

Returns whether the entity is a falling or moving block or a lit explosive: drawn as a block, never targeted, no steps.

bool QcClientEntity::isBoat() const

Returns whether the entity is a boat (decision E-920): item is its boat item, which names what it is built of.

bool QcClientEntity::isCreature() const

Returns whether the entity is a creature (creature()).

bool QcClientEntity::isExperienceOrb() const

Returns whether the entity is an experience orb.

bool QcClientEntity::isFallingBlock() const

Returns whether the entity is a falling block.

bool QcClientEntity::isHanging() const

Returns whether the entity is an item frame or a painting: targeted by its thin box (QcHanging::box), never moves.

bool QcClientEntity::isItem() const

Returns whether the entity is a dropped item.

bool QcClientEntity::isMinecart() const

Returns whether the entity is a minecart (cartBlock()).

bool QcClientEntity::isMovingBlock() const

Returns whether the entity is a block moved by a piston.

bool QcClientEntity::isPlayer() const

Returns whether the entity is a player.

bool QcClientEntity::isPrimedExplosive() const

Returns whether the entity is a lit explosive (decision E-601): health holds the ticks left of its fuse.

bool QcClientEntity::isProjectile() const

Returns whether the entity is a projectile (arrow, thrown item).

Member Variable Documentation

QcAppearance QcClientEntity::appearance

Players: their look; all creatures: head pitch, entity flag bits (QcMsg::Swing …) and the held item.

QcBlockId QcClientEntity::block

The block of a falling block; air otherwise.

QcCreatureKindId QcClientEntity::creatureType

Creatures: their kind among the content's mobs (checked on arrival).

QcEquipment QcClientEntity::equipment

Players and armour stands: their armour slots.

quint16 QcClientEntity::flags

Entity flag bits (QcMsg::Swing …).

QcHanging QcClientEntity::hanging

Item frames and paintings (decision E-790): where they hang and what they show; held is their own item, item the stack a frame holds.

double QcClientEntity::health

Players and creatures: their health; experience orbs: their value (decision E-398); lit explosives: the ticks left of their fuse.

QcItemId QcClientEntity::held

The held item; qcNoItem for none.

std::optional<double> QcClientEntity::hurtAtMs

The server time of a hurt whose flash waits until the shown moment reaches it, so the flash starts with the knockback the buffered motion shows (decision E-971); none when nothing waits.

int QcClientEntity::hurtTicks

Client ticks left for the hurt flash.

quint32 QcClientEntity::id

The entity's id on the server.

QcItemStack QcClientEntity::item

The stack of a dropped item, the item of a minecart (what it carries), a boat (what it is built of) or a projectile (its look); empty otherwise.

QcEntityKind QcClientEntity::kind

What kind of entity it is; the kind decides which of the fields below mean something.

QString QcClientEntity::name

Players: their name; creatures: their name tag, if any.

float QcClientEntity::pitch

Head pitch at the end of the current client tick, in degrees.

float QcClientEntity::previousPitch

Head pitch at the start of the current client tick.

float QcClientEntity::previousYaw

Where the entity faced at the start of the current client tick.

double QcClientEntity::sinceStep

Distance walked since the entity's last step sound.

QcStandPose QcClientEntity::stand

Armour stands: pose and what they show.

float QcClientEntity::yaw

Where the entity faces at the end of the current client tick, in degrees.