custom serialization of oversized itemstacks.

simple limiting by checking overflow
This commit is contained in:
PrototypeTrousers
2022-10-12 04:10:23 -03:00
parent 601faf5087
commit 9ac4ea4e6e
3 changed files with 54 additions and 2 deletions
@@ -93,6 +93,10 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
NBTTagCompound ingredient = inTag.getCompoundTagAt(x);
final ItemStack gs = new ItemStack(ingredient);
if (ingredient.hasKey("stackSize")) {
gs.setCount(ingredient.getInteger("stackSize"));
}
if (!ingredient.hasNoTags() && gs.isEmpty()) {
throw new IllegalArgumentException("No pattern here!");
}
@@ -124,6 +128,10 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
NBTTagCompound resultItemTag = outTag.getCompoundTagAt(x);
final ItemStack gs = new ItemStack(resultItemTag);
if (resultItemTag.hasKey("stackSize")) {
gs.setCount(resultItemTag.getInteger("stackSize"));
}
if (!resultItemTag.hasNoTags() && gs.isEmpty()) {
throw new IllegalArgumentException("No pattern here!");
}