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

AddIngredient() public method

public AddIngredient ( Mod mod, string itemName, int stack = 1 ) : void
mod Mod
itemName string
stack int
return void
		public void AddIngredient(Mod mod, string itemName, int stack = 1)
		{
			if (mod == null)
			{
				mod = this.mod;
			}
			int type = mod.ItemType(itemName);
			if (type == 0)
			{
				string message = "The item " + itemName + " does not exist in the mod " + mod.Name + "." + Environment.NewLine;
				message += "If you are trying to use a vanilla item, try removing the first argument.";
				throw new RecipeException(message);
			}
			this.AddIngredient(type, stack);
		}

Same methods

ModRecipe::AddIngredient ( ModItem item, int stack = 1 ) : void
ModRecipe::AddIngredient ( int itemID, int stack = 1 ) : void
ModRecipe::AddIngredient ( string itemName, int stack = 1 ) : void

Usage Example

Ejemplo n.º 1
0
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Amethyst);
            recipe.AddIngredient(ItemID.RottenChunk, 10);
            recipe.AddIngredient(ItemID.ShadowScale, 10);
            recipe.AddIngredient(ItemID.SoulofNight, 5);
            recipe.AddIngredient(null, "PowerlessRing");
            recipe.AddTile(TileID.MythrilAnvil);
            recipe.SetResult(this);
            recipe.AddRecipe();
            recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Amethyst);
            recipe.AddIngredient(ItemID.Vertebrae, 10);
            recipe.AddIngredient(ItemID.TissueSample, 10);
            recipe.AddIngredient(ItemID.SoulofNight, 5);
            recipe.AddIngredient(null, "PowerlessRing");
            recipe.AddTile(TileID.MythrilAnvil);
            recipe.SetResult(this);
            recipe.AddRecipe();

            // DEBUGGING, REMOVE WHEN PUBLISHING
            recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.DirtBlock);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
All Usage Examples Of Terraria.ModLoader.ModRecipe::AddIngredient