tModLoader v0.11.8.9
A mod to make and play Terraria mods
RecipeGroupHelper.cs
Go to the documentation of this file.
1using System;
2using Terraria.ID;
3
4namespace Terraria.ModLoader
5{
6 internal static class RecipeGroupHelper
7 {
8 internal static void ResetRecipeGroups() {
9 RecipeGroup.recipeGroups.Clear();
10 RecipeGroup.recipeGroupIDs.Clear();
11 RecipeGroup.nextRecipeGroupIndex = 0;
12 }
13
14 internal static void AddOldVanillaGroups() {
15 RecipeGroup rec = new RecipeGroup(() => Lang.misc[37].Value + " " + Lang.GetItemNameValue(ItemID.Wood), new int[]
16 {
17 ItemID.Wood,
18 ItemID.Ebonwood,
19 ItemID.RichMahogany,
20 ItemID.Pearlwood,
21 ItemID.Shadewood,
22 ItemID.SpookyWood,
23 ItemID.BorealWood,
24 ItemID.PalmWood
25 });
26 RecipeGroupID.Wood = RecipeGroup.RegisterGroup("Wood", rec);
27 rec = new RecipeGroup(() => Lang.misc[37].Value + " " + Lang.GetItemNameValue(ItemID.IronBar), new int[]
28 {
29 ItemID.IronBar,
30 ItemID.LeadBar
31 });
32 RecipeGroupID.IronBar = RecipeGroup.RegisterGroup("IronBar", rec);
33 rec = new RecipeGroup(() => Lang.misc[37].Value + " " + Lang.misc[38].Value, new int[]
34 {
35 ItemID.RedPressurePlate,
36 ItemID.GreenPressurePlate,
37 ItemID.GrayPressurePlate,
38 ItemID.BrownPressurePlate,
39 ItemID.BluePressurePlate,
40 ItemID.YellowPressurePlate,
41 ItemID.LihzahrdPressurePlate
42 });
43 RecipeGroupID.PressurePlate = RecipeGroup.RegisterGroup("PresurePlate", rec);
44 rec = new RecipeGroup(() => Lang.misc[37].Value + " " + Lang.GetItemNameValue(ItemID.SandBlock), new int[]
45 {
46 ItemID.SandBlock,
47 ItemID.PearlsandBlock,
48 ItemID.CrimsandBlock,
49 ItemID.EbonsandBlock,
50 ItemID.HardenedSand
51 });
52 RecipeGroupID.Sand = RecipeGroup.RegisterGroup("Sand", rec);
53 rec = new RecipeGroup(() => Lang.misc[37].Value + " " + Lang.misc[51].Value, new int[]
54 {
55 ItemID.FragmentSolar,
56 ItemID.FragmentVortex,
57 ItemID.FragmentNebula,
58 ItemID.FragmentStardust
59 });
60 RecipeGroupID.Fragment = RecipeGroup.RegisterGroup("Fragment", rec);
61 }
62
63 internal static void AddRecipeGroups() {
64 foreach (Mod mod in ModLoader.Mods) {
65 try {
66 mod.AddRecipeGroups();
67 }
68 catch (Exception e) {
69 e.Data["mod"] = mod.Name;
70 throw;
71 }
72 }
73 FixRecipeGroupLookups();
74 }
75
76 internal static void FixRecipeGroupLookups() {
77 for (int k = 0; k < RecipeGroup.nextRecipeGroupIndex; k++) {
78 RecipeGroup rec = RecipeGroup.recipeGroups[k];
79 rec.ValidItemsLookup = new bool[ItemLoader.ItemCount];
80 foreach (int type in rec.ValidItems) {
81 rec.ValidItemsLookup[type] = true;
82 }
83 }
84 }
85 }
86}