5
5
import io .papermc .paper .registry .RegistryKey ;
6
6
import java .util .Collection ;
7
7
import java .util .Collections ;
8
- import org .jetbrains .annotations .NotNull ;
9
- import org .jetbrains .annotations .Nullable ;
8
+ import net .kyori .adventure .text .Component ;
9
+ import org .jspecify .annotations .NullMarked ;
10
+ import org .jspecify .annotations .Nullable ;
10
11
11
- public abstract class MusicInstrument implements Keyed , net .kyori .adventure .translation .Translatable { // Paper - translation keys
12
+ @ NullMarked
13
+ public abstract class MusicInstrument implements Keyed , net .kyori .adventure .translation .Translatable {
12
14
13
15
// Start generate - MusicInstrument
14
16
// @GeneratedFrom 1.21.5
@@ -38,7 +40,7 @@ public abstract class MusicInstrument implements Keyed, net.kyori.adventure.tran
38
40
*/
39
41
@ Nullable
40
42
@ Deprecated (since = "1.20.1" )
41
- public static MusicInstrument getByKey (@ NotNull NamespacedKey namespacedKey ) {
43
+ public static MusicInstrument getByKey (final NamespacedKey namespacedKey ) {
42
44
return Registry .INSTRUMENT .get (namespacedKey );
43
45
}
44
46
@@ -48,25 +50,50 @@ public static MusicInstrument getByKey(@NotNull NamespacedKey namespacedKey) {
48
50
* @return the memoryKeys
49
51
* @deprecated use {@link Registry#iterator()}.
50
52
*/
51
- @ NotNull
52
53
@ Deprecated (since = "1.20.1" )
53
54
public static Collection <MusicInstrument > values () {
54
55
return Collections .unmodifiableCollection (Lists .newArrayList (Registry .INSTRUMENT ));
55
56
}
56
57
57
- @ NotNull
58
- private static MusicInstrument getInstrument (@ NotNull String key ) {
58
+ private static MusicInstrument getInstrument (final String key ) {
59
59
return RegistryAccess .registryAccess ().getRegistry (RegistryKey .INSTRUMENT ).getOrThrow (NamespacedKey .minecraft (key ));
60
60
}
61
61
62
- // Paper start - deprecate getKey
62
+ /**
63
+ * Gets the use duration of this music instrument.
64
+ *
65
+ * @return the duration expressed in seconds.
66
+ */
67
+ public abstract float getDuration ();
68
+
69
+ /**
70
+ * Gets the range of the sound.
71
+ *
72
+ * @return the range of the sound.
73
+ */
74
+ public abstract float getRange ();
75
+
76
+ /**
77
+ * Provides the description of this instrument as displayed to the client.
78
+ *
79
+ * @return the description component.
80
+ */
81
+ public abstract Component description ();
82
+
83
+ /**
84
+ * Gets the sound for this instrument.
85
+ *
86
+ * @return the sound
87
+ */
88
+ public abstract Sound getSound ();
89
+
63
90
/**
64
91
* @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
65
92
* and {@link io.papermc.paper.registry.RegistryKey#INSTRUMENT}. MusicInstruments can exist without a key.
66
93
*/
67
94
@ Deprecated (forRemoval = true , since = "1.20.5" )
68
95
@ Override
69
- public abstract @ NotNull NamespacedKey getKey ();
96
+ public abstract NamespacedKey getKey ();
70
97
71
98
/**
72
99
* @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
@@ -78,15 +105,11 @@ private static MusicInstrument getInstrument(@NotNull String key) {
78
105
return Keyed .super .key ();
79
106
}
80
107
81
- // Paper end - deprecate getKey
82
-
83
- // Paper start - mark translation key as deprecated
84
108
/**
85
109
* @deprecated this method assumes that the instrument description
86
110
* always be a translatable component which is not guaranteed.
87
111
*/
88
112
@ Override
89
113
@ Deprecated (forRemoval = true )
90
- public abstract @ NotNull String translationKey ();
91
- // Paper end - mark translation key as deprecated
114
+ public abstract String translationKey ();
92
115
}
0 commit comments