Skip to content

Commit 2f2d758

Browse files
committed
- 简化 StellarPooledNBT 的结构以提高 NBTTagPrimitivePool 功能的兼容性。
- 添加 remap = false
1 parent d02e12f commit 2f2d758

File tree

7 files changed

+4
-63
lines changed

7 files changed

+4
-63
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ plugins {
1212

1313
// Project properties
1414
group = "github.kasuminova.stellarcore"
15-
version = "1.5.19"
15+
version = "1.5.20"
1616

1717
// Set the toolchain version to decouple the Java we run Gradle with from the Java used to compile and run the mod
1818
java {

src/main/java/github/kasuminova/stellarcore/common/pool/NBTTagPrimitivePool.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package github.kasuminova.stellarcore.common.pool;
22

33
import github.kasuminova.stellarcore.common.util.StellarLog;
4-
import github.kasuminova.stellarcore.mixin.util.StellarPooledNBT;
54
import net.minecraft.nbt.*;
65

76
import 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)]

src/main/java/github/kasuminova/stellarcore/mixin/botania/MixinTileRuneAltar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public abstract class MixinTileRuneAltar extends TileSimpleInventory {
2828
@Shadow(remap = false)
2929
RecipeRuneAltar currentRecipe;
3030

31-
@Shadow
31+
@Shadow(remap = false)
3232
List<ItemStack> lastRecipe;
3333

3434
@Unique

src/main/java/github/kasuminova/stellarcore/mixin/minecraft/nbtpool/MixinNBTBase.java

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/main/java/github/kasuminova/stellarcore/mixin/minecraft/nbtpool/MixinNBTTagByte.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public abstract class MixinNBTTagByte implements StellarPooledNBT {
2626
@Nonnull
2727
@Overwrite
2828
public NBTTagByte copy() {
29-
return stellar_core$isPooled() ? (NBTTagByte) (Object) this : NBTTagPrimitivePool.getTagByte((NBTTagByte) (Object) this);
29+
return NBTTagPrimitivePool.getTagByte((NBTTagByte) (Object) this);
3030
}
3131

3232
/**

src/main/java/github/kasuminova/stellarcore/mixin/minecraft/nbtpool/MixinNBTTagShort.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public abstract class MixinNBTTagShort implements StellarPooledNBT {
2626
@Nonnull
2727
@Overwrite
2828
public NBTTagShort copy() {
29-
return stellar_core$isPooled() ? (NBTTagShort) (Object) this : NBTTagPrimitivePool.getTagShort((NBTTagShort) (Object) this);
29+
return NBTTagPrimitivePool.getTagShort((NBTTagShort) (Object) this);
3030
}
3131

3232
/**

src/main/java/github/kasuminova/stellarcore/mixin/util/StellarPooledNBT.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,4 @@ public interface StellarPooledNBT {
1717
*/
1818
Object stellar_core$getPooledNBT();
1919

20-
boolean stellar_core$isPooled();
21-
22-
void stellar_core$setPooled(boolean pooled);
23-
2420
}

0 commit comments

Comments
 (0)