From bce7efaa7267df15417b79c00b5cd3238ebf8273 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 31 Oct 2026 00:43:10 -0500 Subject: [PATCH] Let biome effects choose their sound category IrisEffect played its sound with Player.playSound(location, sound, volume, pitch), which Paper sends on SoundCategory.MASTER, so packs that use effects for biome music or ambience could only be turned down with the master slider. A new soundCategory field (default MASTER, so existing packs sound the same) picks the category: music can follow the music slider, moods the ambient slider. --- .../java/art/arcane/iris/world/entity/IrisEffect.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/art/arcane/iris/world/entity/IrisEffect.java b/core/src/main/java/art/arcane/iris/world/entity/IrisEffect.java index 0c39dd8e0..d41d027cf 100644 --- a/core/src/main/java/art/arcane/iris/world/entity/IrisEffect.java +++ b/core/src/main/java/art/arcane/iris/world/entity/IrisEffect.java @@ -44,6 +44,7 @@ import org.bukkit.World; import org.bukkit.NamespacedKey; import org.bukkit.Particle; import org.bukkit.Sound; +import org.bukkit.SoundCategory; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; @@ -117,6 +118,9 @@ public class IrisEffect { @MaxNumber(512) @Description("The sound volume.") private double volume = 1.5D; + @DependsOn({"sound"}) + @Description("The sound category the sound plays in, which picks the client volume slider that controls it (for example MUSIC, AMBIENT or HOSTILE).") + private SoundCategory soundCategory = SoundCategory.MASTER; @DependsOn({"particleEffect"}) @MinNumber(0) @MaxNumber(512) @@ -240,7 +244,7 @@ public class IrisEffect { Particle particleType = getParticleEffect(); if (soundType != null) { Location part = p.getLocation().clone().add(RNG.r.i(-soundDistance, soundDistance), RNG.r.i(-soundDistance, soundDistance), RNG.r.i(-soundDistance, soundDistance)); - p.playSound(part, soundType, (float) volume, (float) RNG.r.d(minPitch, maxPitch)); + p.playSound(part, soundType, soundCategory, (float) volume, (float) RNG.r.d(minPitch, maxPitch)); } if (particleType != null) { @@ -317,7 +321,7 @@ public class IrisEffect { Particle particleType = getParticleEffect(); if (soundType != null) { Location part = p.getLocation().clone().add(RNG.r.i(-soundDistance, soundDistance), RNG.r.i(-soundDistance, soundDistance), RNG.r.i(-soundDistance, soundDistance)); - p.getWorld().playSound(part, soundType, (float) volume, (float) RNG.r.d(minPitch, maxPitch)); + p.getWorld().playSound(part, soundType, soundCategory, (float) volume, (float) RNG.r.d(minPitch, maxPitch)); } if (particleType != null) {