From b39c4b8dd4eb0a55c8254352ab3696bba04562b1 Mon Sep 17 00:00:00 2001 From: socksprox Date: Tue, 27 Oct 2026 02:36:53 +0100 Subject: [PATCH 1/3] mobs: jumpOutOfFluid wants a dry, entity-free box Entity.isFree is noCollision(this, box) && !containsAnyLiquid(box); the check only looked at block collisions, so a mob pressed against a wall by water flow hopped out where vanilla refuses, and it ignored other collidable entities entirely. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- crates/horizon-client/src/mobs/living.rs | 39 ++++++++++++++++++++---- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/crates/horizon-client/src/mobs/living.rs b/crates/horizon-client/src/mobs/living.rs index 394821ace..7331eb344 100644 --- a/crates/horizon-client/src/mobs/living.rs +++ b/crates/horizon-client/src/mobs/living.rs @@ -235,6 +235,26 @@ impl MobWorld<'_> { }; scene.unobstructed(b).unwrap_or(false) } + /// `LevelReader.containsAnyLiquid`: the blocks from the box's minimum + /// corner to the block holding its maximum corner. + pub fn contains_any_liquid(&self, b: Aabb) -> bool { + let (lo, hi) = (b.min_position(), b.max_position()); + let (x0, y0, z0) = ( + lo.x.floor() as i32, + lo.y.floor() as i32, + lo.z.floor() as i32, + ); + let (x1, y1, z1) = ( + hi.x.floor() as i32, + hi.y.floor() as i32, + hi.z.floor() as i32, + ); + (x0..=x1).any(|x| { + (y0..=y1).any(|y| { + (z0..=z1).any(|z| self.facts.get(self.world.block(x, y, z)).fluid != Fluid::None) + }) + }) + } } impl Mob { /// `Entity.refreshDimensions` after growing from `old_w` by `old_h`: @@ -813,14 +833,21 @@ impl Mob { self.velocity.y -= gravity / 4.0; } } - // jumpOutOfFluid + // jumpOutOfFluid: Entity.isFree wants the box dry and clear of + // collidable entities too. let m = self.velocity; + let ahead = self.bounds().move_by(Vec3::new( + m.x, + m.y + f64::from(0.6_f32) - self.position.y + old_y, + m.z, + )); + let wide = ahead.inflate(Vec3::new(1.0e-7, 1.0e-7, 1.0e-7)); if self.horizontal_collision - && w.no_collision(self.bounds().move_by(Vec3::new( - m.x, - m.y + f64::from(0.6_f32) - self.position.y + old_y, - m.z, - ))) + && w.no_collision(ahead) + && !w.contains_any_liquid(ahead) + && !w + .others_near(wide) + .any(|s| s.id != self.id && s.alive && s.bounds.intersects(wide)) { self.velocity.y = f64::from(0.3_f32); } From 2ba33bd1465537b3ee676a30f11134ee895a650a Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 27 Oct 2026 06:21:20 +0100 Subject: [PATCH 2/3] jumpOutOfFluid: only entities a mob collides with block the hop EntityGetter.getEntityCollisions keeps the entities that canBeCollidedWith the mob: among mobs that is a living shulker, not every mob nearby. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/mobs/living.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/horizon-client/src/mobs/living.rs b/crates/horizon-client/src/mobs/living.rs index 7331eb344..bc112e51a 100644 --- a/crates/horizon-client/src/mobs/living.rs +++ b/crates/horizon-client/src/mobs/living.rs @@ -833,8 +833,8 @@ impl Mob { self.velocity.y -= gravity / 4.0; } } - // jumpOutOfFluid: Entity.isFree wants the box dry and clear of - // collidable entities too. + // jumpOutOfFluid: Entity.isFree wants the box dry and clear of the + // entities a mob collides with (canBeCollidedWith: living shulkers). let m = self.velocity; let ahead = self.bounds().move_by(Vec3::new( m.x, @@ -847,7 +847,12 @@ impl Mob { && !w.contains_any_liquid(ahead) && !w .others_near(wide) - .any(|s| s.id != self.id && s.alive && s.bounds.intersects(wide)) + .any(|s| { + s.id != self.id + && s.alive + && s.species == super::Species::Shulker + && s.bounds.intersects(wide) + }) { self.velocity.y = f64::from(0.3_f32); } From ab099b2701d68f61ca534e8fb1b66662183461a6 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 27 Oct 2026 06:28:26 +0100 Subject: [PATCH 3/3] rustfmt Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/mobs/living.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/crates/horizon-client/src/mobs/living.rs b/crates/horizon-client/src/mobs/living.rs index bc112e51a..1e2b0c4ee 100644 --- a/crates/horizon-client/src/mobs/living.rs +++ b/crates/horizon-client/src/mobs/living.rs @@ -845,14 +845,12 @@ impl Mob { if self.horizontal_collision && w.no_collision(ahead) && !w.contains_any_liquid(ahead) - && !w - .others_near(wide) - .any(|s| { - s.id != self.id - && s.alive - && s.species == super::Species::Shulker - && s.bounds.intersects(wide) - }) + && !w.others_near(wide).any(|s| { + s.id != self.id + && s.alive + && s.species == super::Species::Shulker + && s.bounds.intersects(wide) + }) { self.velocity.y = f64::from(0.3_f32); }