handleSecondaryFuel();
sortInventory();
if(inventory[2] != null && inventory[3] == null)
{
RecipeType toSet = null;
for(RecipeType type : RecipeType.values())
{
if(inventory[2].isItemEqual(type.getStack()))
{
toSet = type;
break;
}
}
if(toSet != null && recipeType != toSet.ordinal())
{
if(recipeTicks < RECIPE_TICKS_REQUIRED)
{
recipeTicks++;
}
else if(recipeTicks == RECIPE_TICKS_REQUIRED)
{
recipeTicks = 0;
ItemStack returnStack = getMachineStack();
IUpgradeManagement mgmt = (IUpgradeManagement)inventory[2].getItem();
((IUpgradeManagement)returnStack.getItem()).setEnergyMultiplier(mgmt.getEnergyMultiplier(inventory[2]), returnStack);
((IUpgradeManagement)returnStack.getItem()).setSpeedMultiplier(mgmt.getSpeedMultiplier(inventory[2]), returnStack);
inventory[2] = null;
inventory[3] = returnStack;
recipeType = toSet.ordinal();
gasTank.setGas(null);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType());
MekanismUtils.saveChunk(this);