From bf8722e892f9669bdf316d483da538d212398b23 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Sat, 31 Aug 2024 20:56:42 +0200 Subject: Backend: Stop sound errors in console (#2431) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: David Cole <40234707+davidarthurcole@users.noreply.github.com> --- src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt index 70e6242c6..79e320949 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt @@ -20,6 +20,7 @@ object SoundUtils { fun ISound.playSound() { Minecraft.getMinecraft().addScheduledTask { + if (Minecraft.getMinecraft().soundHandler.isSoundPlaying(this)) return@addScheduledTask val gameSettings = Minecraft.getMinecraft().gameSettings val oldLevel = gameSettings.getSoundLevel(SoundCategory.PLAYERS) if (!SkyHanniMod.feature.misc.maintainGameVolume) { @@ -38,7 +39,7 @@ object SoundUtils { } ErrorManager.logErrorWithData( e, "Failed to play a sound", - "soundLocation" to this.soundLocation + "soundLocation" to this.soundLocation, ) } finally { if (!SkyHanniMod.feature.misc.maintainGameVolume) { -- cgit