* Fix the "selecting the '...' slot" bug

This commit is contained in:
iProgramInCpp
2023-11-04 00:11:40 +02:00
parent 3e8650761b
commit 5bba109b68
3 changed files with 8 additions and 2 deletions

View File

@@ -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;

View File

@@ -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:

View File

@@ -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);