From ef16900f3d0e3b7f0301be506861a671fc6369b0 Mon Sep 17 00:00:00 2001 From: Micle Date: Fri, 6 Jun 2025 05:03:32 +0100 Subject: [PATCH] Added config options for ambient sound volume and pitch. --- .../firefly_bush_backport/block/FireflyBushBlock.java | 9 ++++++++- .../dev/micle/firefly_bush_backport/config/Config.java | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/micle/firefly_bush_backport/block/FireflyBushBlock.java b/src/main/java/dev/micle/firefly_bush_backport/block/FireflyBushBlock.java index cac2736..459259e 100644 --- a/src/main/java/dev/micle/firefly_bush_backport/block/FireflyBushBlock.java +++ b/src/main/java/dev/micle/firefly_bush_backport/block/FireflyBushBlock.java @@ -30,7 +30,14 @@ public class FireflyBushBlock extends BushBlock implements BonemealableBlock { if (randomSource.nextInt(Config.Client.bushFireflyAmbientSoundChanceOneIn.get()) == 0 && isMoonVisible(level) && level.getHeight(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, blockPos.getX(), blockPos.getZ()) <= blockPos.getY()) { - level.playLocalSound(blockPos, ModSounds.FIREFLY_BUSH_IDLE.get(), SoundSource.AMBIENT, 1.0F, 1.0F, false); + level.playLocalSound( + blockPos, + ModSounds.FIREFLY_BUSH_IDLE.get(), + SoundSource.AMBIENT, + Config.Client.bushFireflyAmbientSoundVolume.get().floatValue(), + Config.Client.bushFireflyAmbientSoundPitch.get().floatValue(), + false + ); } if ((isMoonVisible(level) || level.getMaxLocalRawBrightness(blockPos) <= Config.Client.bushFireflySpawnMaxBrightnessLevel.get()) && diff --git a/src/main/java/dev/micle/firefly_bush_backport/config/Config.java b/src/main/java/dev/micle/firefly_bush_backport/config/Config.java index 13ace2c..4fd14ef 100644 --- a/src/main/java/dev/micle/firefly_bush_backport/config/Config.java +++ b/src/main/java/dev/micle/firefly_bush_backport/config/Config.java @@ -55,6 +55,8 @@ public final class Config { public static ForgeConfigSpec.DoubleValue bushFireflyVerticalRange; public static ForgeConfigSpec.IntValue bushFireflySpawnMaxBrightnessLevel; public static ForgeConfigSpec.IntValue bushFireflyAmbientSoundChanceOneIn; + public static ForgeConfigSpec.DoubleValue bushFireflyAmbientSoundVolume; + public static ForgeConfigSpec.DoubleValue bushFireflyAmbientSoundPitch; Client(ForgeConfigSpec.Builder builder) { builder.comment("Official settings for the firefly bush.").push("bush"); @@ -68,6 +70,10 @@ public final class Config { .defineInRange("bushFireflySpawnMaxBrightnessLevel", 13, 0, Level.MAX_BRIGHTNESS); bushFireflyAmbientSoundChanceOneIn = builder .defineInRange("bushFireflyAmbientSoundChanceOneIn", 30, 0, Integer.MAX_VALUE); + bushFireflyAmbientSoundVolume = builder + .defineInRange("bushFireflyAmbientSoundVolume", 1.0, 0, Double.MAX_VALUE); + bushFireflyAmbientSoundPitch = builder + .defineInRange("bushFireflyAmbientSoundPitch", 1.0, 0, Double.MAX_VALUE); builder.pop(); }