if (slotID == 4 || slotID == 5)
{
if (!craftedTop && inventory[0] != null)
{
int value = PatternBuilder.instance.getPartValue(inventory[2]);
IPattern item = (IPattern) inventory[0].getItem();
int cost = item != null ? item.getPatternCost(inventory[0]) : 0;
if (value > 0 && cost > 0)
{
int decrease = cost / value;
if (cost % value != 0)
decrease++;
super.decrStackSize(2, decrease); //Call super to avoid crafting again
}
}
if (inventory[4] != null || inventory[5] != null)
craftedTop = true;
else
craftedTop = false;
}
if (!craftedTop)
buildTopPart();
if (slotID == 6 || slotID == 7)
{
if (!craftedBottom && inventory[1] != null)
{
int value = PatternBuilder.instance.getPartValue(inventory[3]);
IPattern item = (IPattern) inventory[1].getItem();
int cost = item != null ? item.getPatternCost(inventory[1]) : 0;
if (value > 0 && cost > 0)
{
int decrease = cost / value;
if (cost % value != 0)
decrease++;