fix: Nether portal trigger and travel sounds not playing#1523
Open
dtentiion wants to merge 1 commit intoMCLCE:mainfrom
Open
fix: Nether portal trigger and travel sounds not playing#1523dtentiion wants to merge 1 commit intoMCLCE:mainfrom
dtentiion wants to merge 1 commit intoMCLCE:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes nether portal sound effects on Windows 64-bit. The ominous
trigger.oggthat should play when stepping into a portal and thetravel.oggwhoosh that should play during dimension change were both silent. The only portal sound that worked was the ambientportal.ogghum from nearby portal tiles.demo.mp4
Fixes #1516
Changes
Previous Behavior
Standing in a nether portal made no sound at all. Getting teleported to the nether or back to the overworld made no sound either. The assets are present at
Windows64Media/Sound/Minecraft/portal/trigger.oggandWindows64Media/Sound/Minecraft/portal/travel.oggbut nothing would play from them. This was also reported to affect many forks.Root Cause
Two separate bugs on the same code path:
SoundEngine::playUIcorrectly selected the right subdirectory (Minecraft/for non-UI sounds,Minecraft/UI/for UI sounds) when looking up the name in thewchSoundNames/wchUISoundNamestables, but when building the actual file path it always hardcodedMinecraft/UI/:For
PORTAL_TRIGGERandPORTAL_TRAVEL(which live in the non-UI table asportal.trigger/portal.travel) the resolved path wasWindows64Media/Sound/Minecraft/UI/portal/trigger.oggwhich does not exist, soFileExistsreturned false and the function bailed out before playing anything.For nether/end portals, the dimension change is driven by
ServerPlayer::changeDimension(viaEntity::tickon the server), notLocalPlayer::changeDimension.LocalPlayer::changeDimensiononly fires fromTheEndPortaltile, so its call toplayUI(PORTAL_TRAVEL)never ran for regular portal travel.ServerPlayer::changeDimensionhad no equivalent call, so the travel whoosh never got triggered.New Behavior
trigger.oggtravel.oggright before the dimension swap, followed bytrigger.ogga moment later as the player emerges inside the return portalFix Implementation
SoundEngine.cpp-playUI: Store the chosen subdirectory (MinecraftorMinecraft/UI) in a local and use it when buildingbasePath, so non-UI sounds resolve toWindows64Media/Sound/Minecraft/<sound>and UI sounds resolve toWindows64Media/Sound/Minecraft/UI/<sound>.ServerPlayer.cpp-changeDimension: Added aplayUI(eSoundType_PORTAL_TRAVEL)call just beforePlayerList::toggleDimensionso the whoosh plays during the actual dimension swap. Guarded with a null check onMinecraft::GetInstance()andsoundEngineso a headless dedicated server build won't try to play audio.AI Use Disclosure
No AI was used in the development of this pull request.