aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt8
2 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java
index 5dc2aa5a0..cc606e7aa 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java
@@ -276,4 +276,10 @@ public class MiscConfig {
@Accordion
@Expose
public HideFarEntitiesConfig hideFarEntities = new HideFarEntitiesConfig();
+
+ @Expose
+ @ConfigOption(name = "Maintain Volume During Warnings", desc = "Do not change game volume levels when warning sounds are played.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean maintainGameVolume = false;
}
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)
+ }
}
}
}