diff --git a/crates/horizon-client/src/game/commands/world_cmds.rs b/crates/horizon-client/src/game/commands/world_cmds.rs index 687eb3f88..859d86397 100644 --- a/crates/horizon-client/src/game/commands/world_cmds.rs +++ b/crates/horizon-client/src/game/commands/world_cmds.rs @@ -117,7 +117,8 @@ impl Game<'_> { "drown" => DamageKind::Drown, "magic" | "indirect_magic" | "dragon_breath" => DamageKind::Magic, "sting" => DamageKind::Sting, - "cactus" | "sweet_berry_bush" => DamageKind::Cactus, + "cactus" => DamageKind::Cactus, + "sweet_berry_bush" => DamageKind::SweetBerryBush, "in_wall" => DamageKind::InWall, "thorns" => DamageKind::Thorns, _ => DamageKind::Generic, diff --git a/crates/horizon-client/src/game/creatures.rs b/crates/horizon-client/src/game/creatures.rs index 2b65a3289..04228a722 100644 --- a/crates/horizon-client/src/game/creatures.rs +++ b/crates/horizon-client/src/game/creatures.rs @@ -3283,6 +3283,7 @@ pub(super) fn damage_type(kind: horizon_client::mobs::DamageKind, player: bool) K::Magic => "minecraft:magic", K::Sting => "minecraft:sting", K::Cactus => "minecraft:cactus", + K::SweetBerryBush => "minecraft:sweet_berry_bush", K::Generic => "minecraft:generic", K::InWall => "minecraft:in_wall", K::Thorns => "minecraft:thorns", diff --git a/crates/horizon-client/src/mobs.rs b/crates/horizon-client/src/mobs.rs index 0edcd3620..4498e9b75 100644 --- a/crates/horizon-client/src/mobs.rs +++ b/crates/horizon-client/src/mobs.rs @@ -518,6 +518,8 @@ pub enum DamageKind { Magic, Sting, Cactus, + /// `sweet_berry_bush`. + SweetBerryBush, Generic, InWall, Thorns, @@ -573,7 +575,11 @@ impl Damage { pub fn causes_panic(&self) -> bool { !matches!( self.kind, - DamageKind::Fall | DamageKind::Drown | DamageKind::Generic | DamageKind::InWall + DamageKind::Fall + | DamageKind::Drown + | DamageKind::Generic + | DamageKind::InWall + | DamageKind::SweetBerryBush ) } /// DamageTypeTags.BYPASSES_ARMOR @@ -608,6 +614,7 @@ impl Damage { | DamageKind::Drown | DamageKind::Magic | DamageKind::Cactus + | DamageKind::SweetBerryBush | DamageKind::Generic | DamageKind::InWall | DamageKind::OutOfWorld diff --git a/crates/horizon-client/src/mobs/ai.rs b/crates/horizon-client/src/mobs/ai.rs index ffc74d0b9..458ccd097 100644 --- a/crates/horizon-client/src/mobs/ai.rs +++ b/crates/horizon-client/src/mobs/ai.rs @@ -433,14 +433,20 @@ pub fn tick( /// that hurt or hold a mob: the cactus (`CactusBlock.entityInside`, 1) and the /// sweet berry bush (`SweetBerryBushBlock.entityInside`: stuck at 0.8, 0.75, /// 0.8, and a grown bush pricks for 1 when the mob moved at least 0.003 on X -/// or Z this tick). The blocks are those the mob's box touches where it -/// started the tick and where it ended. +/// or Z this tick). The blocks are those the mob's box touches anywhere along +/// its move this tick, from where it started to where it ended. fn effects_from_blocks(m: &mut Mob, w: &MobWorld) { let mut visited: Vec<[i32; 3]> = Vec::new(); - for at in [m.previous, m.position] { + let travel = m.position.subtract(m.previous); + let longest = travel.x.abs().max(travel.y.abs()).max(travel.z.abs()); + let steps = ((longest / 0.2).ceil() as i32).clamp(1, 100); + for step in 0..=steps { if !m.alive() { return; } + let at = m + .previous + .add_vector(travel.scale(f64::from(step) / f64::from(steps))); let b = m.bounds_at(at).deflate(Vec3::new(1e-5, 1e-5, 1e-5)); for x in b.min_position().x.floor() as i32..=b.max_position().x.floor() as i32 { for y in b.min_position().y.floor() as i32..=b.max_position().y.floor() as i32 { @@ -465,7 +471,7 @@ fn effects_from_blocks(m: &mut Mob, w: &MobWorld) { && (moved.x.abs() >= f64::from(0.003_f32) || moved.z.abs() >= f64::from(0.003_f32)) { - m.damage(1.0, Damage::of(DamageKind::Cactus)); + m.damage(1.0, Damage::of(DamageKind::SweetBerryBush)); } } _ => continue, diff --git a/crates/horizon-client/src/mobs/sulfur_cube.rs b/crates/horizon-client/src/mobs/sulfur_cube.rs index 00b846b86..5a5c2f48a 100644 --- a/crates/horizon-client/src/mobs/sulfur_cube.rs +++ b/crates/horizon-client/src/mobs/sulfur_cube.rs @@ -297,6 +297,7 @@ pub fn accepts_damage(m: &mut Mob, source: &Damage, amount: f32) -> bool { | DamageKind::Fall | DamageKind::Sting | DamageKind::Cactus + | DamageKind::SweetBerryBush ); if immune { if let Some(from) = source.from {