Package org.bukkit
Class MusicInstrument
java.lang.Object
org.bukkit.MusicInstrument
- All Implemented Interfaces:
Keyed
,Translatable
,Keyed
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MusicInstrument
static final MusicInstrument
static final MusicInstrument
static final MusicInstrument
static final MusicInstrument
static final MusicInstrument
static final MusicInstrument
static final MusicInstrument
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MusicInstrument
create
(Consumer<RegistryBuilderFactory<MusicInstrument, ? extends InstrumentRegistryEntry.Builder>> value) Creates an inlined music instrument.abstract Component
Gets the description of this instrument as displayed to the client.static @Nullable MusicInstrument
getByKey
(NamespacedKey namespacedKey) Deprecated.abstract float
Gets the use duration of this music instrument.abstract NamespacedKey
getKey()
Deprecated, for removal: This API element is subject to removal in a future version.abstract float
getRange()
Gets the range of the sound.abstract Sound
getSound()
Gets the sound for this instrument.key()
Deprecated, for removal: This API element is subject to removal in a future version.abstract String
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.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 aMusicInstrument
by 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:Keyed
Return 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:Keyed
Returns 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.Translatable
Gets the translation key.- Specified by:
translationKey
in interfaceTranslatable
- Returns:
- the translation key
-
Registry.get(NamespacedKey)
instead