Fix stacksize overflow when overlaying recipe (#167)

This commit is contained in:
miozune authored and GitHub committed 2023-10-25 23:01:56 +09:00
1 parent bd0e7fabca
commit 1efa92adad
4 files changed
+18 -10

No files matched your search

@@ -304,6 +304,18 @@ public final class Util {
}
}
public static void writeItemStackToNBT(ItemStack itemStack, NBTTagCompound tag) {
itemStack.writeToNBT(tag);
tag.setInteger("Count", itemStack.stackSize);
}
public static ItemStack loadItemStackFromNBT(NBTTagCompound tag) {
ItemStack itemStack = ItemStack.loadItemStackFromNBT(tag);
if (itemStack == null) return null;
itemStack.stackSize = tag.getInteger("Count");
return itemStack;
}
public static IAEFluidStack loadFluidStackFromNBT(final NBTTagCompound i) {
final FluidStack t = FluidRegistry.getFluidStack(i.getString("FluidName"), 1);
if (t == null) return null;