From 40f8b9600d3f54a55d73b02151485664cffbdaed Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 27 Oct 2026 06:34:02 +0100 Subject: [PATCH] Shulker canStayAt: only collidable entities block the shell Level.noCollision(shulker, box) keeps the entities whose canBeCollidedWith is true for the shulker: living shulkers and adult happy ghasts (boats and minecarts too, outside the mob world). Players and other mobs never stop a shulker from opening or landing. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/mobs/shulker.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/crates/horizon-client/src/mobs/shulker.rs b/crates/horizon-client/src/mobs/shulker.rs index d5bdb6888..32f952e15 100644 --- a/crates/horizon-client/src/mobs/shulker.rs +++ b/crates/horizon-client/src/mobs/shulker.rs @@ -89,9 +89,10 @@ fn progress_aabb(direction: u8, from: f64, to: f64, pos: Vec3) -> Aabb { )) .move_by(pos) } -/// `Level.noCollision(entity, aabb)`: no block collision under the empty -/// context, and no entity `m` can be collided with overlaps (other mobs, -/// and the player when they are not a spectator). +/// `Level.noCollision(shulker, aabb)`: no block collision under the empty +/// context, and none of the entities a shulker collides with overlaps +/// (`canBeCollidedWith`: living shulkers and adult happy ghasts; players +/// and other mobs never block it). fn no_collision(m: &Mob, w: &MobWorld, bounds: Aabb) -> bool { let mut scene = crate::collisions::SceneCollisions { world: w.world, @@ -102,15 +103,12 @@ fn no_collision(m: &Mob, w: &MobWorld, bounds: Aabb) -> bool { return false; } let grown = bounds.inflate(Vec3::new(1.0e-7, 1.0e-7, 1.0e-7)); - if let Some(p) = &w.player - && p.alive - && !p.spectator - && p.bounds.intersects(grown) - { - return false; - } - !w.others_near(grown) - .any(|s| s.id != m.id && s.alive && s.bounds.intersects(grown)) + !w.others_near(grown).any(|s| { + s.id != m.id + && s.alive + && (s.species == Species::Shulker || (s.species == Species::HappyGhast && !s.baby)) + && s.bounds.intersects(grown) + }) } /// `Shulker.canStayAt`: an empty spot against a sturdy face, with room /// for the fully opened shell (`canStayAt`).