diff --git a/crates/horizon-client/src/game/nether_portal.rs b/crates/horizon-client/src/game/nether_portal.rs index a30cf822a..353ad216c 100644 --- a/crates/horizon-client/src/game/nether_portal.rs +++ b/crates/horizon-client/src/game/nether_portal.rs @@ -270,6 +270,18 @@ impl Game<'_> { self.portals.player.set_inside(pos, PLAYER_DELAY); self.portals.client_inside = true; } + /// The same on a server's client: `Entity.canUsePortal` (alive, not a + /// passenger), then only the client's `setAsInsidePortal`, which drives + /// the confusion effect (`client_portal_effect`). + pub(super) fn client_inside_nether_portal(&mut self) { + let alive = self + .player + .as_ref() + .is_some_and(|p| !p.health.dead_or_dying()); + if alive && self.riding.is_none() { + self.portals.client_inside = true; + } + } /// `ServerPlayer.handlePortal` (not while changing dimension: there is no /// player then). Players wait `players_nether_portal_default_delay` /// ticks, or the creative delay with invulnerable abilities. diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index 3b272a890..bc199b24b 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -3343,6 +3343,12 @@ impl Game<'_> { self.audio .play("minecraft:entity.player.swim", Some(feet), volume, pitch); } + // NetherPortalBlock.entityInside on the client's own level: + // the portal overlay and its trigger sound (the server moves + // the player). + horizon_client::motion::MotionEvent::InsidePortal { .. } => { + self.client_inside_nether_portal(); + } _ => {} } }