Fixed DataFixer apply

This commit is contained in:
nulli0n committed 2025-06-19 04:51:11 +05:00
1 parent 9257973247
commit 432eca7513
7 files changed
+20 -7

No files matched your search

+1 -1
View File
@@ -28,7 +28,7 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21.5-R0.1-SNAPSHOT</version>
<version>1.21.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
+1 -1
View File
@@ -77,7 +77,7 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21.5-R0.1-SNAPSHOT</version>
<version>1.21.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@@ -330,7 +330,7 @@ public class ItemNbt {
if (useCodec) {
Object context = createSerializationContext();
DataResult<?> decoded = (DataResult<?>) Reflex.invokeMethod(mParse, itemStackCodec, context, tag);
DataResult<?> decoded = (DataResult<?>) Reflex.invokeMethod(mParse, itemStackCodec, context, compoundTag);
if (decoded == null) return null;
itemStack = decoded.resultOrPartial(itemId -> Engine.core().error("Could not decode ItemStack from tag: " + itemId)).orElse(null);
@@ -352,6 +352,19 @@ public class ItemNbt {
if (targetVersion <= 0) return compoundTag;
if (sourceVersion > targetVersion || sourceVersion <= 0) return compoundTag;
// Probably not necessary, but they used it for a reason probably.
// if (Version.isPaper()) {
// Class<?> mcDataTypeClass = Reflex.getClass("ca.spottedleaf.dataconverter.minecraft.datatypes", "MCDataType");
// Class<?> mcDataConvertedClass = Reflex.getClass("ca.spottedleaf.dataconverter.minecraft", "MCDataConverter");
// Class<?> mcTypeRegistryClass = Reflex.getClass("ca.spottedleaf.dataconverter.minecraft.datatypes", "MCTypeRegistry");
//
// Object itemStackRegistry = Reflex.getFieldValue(mcTypeRegistryClass, "ITEM_STACK");
//
// Method convert = Reflex.getMethod(mcDataConvertedClass, "convertTag", mcDataTypeClass, CLS_COMPOUND_TAG, Integer.TYPE, Integer.TYPE);
//
// return Reflex.invokeMethod(convert, null, itemStackRegistry, compoundTag, sourceVersion, targetVersion);
// }
Dynamic<?> dynamic = new Dynamic<>((DynamicOps) nbtOps, compoundTag);
return dataFixer.update((DSL.TypeReference) itemStackReference, dynamic, sourceVersion, targetVersion).getValue();
}
+1 -1
View File
@@ -3,7 +3,7 @@ main: su.nightexpress.nightcore.NightCore
version: '${project.version}'
description: Plugin core
author: NightExpress
api-version: 1.19
api-version: 1.20
load: STARTUP
libraries:
- com.zaxxer:HikariCP:6.0.0
+1 -1
View File
@@ -28,7 +28,7 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21.5-R0.1-SNAPSHOT</version>
<version>1.21.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
+1 -1
View File
@@ -28,7 +28,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.21.4-R0.1-SNAPSHOT</version>
<version>1.21.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
+1 -1
View File
@@ -28,7 +28,7 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21.5-R0.1-SNAPSHOT</version>
<version>1.21.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>