/// <summary> /// Adds custom save-safe crafting recipes /// </summary> /// <param name="recipe">The recipe to add</param> /// <returns>The internal id assigned to this recipe</returns> public static string RegisterRecipe(CraftingRecipe recipe) { if (StardewValley.CraftingRecipe.craftingRecipes == null || !StardewValley.CraftingRecipe.craftingRecipes.Any()) { throw new Exception("craftingRecipes is empty! This likely occurs if you try to register an item before AfterContentLoaded"); } CraftingRecipes.Add(recipe); recipe.PrivateName = $"{recipe.Name}:{IdManager.AssignUniqueId(200)}"; StardewValley.CraftingRecipe.craftingRecipes.Add(recipe.PrivateName, recipe.RecipeString); return(recipe.PrivateName); }