-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMiscRecipes.cs
75 lines (70 loc) · 2.3 KB
/
MiscRecipes.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Localization;
using GoldensMisc.Items.Equipable;
using GoldensMisc.Items.Placeable;
using GoldensMisc.Items.Weapons;
namespace GoldensMisc
{
public class MiscRecipes : ModSystem
{
public override void AddRecipeGroups()
{
var recipeGroup = new RecipeGroup(() => Language.GetText("LegacyMisc.37") + " " + Lang.GetItemNameValue(ItemID.SilverBar),
ItemID.SilverBar,
ItemID.TungstenBar
);
RecipeGroup.RegisterGroup("GoldensMisc:Silver", recipeGroup);
if(ModContent.GetInstance<ServerConfig>().AncientMuramasa)
{
recipeGroup = new RecipeGroup(() => Language.GetText("LegacyMisc.37") + " " + Lang.GetItemNameValue(ItemID.Muramasa),
ItemID.Muramasa,
ModContent.ItemType<AncientMuramasa>()
);
RecipeGroup.RegisterGroup("GoldensMisc:Muramasa", recipeGroup);
}
if(ModContent.GetInstance<ServerConfig>().AncientForges)
{
recipeGroup = new RecipeGroup(() => Language.GetText("LegacyMisc.37") + " " + Lang.GetItemNameValue(ItemID.Hellforge),
ItemID.Hellforge,
ModContent.ItemType<AncientHellforge>()
);
RecipeGroup.RegisterGroup("GoldensMisc:Hellforge", recipeGroup);
}
}
public override void PostAddRecipes()
{
for (int i = 0; i < Recipe.numRecipes; i++)
{
Recipe recipe = Main.recipe[i];
if (ModContent.GetInstance<ServerConfig>().AncientMuramasa)
{
if (recipe.TryGetIngredient(ItemID.Muramasa, out Item ingredient))
{
recipe.RemoveIngredient(ingredient);
recipe.AddRecipeGroup("GoldensMisc:Muramasa");
}
}
if (ModContent.GetInstance<ServerConfig>().AncientForges)
{
if (recipe.TryGetIngredient(ItemID.Hellforge, out Item ingredient))
{
recipe.RemoveIngredient(ingredient);
recipe.AddRecipeGroup("GoldensMisc:Hellforge");
}
}
if (ModContent.GetInstance<ServerConfig>().NinjaGear)
{
if (recipe.TryGetIngredient(ItemID.Tabi, out Item ingredientTabi) && recipe.TryGetIngredient(ItemID.BlackBelt, out Item ingredientBelt) && !recipe.TryGetResult(ModContent.ItemType<NinjaGear>(), out Item _))
{
recipe.RemoveIngredient(ingredientTabi);
recipe.RemoveIngredient(ingredientBelt);
recipe.AddIngredient(ModContent.ItemType<NinjaGear>());
}
}
}
}
}
}