Merge pull request #189 from KAMKEEL/codex/fix-sound-duplication-issue-with-bard-npc

Fix bard sound duplication
This commit is contained in:
Kam authored and GitHub committed 2025-07-23 05:46:42 -04:00
commit 9b3c8031e7
1 file changed
+11 -5
@@ -56,16 +56,22 @@ public class MusicController {
public void stopMusic() {
SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
if (soundHandler != null) {
if (this.playingSound != null) {
if (soundHandler != null) {
try {
soundHandler.stopSound(this.playingSound);
} catch (Exception ignored) {
}
}
this.playingSound.stopSound();
this.sounds.remove(this.playingSound.sound);
this.playingSound = null;
} else if (soundHandler != null) {
try {
soundHandler.stopSounds();
} catch (Exception ignored) {
}
}
if (this.playingSound != null) {
this.playingSound.stopSound();
this.playingSound = null;
}
}
public void playMusicJukebox(String music, Entity entity, int offRange) {