From 3c85d2558bddad95e736215b5dda428ed2396297 Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Tue, 27 Oct 2026 11:11:36 +0100 Subject: [PATCH] Tell a server player's client about its velocity after a mace smash --- crates/horizon-client/src/game/lan_actions.rs | 18 +++++++++++++++--- crates/horizon-client/src/game/mace.rs | 3 +++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/crates/horizon-client/src/game/lan_actions.rs b/crates/horizon-client/src/game/lan_actions.rs index ef177d26d..1a1ebaadb 100644 --- a/crates/horizon-client/src/game/lan_actions.rs +++ b/crates/horizon-client/src/game/lan_actions.rs @@ -1567,9 +1567,21 @@ impl Game<'_> { if self.look_at_entity(host, gi, id, None).is_none() { return; } - self.as_guest(host, conn, |g| { - g.attack(); - }); + // A mace's smash sets the attacker's velocity and sends it at once, before the + // Wind Burst's push (MaceItem.hurtEnemy, then the post-attack effects). + let sent = self + .as_guest(host, conn, |g| { + let marked = g + .player + .as_mut() + .is_some_and(|p| std::mem::take(&mut p.health.sync_velocity)); + g.attack(); + let p = g.player.as_mut()?; + let sent = std::mem::replace(&mut p.health.sync_velocity, marked); + sent.then_some(p.velocity) + }) + .flatten(); + self.send_guest_motion(host, conn, sent); // The mob now answers to this guest (game/lan_mobs.rs). if let Ok(id) = u32::try_from(id) { host.mob_players.insert(id, conn); diff --git a/crates/horizon-client/src/game/mace.rs b/crates/horizon-client/src/game/mace.rs index 34c968980..b7d04b265 100644 --- a/crates/horizon-client/src/game/mace.rs +++ b/crates/horizon-client/src/game/mace.rs @@ -181,6 +181,9 @@ impl Game<'_> { return; }; p.velocity = Vec3::new(p.velocity.x, f64::from(0.01f32), p.velocity.z); + // A server player's client is told (ClientboundSetEntityMotionPacket): it moves by + // itself, so without it a Wind Burst's push would add to the speed of the fall. + p.health.sync_velocity = true; // calculateImpactPosition: an earlier impact below the player stays. let impact = match p.impulse.impact_position { Some(at) if at.y <= p.position.y => at,