QtCraft API C++ classes QML types Handbook

QcServerCrafting Class

Crafting of the players (decision E-367): the 2 x 2 grid of the inventory and the 3 x 3 grid of a crafting table near them, recipes and repairs taken from the grid (once or as often as possible), recipes crafted straight from the inventory (CraftRecipe) and the grid's items going back into the inventory when it closes. More...

Header: #include <server/gameplay/QcServerCrafting.h>

Public Functions

void closeCrafting(QcServerClient &client)
void craftAll(QcServerClient &client)
void craftRecipe(QcServerClient &client, const QcMsg::CraftRecipe &request)
void openCraftingTable(QcServerClient &client, QcBlockPos pos)
void returnCraftingGrid(QcServerClient &client)
void takeCraftingResult(QcServerClient &client)

Static Public Members

const double craftingTableReach
const int maxCraftAllRounds
std::optional<QcItemStack> resultOf(const QcServerState &state, const QcServerClient &client)

Detailed Description

Member Function Documentation

void QcServerCrafting::closeCrafting(QcServerClient &client)

Closes the crafting screen of client; the grid goes back (returnCraftingGrid()).

void QcServerCrafting::craftAll(QcServerClient &client)

Takes the result of the grid of client into the inventory as often as possible (a shift-click, at most maxCraftAllRounds times).

void QcServerCrafting::craftRecipe(QcServerClient &client, const QcMsg::CraftRecipe &request)

Crafts the recipe of request for client straight from the inventory, up to its count of rounds (at most 64), each round whole or not at all.

void QcServerCrafting::openCraftingTable(QcServerClient &client, QcBlockPos pos)

Opens the 3 x 3 grid of the crafting table at pos for client.

[static] std::optional<QcItemStack> QcServerCrafting::resultOf(const QcServerState &state, const QcServerClient &client)

Returns what the grid of the player client of state makes now (a recipe, a repair or a map copied or zoomed out).

void QcServerCrafting::returnCraftingGrid(QcServerClient &client)

Moves the crafting grid of client into the inventory; what does not fit is thrown on the ground, or deleted in a mode with the item catalogue.

void QcServerCrafting::takeCraftingResult(QcServerClient &client)

Takes the result of the grid of client once into the inventory.

Member Variable Documentation

const double QcServerCrafting::craftingTableReach

Crafting needs a crafting table within this distance for 3 x 3 recipes.

const int QcServerCrafting::maxCraftAllRounds

Shift-clicks on a crafting result take it as often as possible, at most this many times.