Package net.minecraftforge.common.data
Class SoundDefinition
- java.lang.Object
-
- net.minecraftforge.common.data.SoundDefinition
-
public final class SoundDefinition extends java.lang.Object
Contains all the data to completely define a sound event.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SoundDefinition.Sound
Identifies a specific sound that has to be played in a sound event, along with all the necessary parameters.static class
SoundDefinition.SoundType
Represents the type of sound that theSoundDefinition.Sound
object represents.
-
Field Summary
Fields Modifier and Type Field Description private boolean
replace
private java.util.List<SoundDefinition.Sound>
sounds
private java.lang.String
subtitle
-
Constructor Summary
Constructors Modifier Constructor Description private
SoundDefinition()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SoundDefinition
definition()
Creates a newSoundDefinition
, which will host a set ofSoundDefinition.Sound
s and the necessary parameters.SoundDefinition
replace(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.JsonObject
serialize()
(package private) java.util.List<SoundDefinition.Sound>
soundList()
SoundDefinition
subtitle(java.lang.String subtitle)
Sets the language key for the subtitle that will be displayed whenever this sound is being played.SoundDefinition
with(SoundDefinition.Sound sound)
Adds the given sound to this sound definition.SoundDefinition
with(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.Sound
s 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()
-
-