Terraria.ModLoader.RecipeFinder.AddIngredient C# (CSharp) Method

AddIngredient() public method

public AddIngredient ( int itemID, int stack = 1 ) : void
itemID int
stack int
return void
		public void AddIngredient(int itemID, int stack = 1)
		{
			if (itemID <= 0 || itemID >= ItemLoader.ItemCount)
			{
				throw new RecipeException("No item has ID " + itemID);
			}
			Item item = new Item();
			item.SetDefaults(itemID, false);
			item.stack = stack;
			items.Add(item);
		}

Same methods

RecipeFinder::AddIngredient ( string itemName, int stack = 1 ) : void

Usage Example

コード例 #1
0
        public static void TestRecipeEditor(Mod mod)
        {
            RecipeFinder finder = new RecipeFinder();
            finder.AddIngredient(ItemID.Chain);
            foreach (Recipe recipe in finder.SearchRecipes())
            {
                RecipeEditor editor = new RecipeEditor(recipe);
                editor.DeleteIngredient(ItemID.Chain);
            }

            finder = new RecipeFinder();
            finder.AddRecipeGroup("IronBar");
            finder.AddTile(TileID.Anvils);
            finder.SetResult(ItemID.Chain, 10);
            Recipe recipe2 = finder.FindExactRecipe();
            if (recipe2 != null)
            {
                RecipeEditor editor = new RecipeEditor(recipe2);
                editor.DeleteRecipe();
            }
        }