From f8c1c18e459ef095d392d882b4e8eb218cad6f64 Mon Sep 17 00:00:00 2001 From: Kam Date: Thu, 16 May 2024 14:00:06 -0400 Subject: [PATCH] More Music fixes --- .../npcs/client/controllers/MusicController.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/noppes/npcs/client/controllers/MusicController.java b/src/main/java/noppes/npcs/client/controllers/MusicController.java index d41bd84c9..f58972375 100644 --- a/src/main/java/noppes/npcs/client/controllers/MusicController.java +++ b/src/main/java/noppes/npcs/client/controllers/MusicController.java @@ -7,8 +7,6 @@ import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; public class MusicController { public static MusicController Instance; @@ -42,14 +40,16 @@ public class MusicController { if (this.playDelay > 0) { this.playDelay--; - } else if (Minecraft.getMinecraft().currentScreen != null) { - this.playDelay = 20; } } public void stopMusic(){ SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler(); - soundHandler.stopSounds(); + if (soundHandler != null) { + try { + soundHandler.stopSounds(); + } catch (Exception ignored) {} + } if (this.isPlaying()) { this.playingSound.stopSound(); this.playingSound = null; @@ -60,7 +60,7 @@ public class MusicController { if (this.playDelay > 0) { return; } - this.playDelay = 10; + this.playDelay = 20; if (this.isPlaying(music)) { return; @@ -89,7 +89,7 @@ public class MusicController { if (this.playDelay > 0) { return; } - this.playDelay = 10; + this.playDelay = 20; if (this.isPlaying(music)) { return; @@ -116,7 +116,7 @@ public class MusicController { if (this.playDelay > 0) { return; } - this.playDelay = 10; + this.playDelay = 20; ScriptClientSound clientSound = new ScriptClientSound(music); clientSound.setPos(x, y, z);