java.lang.Object
io.github.vampirestudios.vampirelib.api.datagen.SoundBuilder

public class SoundBuilder extends Object
Utility class for building a sound entry with a given set of properties, without necessarily passing them all as parameters.
  • Method Details

    • getName

      public net.minecraft.resources.ResourceLocation getName()
    • sound

      public static SoundBuilder sound(net.minecraft.resources.ResourceLocation name)
      Build an entry corresponding to a sound file.
      Parameters:
      name - The name of the sound as a namespaced ID with relative folder path.
    • event

      public static SoundBuilder event(net.minecraft.resources.ResourceLocation name)
      Build an entry corresponding to an existing SoundEvent.
      Parameters:
      name - The ID of the sound event.
    • setVolume

      public SoundBuilder setVolume(float volume)
      Sets the volume that the sound should play at as a number between 0.0 and 1.0. Defaults to 1.0.
    • setPitch

      public SoundBuilder setPitch(float pitch)
      Sets the pitch that the sound should play at. Note that this is internally clamped in-game between 0.5 and 2.0.
    • setWeight

      public SoundBuilder setWeight(int weight)
      Sets how much likelier it should be for this sound to play. For example, setting this to 2 will mean that this sound is twice as likely to play for this event.
    • stream

      public SoundBuilder stream()
      Dictates that this sound should be streamed from its file. Recommended for sounds with a much longer play time than a couple of seconds, such as music tracks, in order to minimise lag. If set, only 4 instances of this sound can play in-game at once.
    • setAttenuationDistance

      public SoundBuilder setAttenuationDistance(int attenuationDistance)
      Sets the reduction rate of this sound depending on distance from the source. Defaults to 16.
    • preload

      public SoundBuilder preload()
      Dictates that this sound should be loaded in advance when loading the resource pack containing it rather than when the sound itself plays.
    • build

      public com.google.gson.JsonElement build()