@ApiStatus.NonExtendable
public interface SoundEntry
extends net.kyori.adventure.key.Keyed, net.kyori.examination.Examinable
SoundEvent,
when a sound event is called, a random sound is
selected to be played| Modifier and Type | Interface and Description |
|---|---|
static interface |
SoundEntry.Builder
Mutable and fluent-style builder for
SoundEntry
instances, since it has a lot of parameters, we create
a builder for ease its creation |
static class |
SoundEntry.Type
Specifies the type of
SoundEntry |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_ATTENUATION_DISTANCE |
static float |
DEFAULT_PITCH |
static boolean |
DEFAULT_PRELOAD |
static boolean |
DEFAULT_STREAM |
static SoundEntry.Type |
DEFAULT_TYPE |
static float |
DEFAULT_VOLUME |
static int |
DEFAULT_WEIGHT |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allDefault()
Determines if the sound has all its properties
with the default values
|
int |
attenuationDistance()
Returns the attenuation distance, which modifies the
sound reduction rate based on distance
|
static @NotNull SoundEntry.Builder |
builder()
Deprecated.
Use
soundEntry() instead |
static @NotNull SoundEntry |
event(@NotNull net.kyori.adventure.key.Key name,
float volume,
float pitch,
int weight,
boolean stream,
int attenuationDistance,
boolean preload)
Deprecated.
Use the builder instead
|
static SoundEntry |
event(@NotNull java.lang.String name,
float volume,
float pitch,
int weight,
boolean stream,
int attenuationDistance,
boolean preload)
Deprecated.
Use the builder instead
|
@NotNull net.kyori.adventure.key.Key |
key()
Returns the path to this sound file, starting
from assets/<namespace>/sounds folder or
another sound event key
|
default @NotNull java.lang.String |
name()
Deprecated.
Use
key() instead |
float |
pitch()
Returns the sound pitch, can be higher or
lower than zero or one
|
boolean |
preload()
Determines whether this sound should be loaded when
loading the pack instead of when the sound is played
|
static @NotNull SoundEntry |
sound(@NotNull net.kyori.adventure.key.Key path,
float volume,
float pitch,
int weight,
boolean stream,
int attenuationDistance,
boolean preload)
Deprecated.
Use the builder instead
|
static @NotNull SoundEntry.Builder |
soundEntry()
Static factory method for our builder implementation
|
static @NotNull SoundEntry |
soundEntry(@NotNull Sound sound)
Creates a new
SoundEntry from the given
sound. |
static @NotNull SoundEntry |
soundEntry(@NotNull SoundEvent soundEvent)
Creates a new
SoundEntry from the given
sound event. |
boolean |
stream()
Returns true if this sound should be streamed from its file.
|
@NotNull SoundEntry.Builder |
toBuilder()
Converts this sound entry instance to its builder type,
with all the properties already set
|
@NotNull SoundEntry.Type |
type()
Returns the sound type, which determines how
to interpret the
name() property |
float |
volume()
Returns the volume for playing this sound.
|
int |
weight()
Returns the chance that this sound is selected to
play when this sound event is triggered
|
static @NotNull SoundEntry |
withDefaultValues(@NotNull Sound sound)
Deprecated.
Use
soundEntry(Sound) instead |
static final float DEFAULT_VOLUME
static final float DEFAULT_PITCH
static final int DEFAULT_WEIGHT
static final boolean DEFAULT_STREAM
static final int DEFAULT_ATTENUATION_DISTANCE
static final boolean DEFAULT_PRELOAD
static final SoundEntry.Type DEFAULT_TYPE
@Deprecated @ApiStatus.ScheduledForRemoval(inVersion="2.0.0") @NotNull static @NotNull SoundEntry sound(@NotNull @NotNull net.kyori.adventure.key.Key path, float volume, float pitch, int weight, boolean stream, int attenuationDistance, boolean preload)
SoundEntry from the given
properties, using SoundEntry.Type.FILE as
sound typepath - The sound file pathvolume - The sound volume (0-1)pitch - The sound pitchweight - The sound weightstream - True if the sound should be streamedattenuationDistance - The sound attenuation distancepreload - True if the sound should be preloaded@NotNull static @NotNull SoundEntry soundEntry(@NotNull @NotNull Sound sound)
SoundEntry from the given
sound.sound - The sound@NotNull static @NotNull SoundEntry soundEntry(@NotNull @NotNull SoundEvent soundEvent)
SoundEntry from the given
sound event.soundEvent - The sound event@Deprecated @ApiStatus.ScheduledForRemoval(inVersion="2.0.0") @NotNull static @NotNull SoundEntry withDefaultValues(@NotNull @NotNull Sound sound)
soundEntry(Sound) insteadSoundEntry from the given
sound.sound - The sound@Deprecated @ApiStatus.ScheduledForRemoval(inVersion="2.0.0") @NotNull static @NotNull SoundEntry event(@NotNull @NotNull net.kyori.adventure.key.Key name, float volume, float pitch, int weight, boolean stream, int attenuationDistance, boolean preload)
SoundEntry from the given
properties, using SoundEntry.Type.EVENT as
sound typename - The sound event namevolume - The sound volume (0-1)pitch - The sound pitchweight - The sound weightstream - True if the sound should be streamedattenuationDistance - The sound attenuation distancepreload - True if the sound should be preloaded@Deprecated @ApiStatus.ScheduledForRemoval(inVersion="2.0.0") static SoundEntry event(@NotNull @NotNull java.lang.String name, float volume, float pitch, int weight, boolean stream, int attenuationDistance, boolean preload)
SoundEntry from the given
properties, using SoundEntry.Type.EVENT as
sound typename - The sound event namevolume - The sound volume (0-1)pitch - The sound pitchweight - The sound weightstream - True if the sound should be streamedattenuationDistance - The sound attenuation distancepreload - True if the sound should be preloaded@NotNull static @NotNull SoundEntry.Builder soundEntry()
SoundEntry instances@Deprecated @ApiStatus.ScheduledForRemoval(inVersion="2.0.0") @NotNull static @NotNull SoundEntry.Builder builder()
soundEntry() insteadSoundEntry instances@NotNull @NotNull net.kyori.adventure.key.Key key()
If type is FILE, the returned key is a
Sound key
Doesn't include the file extension (.ogg)
May instead be the key of another sound
event, according to value of type
key in interface net.kyori.adventure.key.Keyed@Deprecated @ApiStatus.ScheduledForRemoval(inVersion="2.0.0") @NotNull default @NotNull java.lang.String name()
key() insteadKey.value())float volume()
float pitch()
int weight()
An example: putting 2 in for the value would be like placing in the name twice
boolean stream()
It is used for all sounds in the "music" and "record" categories (except Note Block sounds), as (almost) all the sounds that belong to those categories are over a minute- long
Setting this to false allows many more instances of the sound to be run at the same time while setting it to true only allows 4 instances (of that type) to be run at the same time
int attenuationDistance()
It is used by portals, beacons, and conduits
boolean preload()
It is used by the underwater ambience
@NotNull @NotNull SoundEntry.Type type()
name() propertyboolean allDefault()
@Contract(value="-> new") @NotNull @NotNull SoundEntry.Builder toBuilder()