QcServerStonecutter Class
The stonecutter's screen in the server (decision E-785), with slots as in the reference: using a stonecutter opens it; the player puts stone into the input slot (QcServerInventory, slot machineInputSlot), chooses one of its stonecutting recipes (decision E-784) and takes the result from the output slot (machineOutputSlot), which uses up one input item; a shift-click takes as often as the input and the inventory's room allow. More...
| Header: | #include <server/machines/QcServerStonecutter.h> |
Public Functions
| QcServerStonecutter(const QcServerStonecutter &) | |
| ~QcServerStonecutter() | |
| void | close(QcServerClient &client, bool notify) |
| bool | open(QcServerClient &client, QcBlockPos pos) |
| void | select(QcServerClient &client, const QcMsg::SelectStonecutterRecipe &request) |
| bool | takeAllOutput(QcServerClient &client, int slot) |
| bool | takeOutput(QcServerClient &client, QcMsg::MoveInventoryItem move) |
| void | update() |
| QcServerStonecutter & | operator=(const QcServerStonecutter &) |
Detailed Description
The screen closes when the stonecutter is gone, out of reach, the player died or became a spectator; the input then goes back to the player.
Member Function Documentation
[delete] QcServerStonecutter::QcServerStonecutter(const QcServerStonecutter &)
The closer registered with QcBlockScreens refers to this object.
[constexpr noexcept default] QcServerStonecutter::~QcServerStonecutter()
Destroys the instance of QcServerStonecutter.
void QcServerStonecutter::close(QcServerClient &client, bool notify)
Gives the input back to client and forgets the screen; notify tells the client (the server closed it). A client that left gets nothing sent.
bool QcServerStonecutter::open(QcServerClient &client, QcBlockPos pos)
Opens the screen of the stonecutter at pos for the player client. Returns false when it is no stonecutter. The input of a screen open elsewhere goes back first; an open machine, chest, cart or trade closes.
void QcServerStonecutter::select(QcServerClient &client, const QcMsg::SelectStonecutterRecipe &request)
Chooses the recipe of request on the open stonecutter of client.
bool QcServerStonecutter::takeAllOutput(QcServerClient &client, int slot)
Handles a shift-click of client on the output slot: takes the output into the inventory as long as the input lasts and each whole output finds room. Returns false when slot is not that slot.
bool QcServerStonecutter::takeOutput(QcServerClient &client, QcMsg::MoveInventoryItem move)
Handles move of client out of the output slot of the open stonecutter: takes the output into the inventory slot move.to (whole, or nothing). Returns false when the move is no such move (another slot, or no stonecutter open), which is then the inventory's.
void QcServerStonecutter::update()
Once per tick: closes the screens that may not stay open.
[delete] QcServerStonecutter &QcServerStonecutter::operator=(const QcServerStonecutter &)
Copy-assigns other to this QcServerStonecutter instance. This function is deleted.