private void TryInsertFirstThing(string item = "")
 {
     if (item != "")
     {
         building.firstCategory = ThingCategoryDef.Named(item).defName;
         building.firstItem     = building.firstCategory;
     }
     else
     {
         building.firstItem = things.RandomElement().def.defName;
     }
     if (building.compItemProcessor.Props.isSemiAutomaticMachine)
     {
         if (building.compPowerTrader != null && !building.compPowerTrader.PowerOn && building.compItemProcessor.Props.noPowerDestroysProgress)
         {
             Messages.Message("IP_NoPowerDestroysWarning".Translate(building.def.LabelCap), building, MessageTypeDefOf.NegativeEvent, true);
         }
         else if (building.compFuelable != null && !building.compFuelable.HasFuel && building.compItemProcessor.Props.noPowerDestroysProgress)
         {
             Messages.Message("IP_NoFuelDestroysWarning".Translate(building.def.LabelCap), building, MessageTypeDefOf.NegativeEvent, true);
         }
         else
         {
             building.IngredientsChosenBringThemIn();
         }
     }
     else
     {
         building.processorStage = ProcessorStage.IngredientsChosen;
     }
 }
        private void TryConfigureIngredientsByOutput(CombinationDef element)
        {
            building.productToTurnInto = element.result;
            building.thisRecipe        = element.defName;

            if (element.isCategoryRecipe)
            {
                switch (building.compItemProcessor.Props.numberOfInputs)
                {
                case 1:
                    building.firstCategory = ThingCategoryDef.Named(element.items[0]).defName;
                    building.firstItem     = building.firstCategory;
                    building.ExpectedAmountFirstIngredient = element.amount[0];
                    break;

                case 2:
                    building.firstCategory  = ThingCategoryDef.Named(element.items[0]).defName;
                    building.firstItem      = building.firstCategory;
                    building.secondCategory = ThingCategoryDef.Named(element.secondItems[0]).defName;
                    building.secondItem     = building.secondCategory;
                    building.ExpectedAmountFirstIngredient  = element.amount[0];
                    building.ExpectedAmountSecondIngredient = element.amount[1];
                    break;

                case 3:
                    building.firstCategory  = ThingCategoryDef.Named(element.items[0]).defName;
                    building.firstItem      = building.firstCategory;
                    building.secondCategory = ThingCategoryDef.Named(element.secondItems[0]).defName;
                    building.secondItem     = building.secondCategory;
                    building.thirdCategory  = ThingCategoryDef.Named(element.thirdItems[0]).defName;
                    building.thirdItem      = building.thirdCategory;
                    building.ExpectedAmountFirstIngredient  = element.amount[0];
                    building.ExpectedAmountSecondIngredient = element.amount[1];
                    building.ExpectedAmountThirdIngredient  = element.amount[2];
                    break;

                case 4:
                    building.firstCategory  = ThingCategoryDef.Named(element.items[0]).defName;
                    building.firstItem      = building.firstCategory;
                    building.secondCategory = ThingCategoryDef.Named(element.secondItems[0]).defName;
                    building.secondItem     = building.secondCategory;
                    building.thirdCategory  = ThingCategoryDef.Named(element.thirdItems[0]).defName;
                    building.thirdItem      = building.thirdCategory;
                    building.fourthCategory = ThingCategoryDef.Named(element.fourthItems[0]).defName;
                    building.fourthItem     = building.fourthCategory;
                    building.ExpectedAmountFirstIngredient  = element.amount[0];
                    building.ExpectedAmountSecondIngredient = element.amount[1];
                    building.ExpectedAmountThirdIngredient  = element.amount[2];
                    building.ExpectedAmountFourthIngredient = element.amount[3];
                    break;

                default:
                    building.firstCategory = ThingCategoryDef.Named(element.items[0]).defName;
                    building.firstItem     = building.firstCategory;
                    building.ExpectedAmountFirstIngredient = element.amount[0];
                    break;
                }
            }
            else
            {
                switch (building.compItemProcessor.Props.numberOfInputs)
                {
                case 1:
                    building.firstItem = ThingDef.Named(element.items[0]).defName;
                    building.ExpectedAmountFirstIngredient = element.amount[0];
                    break;

                case 2:
                    building.firstItem  = ThingDef.Named(element.items[0]).defName;
                    building.secondItem = ThingDef.Named(element.secondItems[0]).defName;
                    building.ExpectedAmountFirstIngredient  = element.amount[0];
                    building.ExpectedAmountSecondIngredient = element.amount[1];
                    break;

                case 3:
                    building.firstItem  = ThingDef.Named(element.items[0]).defName;
                    building.secondItem = ThingDef.Named(element.secondItems[0]).defName;
                    building.thirdItem  = ThingDef.Named(element.thirdItems[0]).defName;
                    building.ExpectedAmountFirstIngredient  = element.amount[0];
                    building.ExpectedAmountSecondIngredient = element.amount[1];
                    building.ExpectedAmountThirdIngredient  = element.amount[2];
                    break;

                case 4:
                    building.firstItem  = ThingDef.Named(element.items[0]).defName;
                    building.secondItem = ThingDef.Named(element.secondItems[0]).defName;
                    building.thirdItem  = ThingDef.Named(element.thirdItems[0]).defName;
                    building.fourthItem = ThingDef.Named(element.fourthItems[0]).defName;
                    building.ExpectedAmountFirstIngredient  = element.amount[0];
                    building.ExpectedAmountSecondIngredient = element.amount[1];
                    building.ExpectedAmountThirdIngredient  = element.amount[2];
                    building.ExpectedAmountFourthIngredient = element.amount[3];
                    break;

                default:
                    building.firstItem = ThingDef.Named(element.items[0]).defName;
                    building.ExpectedAmountFirstIngredient = element.amount[0];

                    break;
                }
            }

            if (building.compItemProcessor.Props.isSemiAutomaticMachine)
            {
                if (building.compPowerTrader != null && !building.compPowerTrader.PowerOn && building.compItemProcessor.Props.noPowerDestroysProgress)
                {
                    Messages.Message("IP_NoPowerDestroysWarning".Translate(building.def.LabelCap), building, MessageTypeDefOf.NegativeEvent, true);
                }
                else if (building.compFuelable != null && !building.compFuelable.HasFuel && building.compItemProcessor.Props.noPowerDestroysProgress)
                {
                    Messages.Message("IP_NoFuelDestroysWarning".Translate(building.def.LabelCap), building, MessageTypeDefOf.NegativeEvent, true);
                }
                else
                {
                    building.IngredientsChosenBringThemIn();
                }
            }
            else
            {
                building.processorStage = ProcessorStage.IngredientsChosen;
            }
        }