QtCraft API C++ classes QML types Handbook

QcClientAnvil Class

The anvil's screen the server opened for the local player (decision E-866): its left and right slots, the name in its field, the output and its cost as the server last sent them (state()); the player renames and takes the output. More...

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

Public Functions

bool forge()
bool rename(const QString &name)
QList<QcItemStack> slotStacks() const

Protected Functions

bool sameState(const QcMsg::AnvilState &a, const QcMsg::AnvilState &b) const

Detailed Description

Items go in and out through the inventory's slot messages (left and right are the machine's input and fuel slots while the screen is open). Part of QcClientSession; GUI-free.

Member Function Documentation

bool QcClientAnvil::forge()

Asks the server for the output and cost it last sent. Returns false when there is none.

bool QcClientAnvil::rename(const QString &name)

Sends name, the text of the name field. Returns false when no screen is open.

[protected] bool QcClientAnvil::sameState(const QcMsg::AnvilState &a, const QcMsg::AnvilState &b) const

Returns whether a and b have the same slots, name, output and cost.

QList<QcItemStack> QcClientAnvil::slotStacks() const

Returns the left and right slot and the output, laid out like a machine's slots for the inventory model.