Package net.minecraftforge.common.data
Class SoundDefinition
- java.lang.Object
-
- net.minecraftforge.common.data.SoundDefinition
-
public final class SoundDefinition extends java.lang.ObjectContains all the data to completely define a sound event.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSoundDefinition.SoundIdentifies a specific sound that has to be played in a sound event, along with all the necessary parameters.static classSoundDefinition.SoundTypeRepresents the type of sound that theSoundDefinition.Soundobject represents.
-
Field Summary
Fields Modifier and Type Field Description private booleanreplaceprivate java.util.List<SoundDefinition.Sound>soundsprivate java.lang.Stringsubtitle
-
Constructor Summary
Constructors Modifier Constructor Description privateSoundDefinition()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SoundDefinitiondefinition()Creates a newSoundDefinition, which will host a set ofSoundDefinition.Sounds and the necessary parameters.SoundDefinitionreplace(boolean replace)Sets whether this definition should replace any other definition for the same sound event previously applied, rather than overwriting it.(package private) com.google.gson.JsonObjectserialize()(package private) java.util.List<SoundDefinition.Sound>soundList()SoundDefinitionsubtitle(java.lang.String subtitle)Sets the language key for the subtitle that will be displayed whenever this sound is being played.SoundDefinitionwith(SoundDefinition.Sound sound)Adds the given sound to this sound definition.SoundDefinitionwith(SoundDefinition.Sound... sounds)Adds the given sounds to this sound definition.
-
-
-
Field Detail
-
sounds
private final java.util.List<SoundDefinition.Sound> sounds
-
replace
private boolean replace
-
subtitle
private java.lang.String subtitle
-
-
Method Detail
-
definition
public static SoundDefinition definition()
Creates a newSoundDefinition, which will host a set ofSoundDefinition.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 java.lang.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
public SoundDefinition with(SoundDefinition.Sound sound)
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
java.util.List<SoundDefinition.Sound> soundList()
-
serialize
com.google.gson.JsonObject serialize()
-
-