public RecursiveSearch(Dictionary <int, int> inventory, CraftingSource craftingSource, int maxDepth)
 {
     PossibleCraftCache = new Dictionary <Recipe, bool>();
     Inventory          = inventory;
     CraftingSource     = craftingSource;
     MaxDepth           = maxDepth;
 }
        public static void FindRecipes(Dictionary <int, int> inventory)
        {
            RecipeInfoCache.Clear();
            RecursiveSearch recursiveSearch = new RecursiveSearch(inventory, CraftingSource.PlayerAsCraftingSource());

            SortedSet <int> sortedAvailableRecipes = new SortedSet <int>();

            foreach (int n in SortedRecipeList)
            {
                Recipe recipe = Main.recipe[n];
                if (recipe is CompoundRecipe compoundRecipe)
                {
                    recipe = compoundRecipe.OverridenRecipe;
                }
                RecipeInfo recipeInfo = recursiveSearch.FindIngredientsForRecipe(recipe);
                if (recipeInfo != null)
                {
                    if (recipeInfo.RecipeUsed.Count > 1)
                    {
                        RecipeInfoCache.Add(recipe, recipeInfo);
                    }
                    sortedAvailableRecipes.Add(n);
                }
            }

            foreach (int availableRecipe in sortedAvailableRecipes)
            {
                Main.availableRecipe[Main.numAvailableRecipes++] = availableRecipe;
            }
        }
 public RecursiveSearch(Dictionary <int, int> inventory, CraftingSource craftingSource) : this(inventory,
                                                                                               craftingSource, RecursiveCraft.DepthSearch)
 {
 }