fix: prevent bard song duplication

This commit is contained in:
Kam committed 2025-07-23 05:46:24 -04:00
1 parent 91dc56bf87
commit 297b19b2e5
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) {