diff --git a/crates/pumpkin/src/entity/player.rs b/crates/pumpkin/src/entity/player.rs index 5c3b6143d..1baa45540 100644 --- a/crates/pumpkin/src/entity/player.rs +++ b/crates/pumpkin/src/entity/player.rs @@ -1585,7 +1585,11 @@ impl Player { ); if victim.get_living_entity().is_some() { - let mut knockback_strength = 1.0 + f64::from(knockback_level); + // Vanilla `Player.attack` adds `LivingEntity.getKnockback()` - the Knockback + // enchantment bonus, halved - plus 0.5 for a sprint attack, on top of the base + // knockback the victim's damage handling applies. A plain hit adds nothing. + // `handle_knockback` halves `strength`, so these are twice the vanilla amount. + let mut knockback_strength = f64::from(knockback_level); match attack_type { AttackType::Knockback => knockback_strength += 1.0, AttackType::Sweeping => { @@ -1624,7 +1628,10 @@ impl Player { } _ => {} } - if config.knockback { + // Vanilla only pushes the victim when the extra knockback is non-zero; + // `Entity::knockback` halves the current velocity, so calling it with 0.0 + // would still slow the victim down. + if config.knockback && knockback_strength > 0.0 { combat::handle_knockback(attacker_entity, victim.as_ref(), knockback_strength); } }