Merge pull request #1550 from ludovic111/fix/kb1-knockback-yaw

This commit is contained in:
Ludovic Marie
2026-10-24 13:34:45 +02:00
committed by GitHub
2 changed files with 6 additions and 9 deletions
@@ -121,11 +121,13 @@ impl Game<'_> {
let bonus = if knockback_attack { 0.5 } else { 0.0 };
(enchanted / 2.0 + bonus, knockback_attack)
}
/// `causeExtraKnockback`'s direction, `(sin yRot, -cos yRot)`: the target
/// flies where the attacker looks, not away from it.
/// `causeExtraKnockback`'s direction, `(sin yRot, -cos yRot)` from Mth's
/// sine table: the target flies where the attacker looks, not away from
/// it (straight along an axis when the attacker faces one).
pub(super) fn extra_knockback_direction(&self) -> (f64, f64) {
let yaw = self.yaw.to_radians();
(f64::from(yaw.sin()), -f64::from(yaw.cos()))
use horizon_core::geometry::trig;
let yaw = f64::from(self.yaw * trig::DEG_TO_RAD);
(f64::from(trig::sin(yaw)), -f64::from(trig::cos(yaw)))
}
/// The attacker's side of `causeExtraKnockback` as the attacking client
/// sees it: the server's player stops sprinting, and its flag reaches the
-5
View File
@@ -56,12 +56,7 @@ PROPERTIES = {
'pause-when-empty-seconds': '-1',
}
# Cases Horizon still gets wrong, and why.
YAW = "the extra knockback's direction comes from f32 sin/cos, not Mth's sine table (z is -2e-8 a block, not 0)"
KNOWN = {
'cow-sprint': YAW,
'cow-knockback-2': YAW,
'zombie-sprint': YAW,
'zombie-knockback-2': YAW,
'pvp-mace': "a smash on a player runs none of MaceItem.hurtEnemy (the attacker's fall goes on)",
}