aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
diff options
context:
space:
mode:
authorDavid Cole <40234707+DavidArthurCole@users.noreply.github.com>2024-09-09 05:44:30 -0400
committerGitHub <noreply@github.com>2024-09-09 11:44:30 +0200
commit31134aabbf803ac8f3caf0bff98b12eef8821bc9 (patch)
tree644ed33553e3a2450b0c4c0f5f03510f910abaa4 /src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
parent6b31a0143364c11aada80f511413eb87e0ec7b92 (diff)
downloadskyhanni-31134aabbf803ac8f3caf0bff98b12eef8821bc9.tar.gz
skyhanni-31134aabbf803ac8f3caf0bff98b12eef8821bc9.tar.bz2
skyhanni-31134aabbf803ac8f3caf0bff98b12eef8821bc9.zip
Fix: Sound Utils Over-correction (#2482)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
index f001cfadb..c05b30549 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
@@ -20,7 +20,6 @@ object SoundUtils {
fun ISound.playSound() {
DelayedRun.onThread.execute {
- if (Minecraft.getMinecraft().soundHandler.isSoundPlaying(this)) return@execute
val gameSettings = Minecraft.getMinecraft().gameSettings
val oldLevel = gameSettings.getSoundLevel(SoundCategory.PLAYERS)
if (!SkyHanniMod.feature.misc.maintainGameVolume) {
@@ -28,19 +27,11 @@ object SoundUtils {
}
try {
Minecraft.getMinecraft().soundHandler.playSound(this)
+ } catch (e: IllegalArgumentException) {
+ if (e.message?.startsWith("value already present:") == true) return@execute
+ ErrorManager.logErrorWithData(e, "Failed to play a sound", "soundLocation" to this.soundLocation)
} catch (e: Exception) {
- if (e is IllegalArgumentException) {
- e.message?.let {
- if (it.startsWith("value already present:")) {
- println("SkyHanni Sound error: $it")
- return@execute
- }
- }
- }
- ErrorManager.logErrorWithData(
- e, "Failed to play a sound",
- "soundLocation" to this.soundLocation,
- )
+ ErrorManager.logErrorWithData(e, "Failed to play a sound", "soundLocation" to this.soundLocation)
} finally {
if (!SkyHanniMod.feature.misc.maintainGameVolume) {
gameSettings.setSoundLevel(SoundCategory.PLAYERS, oldLevel)