fix: Nether portal trigger and travel sounds not playing (#1523)

This commit is contained in:
dtentiion 2026-04-18 23:47:18 +01:00 committed by GitHub
parent 1a552fbd0c
commit 9167454767
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View file

@ -583,23 +583,26 @@ void SoundEngine::playUI(int iSound, float volume, float pitch)
{ {
U8 szSoundName[256]; U8 szSoundName[256];
wstring name; wstring name;
const char* soundDir;
if (iSound >= eSFX_MAX) if (iSound >= eSFX_MAX)
{ {
strcpy((char*)szSoundName, "Minecraft/"); strcpy((char*)szSoundName, "Minecraft/");
name = wchSoundNames[iSound]; name = wchSoundNames[iSound];
soundDir = "Minecraft";
} }
else else
{ {
strcpy((char*)szSoundName, "Minecraft/UI/"); strcpy((char*)szSoundName, "Minecraft/UI/");
name = wchUISoundNames[iSound]; name = wchUISoundNames[iSound];
soundDir = "Minecraft/UI";
} }
char* SoundName = (char*)ConvertSoundPathToName(name); char* SoundName = (char*)ConvertSoundPathToName(name);
strcat((char*)szSoundName, SoundName); strcat((char*)szSoundName, SoundName);
char basePath[256]; char basePath[256];
sprintf_s(basePath, "Windows64Media/Sound/Minecraft/UI/%s", ConvertSoundPathToName(name)); sprintf_s(basePath, "Windows64Media/Sound/%s/%s", soundDir, ConvertSoundPathToName(name));
char finalPath[256]; char finalPath[256];
sprintf_s(finalPath, "%s.wav", basePath); sprintf_s(finalPath, "%s.wav", basePath);

View file

@ -8,6 +8,9 @@
#include "Settings.h" #include "Settings.h"
#include "PlayerList.h" #include "PlayerList.h"
#include "MultiPlayerLevel.h" #include "MultiPlayerLevel.h"
#include "Minecraft.h"
#include "Common/Audio/SoundEngine.h"
#include "../Minecraft.World/SoundTypes.h"
#include "../Minecraft.World/net.minecraft.network.packet.h" #include "../Minecraft.World/net.minecraft.network.packet.h"
#include "../Minecraft.World/net.minecraft.world.damagesource.h" #include "../Minecraft.World/net.minecraft.world.damagesource.h"
@ -783,6 +786,13 @@ void ServerPlayer::changeDimension(int i)
// 4J: Removed on the advice of the mighty King of Achievments (JV) // 4J: Removed on the advice of the mighty King of Achievments (JV)
// awardStat(GenericStats::portal(), GenericStats::param_portal()); // awardStat(GenericStats::portal(), GenericStats::param_portal());
} }
// play the travel whoosh right before the actual dimension swap
Minecraft *mc = Minecraft::GetInstance();
if (mc != nullptr && mc->soundEngine != nullptr)
{
mc->soundEngine->playUI(eSoundType_PORTAL_TRAVEL, 1, 1.0f);
}
server->getPlayers()->toggleDimension( dynamic_pointer_cast<ServerPlayer>(shared_from_this()), i); server->getPlayers()->toggleDimension( dynamic_pointer_cast<ServerPlayer>(shared_from_this()), i);
lastSentExp = -1; lastSentExp = -1;
lastSentHealth = -1; lastSentHealth = -1;