This commit is contained in:
gnembon committed 2025-02-13 22:38:20 +01:00
1 parent 4079ef1419
commit 9be8d5c77b
7 files changed
+30 -26

No files matched your search

@@ -108,7 +108,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
public static Value fromStack(ItemStack stack, RegistryAccess regs)
{
NBTSerializableValue value = new NBTSerializableValue();
value.nbtSupplier = () -> stack.saveOptional(regs);
value.nbtSupplier = () -> ItemStack.CODEC.encodeStart(regs.createSerializationContext(NbtOps.INSTANCE), stack).getOrThrow();
return value;
}
@@ -346,7 +346,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
public static ItemStack parseItem(String itemString, @Nullable CompoundTag customTag, RegistryAccess regs)
{
if (customTag != null) {
return ItemStack.parseOptional(regs, customTag);
return ItemStack.CODEC.parse(regs.createSerializationContext(NbtOps.INSTANCE), customTag).resultOrPartial().orElse(null);
}
try
{