Package org.bukkit
Class MusicInstrument
java.lang.Object
org.bukkit.MusicInstrument
- All Implemented Interfaces:
Keyed,Translatable,Keyed
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MusicInstrumentstatic final MusicInstrumentstatic final MusicInstrumentstatic final MusicInstrumentstatic final MusicInstrumentstatic final MusicInstrumentstatic final MusicInstrumentstatic final MusicInstrument -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MusicInstrumentcreate(Consumer<RegistryBuilderFactory<MusicInstrument, ? extends InstrumentRegistryEntry.Builder>> value) Creates an inlined music instrument.abstract ComponentGets the description of this instrument as displayed to the client.static @Nullable MusicInstrumentgetByKey(NamespacedKey namespacedKey) Deprecated.abstract floatGets the use duration of this music instrument.abstract NamespacedKeygetKey()Deprecated, for removal: This API element is subject to removal in a future version.abstract floatgetRange()Gets the range of the sound.abstract SoundgetSound()Gets the sound for this instrument.key()Deprecated, for removal: This API element is subject to removal in a future version.abstract StringDeprecated, for removal: This API element is subject to removal in a future version.this method assumes that the instrument description always be a translatable component which is not guaranteed.static Collection<MusicInstrument> values()Deprecated.
-
Field Details
-
ADMIRE_GOAT_HORN
-
CALL_GOAT_HORN
-
DREAM_GOAT_HORN
-
FEEL_GOAT_HORN
-
PONDER_GOAT_HORN
-
SEEK_GOAT_HORN
-
SING_GOAT_HORN
-
YEARN_GOAT_HORN
-
-
Constructor Details
-
MusicInstrument
public MusicInstrument()
-
-
Method Details
-
create
@Experimental public static MusicInstrument create(Consumer<RegistryBuilderFactory<MusicInstrument, ? extends InstrumentRegistryEntry.Builder>> value) Creates an inlined music instrument.- Parameters:
value- a consumer for the builder factory- Returns:
- the created music instrument
-
getByKey
@Deprecated(since="1.20.1") public static @Nullable MusicInstrument getByKey(NamespacedKey namespacedKey) Deprecated.useRegistry.get(NamespacedKey)insteadReturns aMusicInstrumentby aNamespacedKey.- Parameters:
namespacedKey- the key- Returns:
- the event or null
-
values
Deprecated.Returns all known music instruments.- Returns:
- the music instruments
-
getDuration
public abstract float getDuration()Gets the use duration of this music instrument.- Returns:
- the duration expressed in seconds
-
getRange
public abstract float getRange()Gets the range of the sound.- Returns:
- the range of the sound
-
description
Gets the description of this instrument as displayed to the client.- Returns:
- the description component
-
getSound
Gets the sound for this instrument.- Returns:
- the sound
-
getKey
Deprecated, for removal: This API element is subject to removal in a future version.useRegistry.getKey(Keyed),RegistryAccess.getRegistry(io.papermc.paper.registry.RegistryKey), andRegistryKey.INSTRUMENT. MusicInstruments can exist without a key.Description copied from interface:KeyedReturn the namespaced identifier for this object. -
key
Deprecated, for removal: This API element is subject to removal in a future version.useRegistry.getKey(Keyed),RegistryAccess.getRegistry(io.papermc.paper.registry.RegistryKey), andRegistryKey.INSTRUMENT. MusicInstruments can exist without a key.Description copied from interface:KeyedReturns the unique identifier for this object. -
translationKey
Deprecated, for removal: This API element is subject to removal in a future version.this method assumes that the instrument description always be a translatable component which is not guaranteed.Description copied from interface:net.kyori.adventure.translation.TranslatableGets the translation key.- Specified by:
translationKeyin interfaceTranslatable- Returns:
- the translation key
-
Registry.get(NamespacedKey)instead