Class SoundEntry

java.lang.Object
com.github.darksoulq.abyssallib.server.resource.asset.SoundEntry

public class SoundEntry extends Object
Represents a single physical `.ogg` audio variant linked to a broader SoundEvent.

This class handles the specific logic and metadata configurations uniquely assigned to an individual audio file, such as localized volume, weight probabilities, and RAM streaming directives.

  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull SoundEntry
    attenuationDistance(int distance)
    Modifies the distance (in blocks) the sound can traverse before becoming fully attenuated.
    @NotNull SoundEntry
    pitch(float pitch)
    Sets the localized base pitch for this specific variant.
    @NotNull SoundEntry
    preload(boolean preload)
    Forces the client to cache this sound directly into memory during the resource pack loading screen.
    @NotNull SoundEntry
    stream(boolean stream)
    Sets whether this sound should be streamed dynamically from the hard drive.
    @NotNull SoundEntry
    type(@Nullable String type)
    Sets the internal JSON entry type.
    @NotNull SoundEntry
    volume(float volume)
    Sets the localized base volume for this specific variant.
    @NotNull SoundEntry
    weight(int weight)
    Adjusts the RNG chance that this variant is selected when the parent event is triggered.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • volume

      @NotNull public @NotNull SoundEntry volume(float volume)
      Sets the localized base volume for this specific variant.
      Parameters:
      volume - The volume scalar (default is 1.0).
      Returns:
      This SoundEntry instance for chaining.
    • pitch

      @NotNull public @NotNull SoundEntry pitch(float pitch)
      Sets the localized base pitch for this specific variant.
      Parameters:
      pitch - The pitch scalar (default is 1.0).
      Returns:
      This SoundEntry instance for chaining.
    • weight

      @NotNull public @NotNull SoundEntry weight(int weight)
      Adjusts the RNG chance that this variant is selected when the parent event is triggered.
      Parameters:
      weight - The probabilistic weight integer (default is 1).
      Returns:
      This SoundEntry instance for chaining.
    • stream

      @NotNull public @NotNull SoundEntry stream(boolean stream)
      Sets whether this sound should be streamed dynamically from the hard drive.

      This should always be set to true for long music tracks or dialogue to prevent RAM exhaustion.

      Parameters:
      stream - True to stream from disk, false to cache into RAM.
      Returns:
      This SoundEntry instance for chaining.
    • attenuationDistance

      @NotNull public @NotNull SoundEntry attenuationDistance(int distance)
      Modifies the distance (in blocks) the sound can traverse before becoming fully attenuated.
      Parameters:
      distance - The falloff distance integer (default is 16).
      Returns:
      This SoundEntry instance for chaining.
    • preload

      @NotNull public @NotNull SoundEntry preload(boolean preload)
      Forces the client to cache this sound directly into memory during the resource pack loading screen.

      Useful for UI sounds that must trigger instantly without disk delay.

      Parameters:
      preload - True to forcibly load early.
      Returns:
      This SoundEntry instance for chaining.
    • type

      @NotNull public @NotNull SoundEntry type(@Nullable @Nullable String type)
      Sets the internal JSON entry type.
      Parameters:
      type - The type ("file" by default, or "event" to nest existing events).
      Returns:
      This SoundEntry instance for chaining.