diff --git a/source/client/gui/Gui.cpp b/source/client/gui/Gui.cpp index 7c1a5fa..c7eac13 100644 --- a/source/client/gui/Gui.cpp +++ b/source/client/gui/Gui.cpp @@ -536,6 +536,11 @@ int Gui::getNumSlots() return 9; } +int Gui::getNumUsableSlots() +{ + return getNumSlots() - m_pMinecraft->isTouchscreen(); +} + RectangleArea Gui::getRectangleArea(bool b) { float centerX = Minecraft::width / 2; diff --git a/source/client/gui/Gui.hpp b/source/client/gui/Gui.hpp index 27b7959..ddab01f 100644 --- a/source/client/gui/Gui.hpp +++ b/source/client/gui/Gui.hpp @@ -42,7 +42,8 @@ public: void handleClick(int id, int mx, int my); void handleKeyPressed(int keyCode); void renderMessages(bool bShowAll); - int getNumSlots(); + int getNumSlots(); // Gets the number of slots in the inventory. Includes the '...' if in touch mode. + int getNumUsableSlots(); // Gets the number of usable slots in the inventory. Does not include the '...' if in touch mode. RectangleArea getRectangleArea(bool b); public: diff --git a/source/client/gui/screens/IngameBlockSelectionScreen.cpp b/source/client/gui/screens/IngameBlockSelectionScreen.cpp index 3abb08c..e5cd004 100644 --- a/source/client/gui/screens/IngameBlockSelectionScreen.cpp +++ b/source/client/gui/screens/IngameBlockSelectionScreen.cpp @@ -179,7 +179,7 @@ void IngameBlockSelectionScreen::selectSlotAndClose() { Inventory* pInv = getInventory(); - pInv->selectItem(m_selectedSlot, m_pMinecraft->m_gui.getNumSlots()); + pInv->selectItem(m_selectedSlot, m_pMinecraft->m_gui.getNumUsableSlots()); m_pMinecraft->m_pSoundEngine->play("random.click"); m_pMinecraft->setScreen(nullptr);