diff --git a/platforms/common/src/main/java/dynamic_fps/impl/compat/ClothConfig.java b/platforms/common/src/main/java/dynamic_fps/impl/compat/ClothConfig.java index 17b5d87d..b4a71277 100644 --- a/platforms/common/src/main/java/dynamic_fps/impl/compat/ClothConfig.java +++ b/platforms/common/src/main/java/dynamic_fps/impl/compat/ClothConfig.java @@ -102,10 +102,10 @@ public static Screen genConfigScreen(Screen parent) { volumes.add( entryBuilder.startIntSlider( Component.translatable("soundCategory." + name), - (int) (config.volumeMultiplier(source) * 100), + (int) (config.rawVolumeMultiplier(source) * 100), 0, 100 ) - .setDefaultValue((int) (standard.volumeMultiplier(source) * 100)) + .setDefaultValue((int) (standard.rawVolumeMultiplier(source) * 100)) .setSaveConsumer(value -> config.setVolumeMultiplier(source, value / 100f)) .setTextGetter(ClothConfig::volumeMultiplierMessage) .build() diff --git a/platforms/common/src/main/java/dynamic_fps/impl/config/Config.java b/platforms/common/src/main/java/dynamic_fps/impl/config/Config.java index f55f7a77..1a9d2f4a 100644 --- a/platforms/common/src/main/java/dynamic_fps/impl/config/Config.java +++ b/platforms/common/src/main/java/dynamic_fps/impl/config/Config.java @@ -33,14 +33,14 @@ public void setFrameRateTarget(int value) { } public float volumeMultiplier(SoundSource source) { - if (this.getVolumeMultiplier(SoundSource.MASTER) == 0.0f) { + if (this.rawVolumeMultiplier(SoundSource.MASTER) == 0.0f) { return 0.0f; } else { - return this.getVolumeMultiplier(source); + return this.rawVolumeMultiplier(source); } } - private float getVolumeMultiplier(SoundSource source) { + public float rawVolumeMultiplier(SoundSource source) { return this.volumeMultipliers.getOrDefault(source, 1.0f); } diff --git a/platforms/common/src/main/java/dynamic_fps/impl/mixin/SoundEngineMixin.java b/platforms/common/src/main/java/dynamic_fps/impl/mixin/SoundEngineMixin.java index 3de66308..79454672 100644 --- a/platforms/common/src/main/java/dynamic_fps/impl/mixin/SoundEngineMixin.java +++ b/platforms/common/src/main/java/dynamic_fps/impl/mixin/SoundEngineMixin.java @@ -105,10 +105,7 @@ private float calculateVolume(SoundInstance instance) { */ @Inject(method = { "play", "playDelayed" }, at = @At("HEAD"), cancellable = true) private void play(SoundInstance instance, CallbackInfo callbackInfo) { - float master = DynamicFPSMod.volumeMultiplier(SoundSource.MASTER); - float source = DynamicFPSMod.volumeMultiplier(instance.getSource()); - - if (master == 0.0f || source == 0.0f) { + if (DynamicFPSMod.volumeMultiplier(instance.getSource()) == 0.0f) { callbackInfo.cancel(); } }