Interface SoundSpec

All Known Implementing Classes:
SoundSpec.Choice, SoundSpec.Fixed, SoundSpec.Range, SoundSpec.Silent

public sealed interface SoundSpec permits SoundSpec.Fixed, SoundSpec.Range, SoundSpec.Choice, SoundSpec.Silent
Polymorphic sound description: a fixed sound, a sound with pitch/volume ranges, a uniform-random choice among other specs, or silence. Resolves to an Adventure Sound at fire time (or null if silent).
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    Picks uniformly among other specs on each play.
    static final record 
    A sound played at a fixed volume and pitch.
    static final record 
    A sound whose volume and pitch are sampled from a range on each play.
    static final record 
    Plays nothing.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable Sound
    Resolves this spec into a playable sound.
  • Method Details

    • resolve

      @Nullable @Nullable Sound resolve(RandomGenerator random)
      Resolves this spec into a playable sound.
      Parameters:
      random - generator used to pick an option and sample any ranges
      Returns:
      the sound to play, or null for SoundSpec.Silent