diff --git a/src/client/gui/screens/crafting/PaneCraftingScreen.cpp b/src/client/gui/screens/crafting/PaneCraftingScreen.cpp index 4a23720..b07c1e6 100755 --- a/src/client/gui/screens/crafting/PaneCraftingScreen.cpp +++ b/src/client/gui/screens/crafting/PaneCraftingScreen.cpp @@ -19,6 +19,9 @@ #include "network/RakNetInstance.h" #include "network/packet/WantCreatePacket.h" #include "platform/input/Keyboard.h" +#include +#include +#include static NinePatchLayer* guiPaneFrame = NULL; @@ -195,6 +198,26 @@ void PaneCraftingScreen::setupPositions() { } void PaneCraftingScreen::tick() { + if (minecraft->isOnline()) { + // TODO: Make better algorithm + static std::map oldMap = {}; + std::map newMap = {}; + + for (int i = Inventory::MAX_SELECTION_SIZE; i < minecraft->player->inventory->getContainerSize(); ++i) { + auto itm = minecraft->player->inventory->getItem(i); + + if (itm != NULL) { + newMap[itm->id] += itm->count; + } + } + + if (oldMap != newMap) { + oldMap = newMap; + newMap = {}; + recheckRecipes(); + } + } + if (pane) pane->tick(); }