11package github .kasuminova .stellarcore .common .pool ;
22
33import github .kasuminova .stellarcore .common .util .StellarLog ;
4- import github .kasuminova .stellarcore .mixin .util .StellarPooledNBT ;
54import net .minecraft .nbt .*;
65
76import java .util .Arrays ;
@@ -30,19 +29,10 @@ public class NBTTagPrimitivePool {
3029 Arrays .setAll (TAG_LONGS , i -> new NBTTagLong (i - SHORT_OFFSET ));
3130 Arrays .setAll (TAG_FLOATS , i -> new NBTTagFloat (i - SHORT_OFFSET ));
3231 Arrays .setAll (TAG_DOUBLES , i -> new NBTTagDouble (i - SHORT_OFFSET ));
33- Arrays .stream (TAG_BYTES ) .forEach (tag -> ((StellarPooledNBT ) tag ).stellar_core$setPooled (true ));
34- Arrays .stream (TAG_SHORTS ) .forEach (tag -> ((StellarPooledNBT ) tag ).stellar_core$setPooled (true ));
35- Arrays .stream (TAG_INTS ) .forEach (tag -> ((StellarPooledNBT ) tag ).stellar_core$setPooled (true ));
36- Arrays .stream (TAG_LONGS ) .forEach (tag -> ((StellarPooledNBT ) tag ).stellar_core$setPooled (true ));
37- Arrays .stream (TAG_FLOATS ) .forEach (tag -> ((StellarPooledNBT ) tag ).stellar_core$setPooled (true ));
38- Arrays .stream (TAG_DOUBLES ).forEach (tag -> ((StellarPooledNBT ) tag ).stellar_core$setPooled (true ));
3932 StellarLog .LOG .info ("[StellarCore-NBTTagPrimitivePool] PrimitiveType NBTTagPrimitivePool initialized, took {}ms." , System .currentTimeMillis () - start );
4033 }
4134
4235 public static NBTTagByte getTagByte (final NBTTagByte tag ) {
43- if (((StellarPooledNBT ) tag ).stellar_core$isPooled ()) {
44- return tag ;
45- }
4636 return TAG_BYTES [tag .getByte () + 128 ];
4737 }
4838
@@ -51,9 +41,6 @@ public static NBTTagByte getTagByte(final byte b) {
5141 }
5242
5343 public static NBTTagShort getTagShort (final NBTTagShort tag ) {
54- if (((StellarPooledNBT ) tag ).stellar_core$isPooled ()) {
55- return tag ;
56- }
5744 return TAG_SHORTS [tag .getShort () + SHORT_OFFSET ];
5845 }
5946
@@ -62,9 +49,6 @@ public static NBTTagShort getTagShort(final short s) {
6249 }
6350
6451 public static NBTTagInt getTagInt (final NBTTagInt tag ) {
65- if (((StellarPooledNBT ) tag ).stellar_core$isPooled ()) {
66- return tag ;
67- }
6852 final int value = tag .getInt ();
6953 return value < MINIMUM || value > MAXIMUM
7054 ? tag
@@ -78,9 +62,6 @@ public static NBTTagInt getTagInt(final int i) {
7862 }
7963
8064 public static NBTTagLong getTagLong (final NBTTagLong tag ) {
81- if (((StellarPooledNBT ) tag ).stellar_core$isPooled ()) {
82- return tag ;
83- }
8465 final long value = tag .getLong ();
8566 return value < MINIMUM || value > MAXIMUM
8667 ? tag
@@ -94,9 +75,6 @@ public static NBTTagLong getTagLong(final long l) {
9475 }
9576
9677 public static NBTTagFloat getTagFloat (final NBTTagFloat tag ) {
97- if (((StellarPooledNBT ) tag ).stellar_core$isPooled ()) {
98- return tag ;
99- }
10078 final float value = tag .getFloat ();
10179 return isFloatInteger (value )
10280 ? value < MINIMUM || value > MAXIMUM ? tag : TAG_FLOATS [((int ) value + SHORT_OFFSET )]
@@ -110,9 +88,6 @@ public static NBTTagFloat getTagFloat(final float f) {
11088 }
11189
11290 public static NBTTagDouble getTagDouble (final NBTTagDouble tag ) {
113- if (((StellarPooledNBT ) tag ).stellar_core$isPooled ()) {
114- return tag ;
115- }
11691 final double value = tag .getDouble ();
11792 return isDoubleInteger (value )
11893 ? value < MINIMUM || value > MAXIMUM ? tag : TAG_DOUBLES [((int ) value + SHORT_OFFSET )]
0 commit comments