QcClientMachineScreen Class
The machine or chest screen the server opened for the local player (OpenMachine, MachineState, CloseMachine): where it is (or the container minecart it belongs to), its category (empty for a storage block or cart), its slots and progress. More...
| Header: | #include <clientcore/session/QcClientMachineScreen.h> |
Public Types
| enum class | Change { None, Opened, Changed, Closed } |
Public Functions
| double | burn() const |
| const QString & | category() const |
| bool | closeLocally() |
| quint32 | entity() const |
| std::optional<QcClientMachineScreen::Change> | handle(const QcMessage &message, const QcContentRegistry *content) |
| int | heldSlot() const |
| bool | isContainer() const |
| bool | isOpen() const |
| const QString & | name() const |
| std::optional<QcBlockPos> | pos() const |
| double | progress() const |
| const QList<QcItemStack> & | stacks() const |
| void | usedBlock() |
Detailed Description
The GUI-free state behind QcClientSession's machine accessors.
Member Type Documentation
enum class QcClientMachineScreen::Change
What a server message did to the screen.
| Constant | Value | Description |
|---|---|---|
QcClientMachineScreen::Change::None | 0 | a message about a screen that changed nothing here |
QcClientMachineScreen::Change::Opened | 1 | the server opened a screen |
QcClientMachineScreen::Change::Changed | 2 | slots or progress of the open screen changed |
QcClientMachineScreen::Change::Closed | 3 | the server closed the screen |
Member Function Documentation
double QcClientMachineScreen::burn() const
Returns the fuel left of the open machine (0..1).
const QString &QcClientMachineScreen::category() const
Returns the category of the open machine (content name); empty for a storage block or cart.
bool QcClientMachineScreen::closeLocally()
The player closed the screen. Returns false when none was open. An OpenMachine still on its way is then ignored until the player uses a block again (usedBlock()).
quint32 QcClientMachineScreen::entity() const
Returns the container minecart (entity id) of the open screen, 0 for a block.
std::optional<QcClientMachineScreen::Change> QcClientMachineScreen::handle(const QcMessage &message, const QcContentRegistry *content)
Returns what the server message did to the screen (items checked against content); std::nullopt for messages about other things.
int QcClientMachineScreen::heldSlot() const
Returns the hotbar slot of a backpack opened from the hand (decision E-833), locked while open; -1 for a block or cart.
bool QcClientMachineScreen::isContainer() const
Returns whether the open screen belongs to a storage block (chest) rather than a machine.
bool QcClientMachineScreen::isOpen() const
Returns whether a screen is open.
const QString &QcClientMachineScreen::name() const
Returns the custom name of the open chest or machine (decision E-873); empty for none.
std::optional<QcBlockPos> QcClientMachineScreen::pos() const
Returns where the open machine or chest is; for a cart, where it was when it opened; nothing while closed.
double QcClientMachineScreen::progress() const
Returns the progress of the open machine's current job (0..1).
const QList<QcItemStack> &QcClientMachineScreen::stacks() const
Returns the slots of the open screen as the server last sent them.
void QcClientMachineScreen::usedBlock()
The player used a block: OpenMachine messages count again (see closeLocally()).