Class SoundDefinition.Sound
- Enclosing class:
- SoundDefinition
If any of the optional parameters (i.e. the ones that aren't required to obtain an instance of this class) are unset, their default values will be used instead. The list of defaults is available in the text that follows:
- Volume: 1.0F
- Pitch: 1.0F
- Weight: 1
- Stream: false
- Attenuation Distance: 16
- Preload: false
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate intprivate static final intprivate static final floatprivate static final booleanprivate static final booleanprivate static final SoundDefinition.SoundTypeprivate static final floatprivate static final intprivate final ResourceLocationprivate floatprivate booleanprivate booleanprivate final SoundDefinition.SoundTypeprivate floatprivate int
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprivateSound(ResourceLocation name, SoundDefinition.SoundType type) 
- 
Method SummaryModifier and TypeMethodDescriptionattenuationDistance(int attenuationDistance) Sets the attenuation distance of the sound.private boolean(package private) ResourceLocationname()pitch(double pitch) Sets the pitch of this specific sound.pitch(float pitch) Sets the pitch of this specific sound.preload()Marks this sound as needing to be preloaded.preload(boolean preload) Sets whether this sound should be preloaded or not.(package private) com.google.gson.JsonElementstatic SoundDefinition.Soundsound(ResourceLocation name, SoundDefinition.SoundType type) Creates a new sound with the given name and type.stream()Sets this sound to a streamed sound.stream(boolean stream) Sets whether this sound should be streamed or not.private String(package private) SoundDefinition.SoundTypetype()volume(double volume) Sets the volume of this specific sound.volume(float volume) Sets the volume of this specific sound.weight(int weight) Sets the weight of this specific sound.
- 
Field Details- 
DEFAULT_TYPE
- 
DEFAULT_VOLUMEprivate static final float DEFAULT_VOLUME- See Also:
 
- 
DEFAULT_PITCHprivate static final float DEFAULT_PITCH- See Also:
 
- 
DEFAULT_WEIGHTprivate static final int DEFAULT_WEIGHT- See Also:
 
- 
DEFAULT_STREAMprivate static final boolean DEFAULT_STREAM- See Also:
 
- 
DEFAULT_ATTENUATION_DISTANCEprivate static final int DEFAULT_ATTENUATION_DISTANCE- See Also:
 
- 
DEFAULT_PRELOADprivate static final boolean DEFAULT_PRELOAD- See Also:
 
- 
name
- 
type
- 
volumeprivate float volume
- 
pitchprivate float pitch
- 
weightprivate int weight
- 
streamprivate boolean stream
- 
attenuationDistanceprivate int attenuationDistance
- 
preloadprivate boolean preload
 
- 
- 
Constructor Details- 
Sound
 
- 
- 
Method Details- 
soundCreates a new sound with the given name and type.- Parameters:
- name- The name of the sound to create.
- type- The type of sound to create.
 
- 
volumeSets the volume of this specific sound.The volume of a sound represents how loud the sound is when played. - Parameters:
- volume- The volume to set. It must be higher than 0.
- Returns:
- This sound for chaining.
 
- 
volumeSets the volume of this specific sound.The volume of a sound represents how loud the sound is when played. - Parameters:
- volume- The volume to set. It must be higher than 0.
- Returns:
- This sound for chaining.
 
- 
pitchSets the pitch of this specific sound.The pitch of a sound represents how high or low the sound is when played. - Parameters:
- pitch- The pitch to set. It must be higher than 0.
- Returns:
- This sound for chaining.
 
- 
pitchSets the pitch of this specific sound.The pitch of a sound represents how high or low the sound is when played. - Parameters:
- pitch- The pitch to set. It must be higher than 0.
- Returns:
- This sound for chaining.
 
- 
weightSets the weight of this specific sound.The weight represents how likely it is for this sound to be played when the respective event is triggered. This value is ignored when there is only one sound per event. - Parameters:
- weight- The weight to set. It must be higher than 0.
- Returns:
- This sound for chaining.
 
- 
streamSets this sound to a streamed sound.In this context, streaming refers to reading the file on disk as needed instead of loading the whole set in memory. This is useful in case of longer sounds, like records and music (usually more than a minute). This is equivalent to a call to stream(boolean)with a value of true.- Returns:
- This sound for chaining
 
- 
streamSets whether this sound should be streamed or not.In this context, streaming refers to reading the file on disk as needed instead of loading the whole set in memory. This is useful in case of longer sounds, like records and music (usually more than a minute). - Parameters:
- stream- Whether the sound should be streamed or not.
- Returns:
- This sound for chaining.
 
- 
attenuationDistanceSets the attenuation distance of the sound.This represents how far this sound will be heard, in blocks. While the specs don't require so, it is suggested to keep this value positive. - Parameters:
- attenuationDistance- The attenuation distance to set.
- Returns:
- This sound for chaining.
 
- 
preloadMarks this sound as needing to be preloaded.A preloaded sound identifies a sound that is loaded in memory as soon as the resource pack is loaded, without having to wait for the sound to be ready to stream. It is suggested to keep this to false, unless you are using it for a highly recurring sound (e.g. underwater ambient sounds).This is equivalent to a call to preload(boolean)with a value of true.- Returns:
- This sound for chaining.
 
- 
preloadSets whether this sound should be preloaded or not.A preloaded sound identifies a sound that is loaded in memory as soon as the resource pack is loaded, without having to wait for the sound to be ready to stream. It is suggested to keep this to false, unless you are using it for a highly recurring sound (e.g. underwater ambient sounds).- Parameters:
- preload- Whether the sound should be preloaded or not.
- Returns:
- This sound for chaining.
 
- 
nameResourceLocation name()
- 
typeSoundDefinition.SoundType type()
- 
serializecom.google.gson.JsonElement serialize()
- 
canBeInShortFormprivate boolean canBeInShortForm()
- 
stripMcPrefix
 
-