From ec23aa2b985667268add64f883abb64c4694a0cb Mon Sep 17 00:00:00 2001 From: Alezito2008 Date: Sun, 8 Mar 2026 22:17:55 -0300 Subject: [PATCH] Input: Add Ctrl+Q shortcut to drop entire item stack --- Minecraft.Client/Minecraft.cpp | 3 ++- Minecraft.Client/MultiPlayerLocalPlayer.cpp | 8 ++++++-- Minecraft.Client/MultiPlayerLocalPlayer.h | 2 +- Minecraft.Client/Windows64/KeyboardMouseInput.h | 2 ++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index aa8fa1fa..14184cac 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -3797,7 +3797,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) if((player->ullButtonsPressed&(1LL<isInputAllowed(MINECRAFT_ACTION_DROP)) { - player->drop(); + bool ctrlHeld = g_KBMInput.IsKBMActive() && g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_CONTROL); + player->drop(ctrlHeld); } uint64_t ullButtonsPressed=player->ullButtonsPressed; diff --git a/Minecraft.Client/MultiPlayerLocalPlayer.cpp b/Minecraft.Client/MultiPlayerLocalPlayer.cpp index aef7898f..1c3dadb4 100644 --- a/Minecraft.Client/MultiPlayerLocalPlayer.cpp +++ b/Minecraft.Client/MultiPlayerLocalPlayer.cpp @@ -173,9 +173,13 @@ void MultiplayerLocalPlayer::sendPosition() } -shared_ptr MultiplayerLocalPlayer::drop() +shared_ptr MultiplayerLocalPlayer::drop(bool dropAll) { - connection->send(std::make_shared(PlayerActionPacket::DROP_ITEM, 0, 0, 0, 0)); + int action = dropAll ? + PlayerActionPacket::DROP_ALL_ITEMS : + PlayerActionPacket::DROP_ITEM; + + connection->send(std::make_shared(action, 0, 0, 0, 0)); return nullptr; } diff --git a/Minecraft.Client/MultiPlayerLocalPlayer.h b/Minecraft.Client/MultiPlayerLocalPlayer.h index e660a96a..7adb61cf 100644 --- a/Minecraft.Client/MultiPlayerLocalPlayer.h +++ b/Minecraft.Client/MultiPlayerLocalPlayer.h @@ -35,7 +35,7 @@ public: void sendPosition(); using Player::drop; - virtual shared_ptr drop(); + virtual shared_ptr drop(bool dropStack = false); protected: virtual void reallyDrop(shared_ptr itemEntity); public: diff --git a/Minecraft.Client/Windows64/KeyboardMouseInput.h b/Minecraft.Client/Windows64/KeyboardMouseInput.h index 0f14dfa1..1bdbb3d9 100644 --- a/Minecraft.Client/Windows64/KeyboardMouseInput.h +++ b/Minecraft.Client/Windows64/KeyboardMouseInput.h @@ -32,6 +32,8 @@ public: static const int KEY_DEBUG_INFO = VK_F3; static const int KEY_DEBUG_MENU = VK_F4; + static const int KEY_CONTROL = VK_CONTROL; + void Init(); void Tick(); void ClearAllState();