Class SoundDefinition

java.lang.Object
net.minecraftforge.common.data.SoundDefinition

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

  • Constructor Details

    • SoundDefinition

      private SoundDefinition()
  • Method Details

    • definition

      public static SoundDefinition definition()
      Creates a new SoundDefinition, which will host a set of SoundDefinition.Sounds and the necessary parameters.
    • replace

      public SoundDefinition replace(boolean replace)
      Sets whether this definition should replace any other definition for the same sound event previously applied, rather than overwriting it.
      Parameters:
      replace - Whether this definition replaces or not.
      Returns:
      This definition for chaining.
    • subtitle

      public SoundDefinition subtitle(@Nullable @Nullable String subtitle)
      Sets the language key for the subtitle that will be displayed whenever this sound is being played.

      The subtitle is optional and the game will skip displaying it if it isn't present.

      Parameters:
      subtitle - The subtitle to display, or null to disable.
      Returns:
      This definition for chaining.
    • with

      Adds the given sound to this sound definition.
      Parameters:
      sound - The sound to add.
      Returns:
      This definition for chaining.
    • with

      public SoundDefinition with(SoundDefinition.Sound... sounds)
      Adds the given sounds to this sound definition.
      Parameters:
      sounds - The sounds to add.
      Returns:
      This definition for chaining.
    • soundList

    • serialize

      com.google.gson.JsonObject serialize()