Add files via upload

This commit is contained in:
ethxn 2026-03-17 18:18:25 +08:00 committed by GitHub
parent 3ef6b63dac
commit 994592d01f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1513,15 +1513,21 @@ void Minecraft::run_middle()
}
}
// CHANGED FROM IsKeyPressed SO YOU CAN HOLD TO DROP (after 0.3 sec delay).
static bool wasDown = false;
static std::chrono::steady_clock::time_point pressTime;
bool down = g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_DROP);
if (down)
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_DROP) && g_KBMInput.IsKeyDown(VK_CONTROL))
// TO DROP A STACK
{
localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_DROPALL;
}
else if (down)
// CHANGED FROM IsKeyPressed SO YOU CAN HOLD TO DROP (after 0.3 sec delay).
{
auto now = std::chrono::steady_clock::now();
@ -1536,18 +1542,14 @@ void Minecraft::run_middle()
float held = std::chrono::duration<float>(now - pressTime).count();
if (held > 0.3f)
{
localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_DROP;
}
}
}
wasDown = down;
// TO DROP A STACK
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_DROP) && g_KBMInput.IsKeyDown(VK_CONTROL))
{
localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_DROPALL;
}
if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_CRAFTING) || g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_CRAFTING_ALT))
{
@ -1561,12 +1563,17 @@ void Minecraft::run_middle()
}
}
for (int slot = 0; slot < 9; slot++)
// PREVENTS SWITCHING HOTBAR SLOTS WHEN IN MENUS
if (!ui.GetMenuDisplayed(0))
{
if (g_KBMInput.IsKeyPressed('1' + slot))
for (int slot = 0; slot < 9; slot++)
{
if (localplayers[i]->inventory)
localplayers[i]->inventory->selected = slot;
if (g_KBMInput.IsKeyPressed('1' + slot))
{
if (localplayers[i]->inventory)
localplayers[i]->inventory->selected = slot;
}
}
}
}