@@ -16,7 +16,7 @@ public static Optional<String> getString(ItemStack item, String key) {
16
16
net .minecraft .world .item .ItemStack nmsItem = CraftItemStack .unwrap (item );
17
17
CompoundTag tag = getTag (nmsItem );
18
18
if (tag == null ) return Optional .empty ();
19
- return !tag .contains (key ) ? Optional .empty () : Optional . of ( tag .getString (key ) );
19
+ return !tag .contains (key ) ? Optional .empty () : tag .getString (key );
20
20
}
21
21
22
22
public static Optional <String > setString (ItemStack item , String key , String value ) throws NoSuchFieldException , IllegalAccessException {
@@ -35,7 +35,7 @@ public static Optional<Integer> getInt(ItemStack item, String key) {
35
35
net .minecraft .world .item .ItemStack nmsItem = CraftItemStack .unwrap (item );
36
36
CompoundTag tag = getTag (nmsItem );
37
37
if (tag == null ) return Optional .empty ();
38
- return !tag .contains (key ) ? Optional .empty () : Optional . of ( tag .getInt (key ) );
38
+ return !tag .contains (key ) ? Optional .empty () : tag .getInt (key );
39
39
}
40
40
41
41
public static Optional <Integer > setInt (ItemStack item , String key , int value ) {
@@ -54,7 +54,7 @@ public static Optional<Double> getDouble(ItemStack item, String key) {
54
54
net .minecraft .world .item .ItemStack nmsItem = CraftItemStack .unwrap (item );
55
55
CompoundTag tag = getTag (nmsItem );
56
56
if (tag == null ) return Optional .empty ();
57
- return !tag .contains (key ) ? Optional .empty () : Optional . of ( tag .getDouble (key ) );
57
+ return !tag .contains (key ) ? Optional .empty () : tag .getDouble (key );
58
58
}
59
59
60
60
public static Optional <Double > setDouble (ItemStack item , String key , double value ) {
@@ -73,7 +73,7 @@ public static Optional<Short> getShort(ItemStack item, String key) {
73
73
net .minecraft .world .item .ItemStack nmsItem = CraftItemStack .unwrap (item );
74
74
CompoundTag tag = getTag (nmsItem );
75
75
if (tag == null ) return Optional .empty ();
76
- return !tag .contains (key ) ? Optional .empty () : Optional . of ( tag .getShort (key ) );
76
+ return !tag .contains (key ) ? Optional .empty () : tag .getShort (key );
77
77
}
78
78
79
79
public static Optional <Short > setShort (ItemStack item , String key , short value ) {
@@ -92,7 +92,7 @@ public static Optional<Byte> getByte(ItemStack item, String key) {
92
92
net .minecraft .world .item .ItemStack nmsItem = CraftItemStack .unwrap (item );
93
93
CompoundTag tag = getTag (nmsItem );
94
94
if (tag == null ) return Optional .empty ();
95
- return !tag .contains (key ) ? Optional .empty () : Optional . of ( tag .getByte (key ) );
95
+ return !tag .contains (key ) ? Optional .empty () : tag .getByte (key );
96
96
}
97
97
98
98
public static Optional <Byte > setByte (ItemStack item , String key , byte value ) {
@@ -111,7 +111,7 @@ public static Optional<Long> getLong(ItemStack item, String key) {
111
111
net .minecraft .world .item .ItemStack nmsItem = CraftItemStack .unwrap (item );
112
112
CompoundTag tag = getTag (nmsItem );
113
113
if (tag == null ) return Optional .empty ();
114
- return !tag .contains (key ) ? Optional .empty () : Optional . of ( tag .getLong (key ) );
114
+ return !tag .contains (key ) ? Optional .empty () : tag .getLong (key );
115
115
}
116
116
117
117
public static Optional <Long > setLong (ItemStack item , String key , long value ) {
@@ -130,7 +130,7 @@ public static Optional<long[]> getLongArray(ItemStack item, String key) {
130
130
net .minecraft .world .item .ItemStack nmsItem = CraftItemStack .unwrap (item );
131
131
CompoundTag tag = getTag (nmsItem );
132
132
if (tag == null ) return Optional .empty ();
133
- return !tag .contains (key ) ? Optional .empty () : Optional . of ( tag .getLongArray (key ) );
133
+ return !tag .contains (key ) ? Optional .empty () : tag .getLongArray (key );
134
134
}
135
135
136
136
public static Optional <long []> setLongArray (ItemStack item , String key , long [] value ) {
@@ -149,7 +149,7 @@ public static Optional<int[]> getIntArray(ItemStack item, String key) {
149
149
net .minecraft .world .item .ItemStack nmsItem = CraftItemStack .unwrap (item );
150
150
CompoundTag tag = getTag (nmsItem );
151
151
if (tag == null ) return Optional .empty ();
152
- return !tag .contains (key ) ? Optional .empty () : Optional . of ( tag .getIntArray (key ) );
152
+ return !tag .contains (key ) ? Optional .empty () : tag .getIntArray (key );
153
153
}
154
154
155
155
public static Optional <int []> setIntArray (ItemStack item , String key , int [] value ) {
@@ -168,7 +168,7 @@ public static Optional<byte[]> getByteArray(ItemStack item, String key) {
168
168
net .minecraft .world .item .ItemStack nmsItem = CraftItemStack .unwrap (item );
169
169
CompoundTag tag = getTag (nmsItem );
170
170
if (tag == null ) return Optional .empty ();
171
- return !tag .contains (key ) ? Optional .empty () : Optional . of ( tag .getByteArray (key ) );
171
+ return !tag .contains (key ) ? Optional .empty () : tag .getByteArray (key );
172
172
}
173
173
174
174
public static Optional <byte []> setByteArray (ItemStack item , String key , byte [] value ) {
@@ -187,7 +187,7 @@ public static Optional<Boolean> getBoolean(ItemStack item, String key) {
187
187
net .minecraft .world .item .ItemStack nmsItem = CraftItemStack .unwrap (item );
188
188
CompoundTag tag = getTag (nmsItem );
189
189
if (tag == null ) return Optional .empty ();
190
- return !tag .contains (key ) ? Optional .empty () : Optional . of ( tag .getBoolean (key ) );
190
+ return !tag .contains (key ) ? Optional .empty () : tag .getBoolean (key );
191
191
}
192
192
193
193
public static Optional <Boolean > setBoolean (ItemStack item , String key , boolean value ) {
@@ -206,7 +206,7 @@ public static Optional<Float> getFloat(ItemStack item, String key) {
206
206
net .minecraft .world .item .ItemStack nmsItem = CraftItemStack .unwrap (item );
207
207
CompoundTag tag = getTag (nmsItem );
208
208
if (tag == null ) return Optional .empty ();
209
- return !tag .contains (key ) ? Optional .empty () : Optional . of ( tag .getFloat (key ) );
209
+ return !tag .contains (key ) ? Optional .empty () : tag .getFloat (key );
210
210
}
211
211
212
212
public static Optional <Float > setFloat (ItemStack item , String key , float value ) {
0 commit comments