From 4c3abd86de2af8c54e3f68594a064108c788be9d Mon Sep 17 00:00:00 2001 From: Alexander Krylov Date: Sat, 24 Oct 2026 22:53:12 +0300 Subject: [PATCH 1/4] Player: the window stops ticking its player while the game is paused Air kept draining behind the Escape menu in singleplayer and the drowning damage landed on closing it. The server pauses (`IntegratedServer::set_paused` reads the flag), but the window's own copy of the player kept running `controlled_simulation_tick` every frame, and that is where `tick_environment_damage` decrements the air and pushes `MotionEvent::Drown`. `Minecraft.tick` skips the level while the game is paused, so both local paths now skip the player's simulation: the client of a server (`tick_remote_level`) and in-frame single player. Keys are already neutral when a screen is open, so this only stops the environment, hunger and fall prediction from running ahead of the paused server. Fixes #1592. Co-Authored-By: Hermes Agent (Nous Research) --- crates/horizon-client/src/game.rs | 2 +- crates/horizon-client/src/game/remote.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index bf8327cc1..0998eb553 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 { + if !riding && !self.pause { MotionWorld { entities: &entity_collisions, player, diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index 32cffa306..e3eed3f55 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -3175,7 +3175,10 @@ impl Game<'_> { f64::from(head[2]) + 0.5, ); player.velocity = Vec3::ZERO; - } else if !dead && !riding { + } 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). player.velocity = player.velocity.add_vector(pushed); MotionWorld { entities: &entity_collisions, 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 2/4] 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, From 7d06aca17ae73c3d36bb67b64ab2bda0998c1f38 Mon Sep 17 00:00:00 2001 From: Alexander Krylov Date: Sat, 24 Oct 2026 23:29:55 +0300 Subject: [PATCH 3/4] Player: also stop sending the state packet while the game is paused Measured on the built branch: it does not stop the drowning from #1592 on its own. Kept because it is what forcing the level to stand still looks like, and the negative result is in the PR. Co-Authored-By: Hermes Agent (Nous Research) --- crates/horizon-client/src/game/remote.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index e3eed3f55..b1e8dfc9d 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -3109,6 +3109,7 @@ impl Game<'_> { // must continue, as well as moves into the unloaded area. if let Some(r) = self.remote.as_ref() && r.loaded_sent + && !self.pause { let input = r.last_input; self.remote_send_state(input); @@ -3243,7 +3244,9 @@ impl Game<'_> { data: 0, })); } - self.remote_send_state(input); + if !self.pause { + self.remote_send_state(input); + } Ok(()) } From 0849283a9da0b3f3178a45c29d50ecec97d381c6 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sat, 24 Oct 2026 23:04:59 +0200 Subject: [PATCH 4/4] Pause: drop the state-packet gates, Game::tick doesn't run while paused The frame loop skips Game::tick while the game is paused, so these never fired; the server thread's paused pass is what moved the player on. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/remote.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index f8ffd6772..32cffa306 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -3109,7 +3109,6 @@ impl Game<'_> { // must continue, as well as moves into the unloaded area. if let Some(r) = self.remote.as_ref() && r.loaded_sent - && !self.pause { let input = r.last_input; self.remote_send_state(input); @@ -3241,9 +3240,7 @@ impl Game<'_> { data: 0, })); } - if !self.pause { - self.remote_send_state(input); - } + self.remote_send_state(input); Ok(()) }