Map mouse right click to ACTION_MENU_X for inventory half-stack

Right clicking an item stack in Java Edition picks up half of it.
Console Edition already handles this via ACTION_MENU_X (the X button
on controller), which sets buttonNum=1 in handleKeyDown. This maps
mouse right click to that same action so KBM players get the same
behavior across all container menus (inventory, chests, furnaces,
hoppers, etc).
This commit is contained in:
MrTheShy 2026-03-06 05:40:32 +01:00
parent ddc9b6ca21
commit c684f5e962

View file

@ -1303,6 +1303,14 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
}
}
// Right click → ACTION_MENU_X (pick up half stack in inventory)
if (key == ACTION_MENU_X && !g_KBMInput.IsMouseGrabbed())
{
if (g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_RIGHT)) { pressed = true; down = true; }
if (g_KBMInput.IsMouseButtonReleased(KeyboardMouseInput::MOUSE_RIGHT)) { released = true; down = false; }
if (!pressed && !released && g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_RIGHT)) { down = true; }
}
// Scroll wheel for list scrolling — only consume the wheel value when the
// action key actually matches, so the other direction isn't lost.
if (!g_KBMInput.IsMouseGrabbed() && (key == ACTION_MENU_OTHER_STICK_UP || key == ACTION_MENU_OTHER_STICK_DOWN))