java.lang.Object
net.minecraft.client.resources.sounds.Sound
All Implemented Interfaces:
Weighted<Sound>

public class Sound extends Object implements Weighted<Sound>
  • Field Details

    • SOUND_LISTER

      public static final FileToIdConverter SOUND_LISTER
    • location

      private final ResourceLocation location
    • volume

      private final SampledFloat volume
    • pitch

      private final SampledFloat pitch
    • weight

      private final int weight
    • type

      private final Sound.Type type
    • stream

      private final boolean stream
    • preload

      private final boolean preload
    • attenuationDistance

      private final int attenuationDistance
  • Constructor Details

  • Method Details

    • getLocation

      public ResourceLocation getLocation()
    • getPath

      public ResourceLocation getPath()
    • getVolume

      public SampledFloat getVolume()
    • getPitch

      public SampledFloat getPitch()
    • getWeight

      public int getWeight()
      Specified by:
      getWeight in interface Weighted<Sound>
    • getSound

      public Sound getSound(RandomSource pRandomSource)
      Retrieves the sound associated with the element. The sound is obtained using the provided random source.

      Specified by:
      getSound in interface Weighted<Sound>
      Parameters:
      pRandomSource - the random source used for sound selection
      Returns:
      The sound associated with the element
    • preloadIfRequired

      public void preloadIfRequired(SoundEngine pEngine)
      Preloads the sound if required by the sound engine. This method is called to preload the sound associated with the element into the sound engine, ensuring it is ready for playback.
      Specified by:
      preloadIfRequired in interface Weighted<Sound>
      Parameters:
      pEngine - the sound engine used for sound preloading
    • getType

      public Sound.Type getType()
    • shouldStream

      public boolean shouldStream()
    • shouldPreload

      public boolean shouldPreload()
    • getAttenuationDistance

      public int getAttenuationDistance()
    • toString

      public String toString()
      Overrides:
      toString in class Object