Use: no block placing or item use while an item is in use

Minecraft.handleKeybinds only calls startUseItem while the player is not
using an item: use clicks are consumed and held use doesn't repeat. Horizon
repeated held use every 4 ticks regardless, so with a shield raised in the off
hand, aiming at a block placed the main hand's block (or spawn egg, boat...).

Fixes #1050

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-21 20:13:59 +02:00
parent caeffffb94
commit 2c47e79cc7
+6 -1
View File
@@ -4154,8 +4154,11 @@ impl Game<'_> {
});
horizon_client::spans::time("tick_particles", || self.tick_particles());
}
// Minecraft.handleKeybinds: held use repeats only while no item is in
// use (a raised shield or a drawn bow places and uses nothing).
if self.right
&& self.use_delay == 0
&& self.using.is_none()
&& self.screen == Screen::Playing
&& self.sleeping.is_none()
{
@@ -9830,7 +9833,9 @@ impl Game<'_> {
self.toggles
.button(3, pressed, false, self.settings.toggle_use);
self.right = self.toggles.is_down(3);
if pressed {
// handleKeybinds consumes use clicks without acting while an
// item is in use.
if pressed && self.using.is_none() {
self.use_with_hand()?;
self.use_delay = 4;
}