mojira.dev
MC-118081

Sounds don't pause when game is paused on some UI screens

The bug

On the pause screen (Esc menu) and its subscreens the game and sounds are paused in singleplayer.

However, there are other UI screens which pause the game, but do not pause the sounds.

Affected screens

  • command block screen

  • sign editing screen (WAI as per MC-261292)

  • book screen

  • advancement screen (opened by pressing L)

How to reproduce

  1. Put a record in a jukebox

  2. Jump and right click a command block
    → ❌ The game will pause (you will stay in mid-air), but the music will keep playing

Code analysis (advancement screen)

By @unknown can be found in this comment

Linked issues

MC-112415 Command block, sign, and book GUI pause the game, but not game music and sounds Resolved MC-144271 Some sounds keep looping when being in sign GUI Resolved MC-155764 If i open a book while i'm flying with elytra. in single player, i can still hear elytra sounds. Resolved MC-159980 While checking Advancements, Bees still buzze Resolved MC-198988 Jukebox don't pause in advancement menu (singleplayer) Resolved

Attachments

Comments 9

Please link this comment in the description

The following is based on a decompiled version of Minecraft 1.12 using MCP 9.40 pre-1.

When a game pausing GUI is opened, for instance the ingame menu, sounds are paused manually with the method call net.minecraft.client.Minecraft.mcSoundHandler.pauseSounds();. However, when the button "L" is pressed, the loop to open the advancements menu doesn't perform this specific method call. Therefore, a simple solution to this problem would be to add the method call to the loop.

Suggested fix

while (this.gameSettings.field_194146_ao.isPressed())
{
    if (this.isSingleplayer() && !this.theIntegratedServer.getPublic())
    {
           this.mcSoundHandler.pauseSounds();
    }
    this.displayGuiScreen(new GuiScreenAdvancements(this.player.connection.func_191982_f()));
}

Can confirm for MC 1.12.1.

Can confirm in 21w03a.

Can confirm in 21w05a.

Can confirm in 21w06a.

Can confirm in 21w07a.

Can confirm in 1.17.1.

Can confirm for MC 1.20.4.
I would like to add that I quit my singleplayer world while flying with an Elytra and the flying sound persisted until I reloaded my resources.

Can confirm in 1.20.5 rc-2 (elytra flying noises and music persist when opening the advancements window using the keybind in-game, for example).

[media]

tryashtar

(Unassigned)

Confirmed

Platform

Low

Sound, UI

advancement, music, sound

Minecraft 1.12 Pre-Release 6, Minecraft 1.12 Pre-Release 7, Minecraft 1.12, Minecraft 1.12.1 Pre-Release 1, Minecraft 1.12.1, ..., 1.20.6, 1.21, 24w40a, 1.21.3, 1.21.4

25w20a

Retrieved