QtCraft API C++ classes QML types Handbook

QcMinecart Struct

A minecart (decision E-382): rolls along rails with its own momentum (QcMinecartMotion), stands where it left the rails, and carries one player, or a container (a chest cart, a hopper cart, decision E-386) with its slots. More...

Header: #include <server/entities/QcMinecart.h>
Inherits: QcEntity

Public Types

struct Rest

Public Variables

bool enabled
QString item
quint64 readyAt
std::optional<QcMinecart::Rest> rest
quint32 rider
QcVec3 seat
QList<QcItemStack> stacks

Static Public Members

const QcEntityKind entityKind

Detailed Description

motion.velocity is its velocity in the world (along the track while on rails); yaw turns with the track.

Member Variable Documentation

bool QcMinecart::enabled

Hopper carts: pull items; off after a powered activator rail until an unpowered one.

const QcEntityKind QcMinecart::entityKind

The kind of every entity of this type (QcEntity::as).

QString QcMinecart::item

The item it drops when broken (the one that placed it); its cartBlock says what it carries.

quint64 QcMinecart::readyAt

Hopper carts: they rest until this tick after moving an item (not saved).

std::optional<QcMinecart::Rest> QcMinecart::rest

Where it rests now; std::nullopt while it moves or may move.

quint32 QcMinecart::rider

The player (entity id) riding it; 0 for none. Not saved: a rider who leaves the world leaves the cart.

QcVec3 QcMinecart::seat

Where the rider was put last (QcServerMinecarts): a rider found elsewhere was moved by something else (a teleport) and is no longer in the cart.

QList<QcItemStack> QcMinecart::stacks

The slots of a container cart (as many as its block has); empty for a plain cart.