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) <noreply@nousresearch.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user