Private
Public Access
1
0

Added config options for ambient sound volume and pitch.

This commit is contained in:
2025-06-06 05:03:32 +01:00
parent 8285026150
commit ef16900f3d
2 changed files with 14 additions and 1 deletions

View File

@ -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()) &&

View File

@ -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();
}