Can't Add Multiple Recipes for an Item

AHIBoy

Steampunker
So I'm coding an item that has several recipes it's used in. Everything I've seen has put the recipes at the bottom of the item's page, yet all the recipes there give me the same error whenever I build and reload, "Recipe already has maximum number of ingredients. 14 is the max." I have looked at example mod and the recipe tutorial on the Terraria Forums and it hasn't helped me resolve the issue. The only thing that seems to work is putting it in a separate file with all the recipes, but then the recipes don't work in game. I'm relatively new to coding and can't seem to replicate the file with the recipes but here's the closest thing I have.

Code:
using Terraria.ID;
using Terraria.ModLoader;

namespace XTra
{
    public class EvilPowderRecipes
    {
            void AddRecipes()
        {

            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.DemoniteOre, 3);
            recipe.AddIngredient(ModContent.GetInstance<Items.EvilPowder>());
            recipe.AddTile(TileID.DemonAltar);
            recipe.SetResult(ItemID.CrimtaneOre);
            recipe.AddRecipe();

            ModRecipe recipe2 = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.CrimtaneOre, 3);
            recipe.AddIngredient(ModContent.GetInstance<Items.EvilPowder>());
            recipe.AddTile(TileID.DemonAltar);
            recipe.SetResult(ItemID.DemoniteOre);
            recipe.AddRecipe();

            ModRecipe recipe3 = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.CorruptSeeds, 5);
            recipe.AddIngredient(ModContent.GetInstance<Items.EvilPowder>());
            recipe.AddTile(TileID.DemonAltar);
            recipe.SetResult(ItemID.CrimsonSeeds);
            recipe.AddRecipe();

            ModRecipe recipe4 = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.CrimsonSeeds, 5);
            recipe.AddIngredient(ModContent.GetInstance<Items.EvilPowder>());
            recipe.AddTile(TileID.DemonAltar);
            recipe.SetResult(ItemID.CorruptSeeds);
            recipe.AddRecipe();

            ModRecipe recipe5 = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.PurpleSolution, 30);
            recipe.AddIngredient(ModContent.GetInstance<Items.EvilPowder>(), 5);
            recipe.AddTile(TileID.DemonAltar);
            recipe.SetResult(ItemID.RedSolution, 30);
            recipe.AddRecipe();

            ModRecipe recipe6 = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.RedSolution, 30);
            recipe.AddIngredient(ModContent.GetInstance<Items.EvilPowder>(), 5);
            recipe.AddTile(TileID.DemonAltar);
            recipe.SetResult(ItemID.PurpleSolution, 30);
            recipe.AddRecipe();

            ModRecipe recipe7 = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.ScourgeoftheCorruptor);
            recipe.AddIngredient(ItemID.CrimtaneBar, 15);
            recipe.AddIngredient(ItemID.Ichor, 10);
            recipe.AddIngredient(ModContent.GetInstance<Items.EvilPowder>(), 15);
            recipe.AddTile(TileID.MythrilAnvil);
            recipe.SetResult(ItemID.VampireKnives);
            recipe.AddRecipe();

            ModRecipe recipe8 = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.VampireKnives);
            recipe.AddIngredient(ModContent.GetInstance<Items.EvilPowder>(), 15);
            recipe.AddIngredient(ItemID.RottenChunk, 15);
            recipe.AddIngredient(ItemID.CursedFlame, 10);
            recipe.AddTile(TileID.MythrilAnvil);
            recipe.SetResult(ItemID.ScourgeoftheCorruptor);
            recipe.AddRecipe();
            }
        }
    }

Any help is much appreciated!
 
The guide mentions that for the 2nd and onward recipes, you don't write
`ModRecipe recipe2 = new ModRecipe(mod);`
you write
`recipe = new ModRecipe(mod);`

The issue is you are making `recipe2`, but then the lines after that are referring to the original `recipe`. The most clean way to write it is to keep reusing the `recipe` variable.


Also, come to the tmodloader discord if you need help, the forum is not a good place to look for modding help, it is basically unused.
 
The guide mentions that for the 2nd and onward recipes, you don't write
`ModRecipe recipe2 = new ModRecipe(mod);`
you write
`recipe = new ModRecipe(mod);`

The issue is you are making `recipe2`, but then the lines after that are referring to the original `recipe`. The most clean way to write it is to keep reusing the `recipe` variable.


Also, come to the tmodloader discord if you need help, the forum is not a good place to look for modding help, it is basically unused.
Thanks for the help! I’ll try checking out the discord too.
 
Back
Top Bottom