/// <summary>
        /// Replaces the recipes with the ones defined by the processor.
        /// </summary>
        public static bool Prefix(IMachine __instance, ref bool __result, IStorage input)
        {
            try
            {
                IReflectedProperty <SObject> instanceMachine = Util.Helper.Reflection.GetProperty <SObject>(__instance, "Machine");
                if (instanceMachine.GetValue() is Processor processor)
                {
                    IReflectedField <IRecipe[]> privateRecipes = Util.Helper.Reflection.GetField <IRecipe[]>(__instance, "Recipes");

                    IRecipe[] recipes = RecipeManager.GetRecipeAdaptorsFor(processor, privateRecipes?.GetValue());

                    IConsumable consumable      = null;
                    IRecipe     acceptingRecipe = null;

                    foreach (ITrackedStack item in input.GetItems())
                    {
                        acceptingRecipe = recipes.FirstOrDefault(recipe => recipe.AcceptsInput(item));
                        if (acceptingRecipe != null)
                        {
                            input.TryGetIngredient(item.Sample.ParentSheetIndex, acceptingRecipe.InputCount, out consumable);
                            break;
                        }
                    }

                    if (acceptingRecipe != null && consumable != null)
                    {
                        processor.heldObject.Value  = acceptingRecipe.Output(consumable.Take());
                        processor.MinutesUntilReady = acceptingRecipe.Minutes;
                        __result = true;
                        return(false);
                    }

                    __result = false;
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                ModEntry.StaticMonitor.Log($"Failed overriding Automate.\n{ex}", LogLevel.Error);
                return(true); // run original code instead
            }
        }