From 3fb20049b9795dbce8fcb41f234f3b14c719abc9 Mon Sep 17 00:00:00 2001 From: neoapps-dev Date: Thu, 2 Apr 2026 15:24:58 +0300 Subject: [PATCH] feat: Ctrl+Q to drop all stack --- Minecraft.Client/Minecraft.cpp | 3 ++- Minecraft.Client/MultiPlayerLocalPlayer.cpp | 9 ++++++--- Minecraft.Client/MultiPlayerLocalPlayer.h | 2 +- Minecraft.Client/Windows64/KeyboardMouseInput.h | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 2c483a8f..8919f11b 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -3882,7 +3882,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 bf1135d5..edfaf629 100644 --- a/Minecraft.Client/MultiPlayerLocalPlayer.cpp +++ b/Minecraft.Client/MultiPlayerLocalPlayer.cpp @@ -173,9 +173,12 @@ 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; } @@ -483,4 +486,4 @@ void MultiplayerLocalPlayer::StressTestMove(double *tempX, double *tempY, double absMoveTo(nx,ny,nz,yRot,xRot); stressTestCount++; } -#endif \ No newline at end of file +#endif diff --git a/Minecraft.Client/MultiPlayerLocalPlayer.h b/Minecraft.Client/MultiPlayerLocalPlayer.h index 14b0bf42..e7871154 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 9b25c929..23158ed2 100644 --- a/Minecraft.Client/Windows64/KeyboardMouseInput.h +++ b/Minecraft.Client/Windows64/KeyboardMouseInput.h @@ -32,6 +32,7 @@ public: static const int KEY_TOGGLE_HUD = VK_F1; static const int KEY_DEBUG_INFO = VK_F3; static const int KEY_DEBUG_MENU = VK_F4; + static const int KEY_CONTROL = VK_CONTROL; static const int KEY_THIRD_PERSON = VK_F5; static const int KEY_DEBUG_CONSOLE = VK_F6; static const int KEY_HOST_SETTINGS = VK_TAB;