QtCraft API C++ classes QML types Handbook

QcClientRiding Class

The minecart the local player rides (decision E-382). More...

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

Public Functions

bool drivesBoat() const
bool isRiding() const
bool noteVehicle(quint32 vehicle, bool boat)
bool ridesCart() const
std::optional<QcEntityMotion> seated(const QcClientEntities &entities) const
quint32 vehicle() const

Detailed Description

The server moves a rider with the cart and names the cart in the player's state; meanwhile the client predicts nothing for the player and shows the player on the seat of the cart as its mirror shows the cart (interpolated like every entity), so riding is smooth and never corrected. Getting out puts the player where the server placed them, which is no correction either.

Member Function Documentation

bool QcClientRiding::drivesBoat() const

Returns whether the player drives a boat: the prediction steps the boat and the player sits in it.

bool QcClientRiding::isRiding() const

Returns whether the player is in a vehicle.

bool QcClientRiding::noteVehicle(quint32 vehicle, bool boat)

Takes the vehicle of a QcMsg::PlayerState and whether it is a boat (the state carries the boat's). Returns true when the player got in or out.

bool QcClientRiding::ridesCart() const

Returns whether the player rides a minecart: the cart's mirror carries the player (seated).

std::optional<QcEntityMotion> QcClientRiding::seated(const QcClientEntities &entities) const

Returns the shown player on the seat of the cart as the entity mirror entities shows it this tick; none while the cart has not arrived yet (the player stays where it is).

quint32 QcClientRiding::vehicle() const

Returns the entity id of the vehicle the player is in; 0 for none.