This commit is contained in:
YuTian 2024-07-19 17:49:00 +08:00
parent edd525cfcc
commit 6d6b179fec
3 changed files with 4 additions and 6 deletions

View File

@ -84,6 +84,7 @@ public class SerializeHelper {
} }
if (serializers.containsKey(clazz)) { if (serializers.containsKey(clazz)) {
Serializer serializer = serializers.get(clazz); Serializer serializer = serializers.get(clazz);
System.out.println(serializer+":"+serializer.deserialize(value));
return serializer.deserialize(value); return serializer.deserialize(value);
} }
if (ISerializable.class.isAssignableFrom(clazz)) { if (ISerializable.class.isAssignableFrom(clazz)) {
@ -165,9 +166,6 @@ public class SerializeHelper {
} }
return jsonObject; return jsonObject;
} else { } else {
if (clazz.toString().startsWith("net.minecraft")) {
return null;
}
return serialize(value); return serialize(value);
} }
} }

View File

@ -13,10 +13,10 @@ public class ItemStackSerializer implements Serializer<ItemStack> {
public Object serialize(ItemStack value) { public Object serialize(ItemStack value) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(value); net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(value);
jsonObject.put("Type", nmsItemStack.c().k().g().a()); jsonObject.put("id", nmsItemStack.c().k().g().a());
jsonObject.put("Count", nmsItemStack.J()); jsonObject.put("Count", nmsItemStack.J());
NBTTagCompound nbtTagCompound = nmsItemStack.u(); NBTTagCompound nbtTagCompound = nmsItemStack.u();
jsonObject.put("Tag", nbtTagCompound.toString()); jsonObject.put("tag", nbtTagCompound.toString());
return jsonObject; return jsonObject;
} }

View File

@ -1,5 +1,5 @@
name: AuLib name: AuLib
main: com.io.yutian.aulib.AuLib main: com.io.yutian.aulib.AuLib
version: 1.6.1 version: 1.6.2
api-version: 1.18 api-version: 1.18
author: SuperYuTian author: SuperYuTian