Dropping from a menu swings the hand

LivingEntity.drop swings the main hand for every drop, so throwing a
slot's item with Q over the inventory, a container or a creative tab
plays the swing (the inventory's player model shows it). Horizon only
swung for the drop key in game; Player.drop's port now swings itself.

Fixes #442

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-16 03:05:26 +02:00
parent d333780478
commit 03fe857ec2
+4 -2
View File
@@ -144,7 +144,7 @@ use horizon_client::{
creative::{Creative, Names},
entities::{Experience, ExperienceOrb, ItemEntity},
environment::Environment,
first_person::Hand,
first_person::{Hand, SwingAnimation},
gfx::{Frame, Renderer},
hud::{HudAtlas, HudBatch, rgba},
hud_layout, hud_overlays,
@@ -1443,13 +1443,15 @@ impl Game<'_> {
return;
};
self.player_drop(thrown);
self.swing_arm();
}
/// `Player.drop`: the statistics and a thrown item entity in front of the player.
fn player_drop(&mut self, thrown: ItemStack) {
let Some(eye) = self.eye_position() else {
return;
};
// LivingEntity.drop: every drop swings the main hand, a menu's
// THROW and a creative tab's drop included.
self.swing_hand(Hand::Main, SwingAnimation::DEFAULT);
// Player.drop: the drop statistics.
self.stats.add("dropped", &thrown.item, thrown.count as i32);
self.stats.custom("drop", 1);