From 0e607404d102ec31fde7567f40b666b3db2b91d9 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sat, 24 Oct 2026 22:28:34 +0200 Subject: [PATCH] Pause: the server thread stops ticking its players, not the window The window's own tick doesn't run while paused (the frame loop skips Game::tick), so the two gates added there never fired. What kept going was the server thread: its paused pass still ran tick_guests, the players' doTick, so air, hunger and drowning damage moved on behind the pause menu. Vanilla's IntegratedServer.tickPaused only ticks the connections, and ServerGamePacketListenerImpl.tick skips tickPlayer while the server is paused. tick_lan now does the same: the paused pass keeps the connections and skips tick_guests. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game.rs | 4 ++-- crates/horizon-client/src/game/lan.rs | 11 ++++++++--- crates/horizon-client/src/game/levels.rs | 2 +- crates/horizon-client/src/game/remote.rs | 5 +---- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index 0998eb553..aeeddd58d 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -4147,7 +4147,7 @@ impl Game<'_> { [player.velocity.x, player.velocity.y, player.velocity.z], [player.position.x, player.position.y, player.position.z], ); - if !riding && !self.pause { + if !riding { MotionWorld { entities: &entity_collisions, player, @@ -4413,7 +4413,7 @@ impl Game<'_> { self.resolve_arrivals(); }); } - horizon_client::spans::time("tick_lan", || self.tick_lan()); + horizon_client::spans::time("tick_lan", || self.tick_lan(false)); self.tick_friends(); horizon_client::spans::time("tick_hand", || self.tick_hand()); horizon_client::spans::time("tick_sleep", || self.tick_sleep()); diff --git a/crates/horizon-client/src/game/lan.rs b/crates/horizon-client/src/game/lan.rs index 8bf72abee..8460f54e6 100644 --- a/crates/horizon-client/src/game/lan.rs +++ b/crates/horizon-client/src/game/lan.rs @@ -834,8 +834,11 @@ impl Game<'_> { self.lan_object_states(host_entity, hub, out); } - /// Run the hub for this tick and apply what the guests did. - pub(super) fn tick_lan(&mut self) { + /// Run the hub for this tick and apply what the guests did. While the + /// single player game is `paused` only the connections run + /// (`IntegratedServer.tickPaused`): `ServerGamePacketListenerImpl.tick` + /// skips `tickPlayer`, so no player's air, hunger or damage moves on. + pub(super) fn tick_lan(&mut self, paused: bool) { let Some(mut host) = self.lan.take() else { return; }; @@ -1000,7 +1003,9 @@ impl Game<'_> { host.states = states; } self.lan_flush_effects(&mut host); - self.tick_guests(&mut host); + if !paused { + self.tick_guests(&mut host); + } self.lan_living_flags(&mut host); self.tick_server_travel(&mut host); self.lan_swings(&mut host); diff --git a/crates/horizon-client/src/game/levels.rs b/crates/horizon-client/src/game/levels.rs index 895cda08c..114ee928f 100644 --- a/crates/horizon-client/src/game/levels.rs +++ b/crates/horizon-client/src/game/levels.rs @@ -296,7 +296,7 @@ impl Game<'_> { self.update_dedicated_streaming(); self.update_world(); result = if paused { - self.tick_lan(); + self.tick_lan(true); Ok(()) } else if k == 0 { self.tick() diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index e3eed3f55..32cffa306 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -3175,10 +3175,7 @@ impl Game<'_> { f64::from(head[2]) + 0.5, ); player.velocity = Vec3::ZERO; - } else if !dead && !riding && !self.pause { - // Minecraft.tick skips the level while the game is paused: the window's own - // copy stands still too, so air, hunger and fall prediction do not run ahead - // of the paused server (#1592). + } else if !dead && !riding { player.velocity = player.velocity.add_vector(pushed); MotionWorld { entities: &entity_collisions,