mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
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.
This commit is contained in:
1 parent
c700138b66
commit
bce7efaa72
1 file changed
+6
-2
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user