diff options
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java | 6 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt | 8 |
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) + } } } } |