类 SoundDefinition.Sound
- 封闭类:
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
-
字段概要
字段修饰符和类型字段说明private int
private static final int
private static final float
private static final boolean
private static final boolean
private static final SoundDefinition.SoundType
private static final float
private static final int
private final ResourceLocation
private float
private boolean
private boolean
private final SoundDefinition.SoundType
private float
private int
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明attenuationDistance
(int attenuationDistance) Sets the attenuation distance of the sound.private boolean
(专用程序包) ResourceLocation
name()
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.(专用程序包) com.google.gson.JsonElement
static SoundDefinition.Sound
sound
(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
(专用程序包) SoundDefinition.SoundType
type()
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.
-
字段详细资料
-
DEFAULT_TYPE
-
DEFAULT_VOLUME
private static final float DEFAULT_VOLUME- 另请参阅:
-
DEFAULT_PITCH
private static final float DEFAULT_PITCH- 另请参阅:
-
DEFAULT_WEIGHT
private static final int DEFAULT_WEIGHT- 另请参阅:
-
DEFAULT_STREAM
private static final boolean DEFAULT_STREAM- 另请参阅:
-
DEFAULT_ATTENUATION_DISTANCE
private static final int DEFAULT_ATTENUATION_DISTANCE- 另请参阅:
-
DEFAULT_PRELOAD
private static final boolean DEFAULT_PRELOAD- 另请参阅:
-
name
-
type
-
volume
private float volume -
pitch
private float pitch -
weight
private int weight -
stream
private boolean stream -
attenuationDistance
private int attenuationDistance -
preload
private boolean preload
-
-
构造器详细资料
-
Sound
-
-
方法详细资料
-
sound
Creates a new sound with the given name and type.- 参数:
name
- The name of the sound to create.type
- The type of sound to create.
-
volume
Sets the volume of this specific sound.The volume of a sound represents how loud the sound is when played.
- 参数:
volume
- The volume to set. It must be higher than 0.- 返回:
- This sound for chaining.
-
volume
Sets the volume of this specific sound.The volume of a sound represents how loud the sound is when played.
- 参数:
volume
- The volume to set. It must be higher than 0.- 返回:
- This sound for chaining.
-
pitch
Sets the pitch of this specific sound.The pitch of a sound represents how high or low the sound is when played.
- 参数:
pitch
- The pitch to set. It must be higher than 0.- 返回:
- This sound for chaining.
-
pitch
Sets the pitch of this specific sound.The pitch of a sound represents how high or low the sound is when played.
- 参数:
pitch
- The pitch to set. It must be higher than 0.- 返回:
- This sound for chaining.
-
weight
Sets 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.
- 参数:
weight
- The weight to set. It must be higher than 0.- 返回:
- This sound for chaining.
-
stream
Sets 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.- 返回:
- This sound for chaining
-
stream
Sets 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).
- 参数:
stream
- Whether the sound should be streamed or not.- 返回:
- This sound for chaining.
-
attenuationDistance
Sets 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.
- 参数:
attenuationDistance
- The attenuation distance to set.- 返回:
- This sound for chaining.
-
preload
Marks 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.- 返回:
- This sound for chaining.
-
preload
Sets 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).- 参数:
preload
- Whether the sound should be preloaded or not.- 返回:
- This sound for chaining.
-
name
ResourceLocation name() -
type
SoundDefinition.SoundType type() -
serialize
com.google.gson.JsonElement serialize() -
canBeInShortForm
private boolean canBeInShortForm() -
stripMcPrefix
-