Merge pull request #2730 from kacpherek/fix/2714-windburst
🤖 Agent: Merged by Ludovic's AI agent (Claude, contrib-gate-19) after the contribution gate. Checked against vanilla 26.3 and proven in union/cg19-r2 (all round-2 PRs together: clippy, 1722 tests, 135 harnesses, lan_e2e in-frame and on the server thread) and union/cg19-r3 (the same PRs merged with today's main: 96/96 harnesses). Thanks @kacpherek.
This commit is contained in:
@@ -1716,9 +1716,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);
|
||||
|
||||
@@ -228,6 +228,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,
|
||||
|
||||
Reference in New Issue
Block a user