Interface SoundTypeBuilder.EntryBuilder
- Enclosing interface:
SoundTypeBuilder
@NonExtendable
public static interface SoundTypeBuilder.EntryBuilder
Builder for creating a weighted sound entry that can be played for a particular sound type.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default attentuation distance for a sound (16 blocks).static final floatThe default sound pitch.static final floatThe default sound volume.static final intThe default weight applied to individual sounds. -
Method Summary
Modifier and TypeMethodDescriptionattenuationDistance(int attenuationDistance) Sets the attenuation block distance of the sound.Creates a builder for constructing a new sound entry.ofEvent(RegistryEntry<SoundEvent> event) Creates a builder for constructing a new sound entry.ofEvent(SoundEvent event) Creates a builder for constructing a new sound entry.ofFile(Identifier soundFile) Creates a builder for constructing a new sound entry.pitch(float pitch) Sets the pitch of the sound.preload(boolean preload) Configures whether the sound must be pre-loaded by the game.stream(boolean stream) Configures the sound to be streamed.volume(float volume) Sets the volume of the sound.weight(int weight) Sets the weight or "chance" that this sound has of playing when its parent sound event is called upon.
-
Field Details
-
DEFAULT_VOLUME
static final float DEFAULT_VOLUMEThe default sound volume.- See Also:
-
DEFAULT_PITCH
static final float DEFAULT_PITCHThe default sound pitch.- See Also:
-
DEFAULT_WEIGHT
static final int DEFAULT_WEIGHTThe default weight applied to individual sounds.- See Also:
-
DEFAULT_ATTENUATION_DISTANCE
static final int DEFAULT_ATTENUATION_DISTANCEThe default attentuation distance for a sound (16 blocks).- See Also:
-
-
Method Details
-
create
Creates a builder for constructing a new sound entry.- Parameters:
id- sound file or event
-
ofFile
Creates a builder for constructing a new sound entry.- Parameters:
soundFile- sound file excluding the.oggextension
-
ofEvent
Creates a builder for constructing a new sound entry.- Parameters:
event- the sound event
-
ofEvent
Creates a builder for constructing a new sound entry.- Parameters:
event- the sound event
-
volume
Sets the volume of the sound.Must be a value between
0and1(inclusive).The default volume is
(invalid reference
EntryBuilder.DEFAULT_VOLUME1F).- See Also:
-
pitch
Sets the pitch of the sound.Must be a value between
0.5and2.The default pitch is
(invalid reference
EntryBuilder.DEFAULT_PITCH1F).- See Also:
-
attenuationDistance
Sets the attenuation block distance of the sound.The default attenuation is
(invalid reference
EntryBuilder.DEFAULT_ATTENUATION_DISTANCE16blocks). Setting it to higher will cause the sound to be heard from greater distances. -
weight
Sets the weight or "chance" that this sound has of playing when its parent sound event is called upon.The default weight is
(invalid reference
EntryBuilder.DEFAULT_WEIGHT1). -
stream
Configures the sound to be streamed. This is usually set for longer sounds like music discs to prevent delays when the game tries to play them.The default value is
false. -
preload
Configures whether the sound must be pre-loaded by the game. By default, sounds are only loaded upon playing.Setting this to
truewill cause them to be loaded when the game starts.The default value is
false.
-