Fix custom drawers not stacking if crafted from different material "stack sizes"

This commit is contained in:
Justin Aquadro committed 2016-03-28 23:13:55 -04:00
1 parent c7a9c76e7e
commit d3dc2bd455
1 file changed
+16 -15
@@ -39,23 +39,14 @@ public class ItemCustomDrawers extends ItemDrawers
NBTTagCompound tag = new NBTTagCompound();
if (matSide != null) {
NBTTagCompound itag = new NBTTagCompound();
matSide.writeToNBT(itag);
tag.setTag("MatS", itag);
}
if (matSide != null)
tag.setTag("MatS", getMaterialTag(matSide));
if (matTrim != null) {
NBTTagCompound itag = new NBTTagCompound();
matTrim.writeToNBT(itag);
tag.setTag("MatT", itag);
}
if (matTrim != null)
tag.setTag("MatT", getMaterialTag(matTrim));
if (matFront != null) {
NBTTagCompound itag = new NBTTagCompound();
matFront.writeToNBT(itag);
tag.setTag("MatF", itag);
}
if (matFront != null)
tag.setTag("MatF", getMaterialTag(matFront));
ItemStack stack = new ItemStack(item, count, 0);
if (!tag.hasNoTags())
@@ -63,4 +54,14 @@ public class ItemCustomDrawers extends ItemDrawers
return stack;
}
private static NBTTagCompound getMaterialTag (ItemStack mat) {
mat = mat.copy();
mat.stackSize = 1;
NBTTagCompound itag = new NBTTagCompound();
mat.writeToNBT(itag);
return itag;
}
}