Class SoundDefinition

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

public final class SoundDefinition extends Object
Contains all the data to completely define a sound event.
  • Method Details

    • toJson

      public com.google.gson.JsonObject toJson()
      Returns:
      A new JSON representing this sound
    • getSoundId

      public String getSoundId()
      Returns:
      The id of this sound. The namespace is retrieved from the location of the sounds.json file
    • getSounds

      public List<SoundDefinition.SoundBuilder> getSounds()
      Returns:
      All the sound files to associate with this sound instance
    • getSubtitle

      @Nullable public @Nullable String getSubtitle()
      Returns:
      The subtitle to display when this sound is played
    • addSound

      Adds the specified sound file to this instance.
      Parameters:
      sound - The sound to add
    • subtitle

      public SoundDefinition subtitle(@Nullable @Nullable String subtitle)
      Sets the subtitle to display when this sound is played.
      Parameters:
      subtitle - The subtitle or null to remove the text
    • forSound

      public static SoundDefinition forSound(Supplier<net.minecraft.sounds.SoundEvent> sound)
      Creates a new sound definition for the specified sound event. Also adds a sound file to the definition based on the name of the sound

      NOTE: THE NAMESPACE OF THE SOUND IS IGNORED AND WILL BE ASSIGNED TO THE ONE IN THE FabricSoundProvider

      Parameters:
      sound - The sound to create a full definition for
    • definition

      public static SoundDefinition definition(Supplier<net.minecraft.sounds.SoundEvent> sound)
      Creates a new sound definition for the specified sound event.

      NOTE: THE NAMESPACE OF THE SOUND IS IGNORED AND WILL BE ASSIGNED TO THE ONE IN THE FabricSoundProvider

      Parameters:
      sound - The sound to create a definition for
    • definition

      public static SoundDefinition definition(String sound)
      Creates a new sound definition for the specified sound.
      Parameters:
      sound - The sound to create a definition for
    • sound

      public static SoundDefinition.SoundBuilder sound(Supplier<net.minecraft.sounds.SoundEvent> sound)
      Creates a new sound file definition for the specified sound. The file path is namespace:sounds/id/of/sound.ogg
      Parameters:
      sound - The sound to get a file for
    • sound

      public static SoundDefinition.SoundBuilder sound(net.minecraft.resources.ResourceLocation path)
      Creates a new sound file definition for file at the specified path
      Parameters:
      path - The path to the sound file to add, excluding sounds/