Пример #1
0
        public override void AddRecipes()
        {
            ItemRecipe recipe = new ItemRecipe();

            recipe.AddIngredient(ItemID.CopperBar, 5);
            recipe.AddIngredient(ItemID.StoneBlock, 100);
            recipe.SetResult(ItemID.Abeemination);
            recipe.AddRecipe();
        }
Пример #2
0
        public static List <ItemRecipe> GetUsages(this Item item)
        {
            List <ItemRecipe> result = new List <ItemRecipe>();

            foreach (Terraria.Recipe recipe in Main.recipe.Where(x => x.requiredItem.Select(y => y.type).Contains(item.type)))
            {
                ItemRecipe itemRecipe = new ItemRecipe();
                foreach (Item ingredient in recipe.requiredItem)
                {
                    if (!ingredient.IsAir)
                    {
                        itemRecipe.AddIngredient(ingredient.type, ingredient.stack);
                    }
                }
                foreach (int tile in recipe.requiredTile)
                {
                    if (tile > 0)
                    {
                        itemRecipe.AddTile(tile);
                    }
                }
                itemRecipe.createItems.Add(recipe.createItem);
                itemRecipe.anyIronBar       = recipe.anyIronBar;
                itemRecipe.anyFragment      = recipe.anyFragment;
                itemRecipe.anyWood          = recipe.anyWood;
                itemRecipe.anySand          = recipe.anySand;
                itemRecipe.anyPressurePlate = recipe.anyPressurePlate;
                result.Add(itemRecipe);
            }

            result.AddRange(TheOneLibrary.Instance.recipes.Where(x => x.requiredItem.Contains(item)));

            return(result);
        }