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-273764 The sound does not stop when I'm gliding with the elytra and opening advancements page Resolved MC-277210 Jukebox doesn't stop playing music when viewing advancements screen Resolved MC-277822 When you open the advancement page, the sound effect of the minecart is still ongoing Resolved MC-278276 Jukebox plays when in advancements tab. Resolved MC-278898 When flying with fireworks rockets, pressing the L key to open the progress will continue to play the sound of elytra flight Resolved

Attachments

Comments 10

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]

Dunno why it’s marked as resolved when it’s still occurring in 1.21.7.

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