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-06-23 12:31:23 -0400
committerGitHub <noreply@github.com>2024-06-23 18:31:23 +0200
commit78f5f7b94bdc48c3395ef17f30022b8cd653a776 (patch)
tree88c172ad79fdb814d1f54c1f0af7eff753ac637f /src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
parentb08dc623846886802093f0a00893ed96dc248ea9 (diff)
downloadskyhanni-78f5f7b94bdc48c3395ef17f30022b8cd653a776.tar.gz
skyhanni-78f5f7b94bdc48c3395ef17f30022b8cd653a776.tar.bz2
skyhanni-78f5f7b94bdc48c3395ef17f30022b8cd653a776.zip
Feature: Add option to maintain sound levels during SoundUtils usage (#2129)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
index 423747b79..70e6242c6 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
@@ -22,7 +22,9 @@ object SoundUtils {
Minecraft.getMinecraft().addScheduledTask {
val gameSettings = Minecraft.getMinecraft().gameSettings
val oldLevel = gameSettings.getSoundLevel(SoundCategory.PLAYERS)
- gameSettings.setSoundLevel(SoundCategory.PLAYERS, 1f)
+ if (!SkyHanniMod.feature.misc.maintainGameVolume) {
+ gameSettings.setSoundLevel(SoundCategory.PLAYERS, 1f)
+ }
try {
Minecraft.getMinecraft().soundHandler.playSound(this)
} catch (e: Exception) {
@@ -39,7 +41,9 @@ object SoundUtils {
"soundLocation" to this.soundLocation
)
} finally {
- gameSettings.setSoundLevel(SoundCategory.PLAYERS, oldLevel)
+ if (!SkyHanniMod.feature.misc.maintainGameVolume) {
+ gameSettings.setSoundLevel(SoundCategory.PLAYERS, oldLevel)
+ }
}
}
}