Interface SoundTypeBuilder.EntryBuilder

Enclosing interface:
SoundTypeBuilder

@NonExtendable public static interface SoundTypeBuilder.EntryBuilder
Builder for creating a weighted sound entry that can be played for a particular sound type.
  • Field Details

    • DEFAULT_VOLUME

      static final float DEFAULT_VOLUME
      The default sound volume.
      See Also:
    • DEFAULT_PITCH

      static final float DEFAULT_PITCH
      The default sound pitch.
      See Also:
    • DEFAULT_WEIGHT

      static final int DEFAULT_WEIGHT
      The default weight applied to individual sounds.
      See Also:
    • DEFAULT_ATTENUATION_DISTANCE

      static final int DEFAULT_ATTENUATION_DISTANCE
      The default attentuation distance for a sound (16 blocks).
      See Also:
  • Method Details

    • create

      Creates a builder for constructing a new sound entry.
      Parameters:
      id - sound file or event
    • ofFile

      static SoundTypeBuilder.EntryBuilder ofFile(Identifier soundFile)
      Creates a builder for constructing a new sound entry.
      Parameters:
      soundFile - sound file excluding the .ogg extension
    • ofEvent

      static SoundTypeBuilder.EntryBuilder ofEvent(SoundEvent event)
      Creates a builder for constructing a new sound entry.
      Parameters:
      event - the sound event
    • ofEvent

      Creates a builder for constructing a new sound entry.
      Parameters:
      event - the sound event
    • volume

      SoundTypeBuilder.EntryBuilder volume(float volume)
      Sets the volume of the sound.

      Must be a value between 0 and 1 (inclusive).

      The default volume is

      invalid reference
      EntryBuilder.DEFAULT_VOLUME
      (1F).
      See Also:
      • SoundSystem.MIN_VOLUME
      • SoundSystem.MAX_VOLUME
    • pitch

      SoundTypeBuilder.EntryBuilder pitch(float pitch)
      Sets the pitch of the sound.

      Must be a value between 0.5 and 2.

      The default pitch is

      invalid reference
      EntryBuilder.DEFAULT_PITCH
      (1F).
      See Also:
      • SoundSystem.MIN_PITCH
      • SoundSystem.MAX_PITCH
    • attenuationDistance

      SoundTypeBuilder.EntryBuilder attenuationDistance(int attenuationDistance)
      Sets the attenuation block distance of the sound.

      The default attenuation is

      invalid reference
      EntryBuilder.DEFAULT_ATTENUATION_DISTANCE
      (16 blocks). Setting it to higher will cause the sound to be heard from greater distances.
    • weight

      SoundTypeBuilder.EntryBuilder weight(int weight)
      Sets the weight or "chance" that this sound has of playing when its parent sound event is called upon.

      The default weight is

      invalid reference
      EntryBuilder.DEFAULT_WEIGHT
      (1).
    • stream

      SoundTypeBuilder.EntryBuilder stream(boolean stream)
      Configures the sound to be streamed. This is usually set for longer sounds like music discs to prevent delays when the game tries to play them.

      The default value is false.

    • preload

      SoundTypeBuilder.EntryBuilder preload(boolean preload)
      Configures whether the sound must be pre-loaded by the game. By default, sounds are only loaded upon playing.

      Setting this to true will cause them to be loaded when the game starts.

      The default value is false.