From e2dd6b67df6f5ba03393e56f2f1e66fd88dc6613 Mon Sep 17 00:00:00 2001 From: levzzz <86072227+levzzz5154@users.noreply.github.com> Date: Sat, 24 Oct 2026 15:56:12 +0500 Subject: [PATCH] Make boats solid to players Boats join happy ghasts in the player's entity collision list, so a player can't walk through a boat and steps up onto it. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game.rs | 4 ++-- crates/horizon-client/src/game/consume.rs | 2 +- crates/horizon-client/src/game/ghasts.rs | 13 ++++++++++--- crates/horizon-client/src/game/remote.rs | 4 ++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index fe3f43401..93064d0fe 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -4102,7 +4102,7 @@ impl Game<'_> { self.tick_riding(keys)?; } let riding = self.riding.is_some(); - let ghast_collisions = self.happy_ghast_player_collisions(); + let entity_collisions = self.player_entity_collisions(); let spin_targets = self.spin_targets(); self.sync_player_body(); let Some(player) = self.player.as_mut() else { @@ -4149,7 +4149,7 @@ impl Game<'_> { ); if !riding { MotionWorld { - entities: &ghast_collisions, + entities: &entity_collisions, player, scene: &mut self.world, assets: &self.pack.assets, diff --git a/crates/horizon-client/src/game/consume.rs b/crates/horizon-client/src/game/consume.rs index 50b1fa814..93d919911 100644 --- a/crates/horizon-client/src/game/consume.rs +++ b/crates/horizon-client/src/game/consume.rs @@ -128,7 +128,7 @@ impl Game<'_> { if self.state_in_tag(avoid, ground) { return false; } - let entities = self.happy_ghast_player_collisions(); + let entities = self.player_entity_collisions(); let Some(player) = self.player.as_mut() else { return false; }; diff --git a/crates/horizon-client/src/game/ghasts.rs b/crates/horizon-client/src/game/ghasts.rs index 8ce0a4231..48cbffa6b 100644 --- a/crates/horizon-client/src/game/ghasts.rs +++ b/crates/horizon-client/src/game/ghasts.rs @@ -10,9 +10,10 @@ use horizon_core::geometry::{Aabb, Vec3}; use horizon_world::registry::BlockStateId; impl Game<'_> { - /// Client `EntityGetter.getEntityCollisions`: only solid happy ghasts, - /// excluding the player's own vehicle. - pub(super) fn happy_ghast_player_collisions(&self) -> Vec { + /// Client `EntityGetter.getEntityCollisions` for the player: the + /// entities that `canBeCollidedWith` it, solid happy ghasts and boats + /// (`AbstractBoat.canBeCollidedWith`), except the player's own vehicle. + pub(super) fn player_entity_collisions(&self) -> Vec { let Some(p) = &self.player else { return Vec::new(); }; @@ -24,6 +25,12 @@ impl Game<'_> { && happy_ghast::collides_with_player(m, p.position.y) }) .map(|m| m.bounds()) + .chain( + self.boats + .iter() + .filter(|b| Some(b.id) != self.riding) + .map(super::boats::Boat::bounds), + ) .collect() } /// `HappyGhast.mobInteract`. Returns whether the click was used. diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index d831d92f8..77cb40d11 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -3072,7 +3072,7 @@ impl Game<'_> { self.sleep_timer = super::tick_sleep_timer(self.sleep_timer, self.sleeping.is_some()); // Gui.tick: the titles, the action bar and the held item's name. self.tick_hud(); - let ghast_collisions = self.happy_ghast_player_collisions(); + let entity_collisions = self.player_entity_collisions(); let pushed = self.remote_pushes(); let Some(player) = self.player.as_mut() else { return Ok(()); @@ -3156,7 +3156,7 @@ impl Game<'_> { } else if !dead && !riding { player.velocity = player.velocity.add_vector(pushed); MotionWorld { - entities: &ghast_collisions, + entities: &entity_collisions, player, scene: &mut self.world, assets: &self.pack.assets,