29 for (
int k = 0; k < Recipe.maxRequirements; k++) {
30 if (recipe.requiredItem[k].type == 0) {
31 recipe.requiredItem[k].SetDefaults(itemID,
false);
32 recipe.requiredItem[k].stack = stack;
35 if (recipe.requiredItem[k].type == itemID) {
36 recipe.requiredItem[k].stack += stack;
40 throw new RecipeException(
"Recipe already has maximum number of ingredients");
53 for (
int k = 0; k < Recipe.maxRequirements; k++) {
54 if (recipe.requiredItem[k].type == itemID) {
55 recipe.requiredItem[k].stack = stack;
71 for (
int k = 0; k < Recipe.maxRequirements; k++) {
72 if (recipe.requiredItem[k].type == itemID) {
73 for (
int j = k; j < Recipe.maxRequirements - 1; j++) {
74 recipe.requiredItem[j] = recipe.requiredItem[j + 1];
76 recipe.requiredItem[Recipe.maxRequirements - 1] =
new Item();
90 if (!RecipeGroup.recipeGroupIDs.TryGetValue(groupName, out groupID)) {
93 if (recipe.acceptedGroups.Contains(groupID)) {
96 recipe.acceptedGroups.Add(groupID);
107 if (!RecipeGroup.recipeGroupIDs.TryGetValue(groupName, out groupID)) {
110 return recipe.acceptedGroups.Remove(groupID);
122 recipe.createItem.SetDefaults(itemID);
123 recipe.createItem.stack = stack;
135 for (
int k = 0; k < Recipe.maxRequirements; k++) {
136 if (recipe.requiredTile[k] == -1) {
137 recipe.requiredTile[k] = tileID;
140 if (recipe.requiredTile[k] == tileID) {
144 throw new RecipeException(
"Recipe already has maximum number of tiles");
156 for (
int k = 0; k < Recipe.maxRequirements; k++) {
157 if (recipe.requiredTile[k] == tileID) {
158 for (
int j = k; j < Recipe.maxRequirements - 1; j++) {
159 recipe.requiredTile[j] = recipe.requiredTile[j + 1];
161 recipe.requiredTile[Recipe.maxRequirements - 1] = -1;
173 recipe.needWater = needWater;
181 recipe.needLava = needLava;
189 recipe.needHoney = needHoney;
197 for (
int k = 0; k < Recipe.numRecipes; k++) {
198 if (Main.recipe[k] == recipe) {
199 for (
int j = k; j < Recipe.numRecipes - 1; j++) {
200 Main.recipe[j] = Main.recipe[j + 1];
202 Main.recipe[Recipe.numRecipes - 1] =
new Recipe();
bool AddTile(int tileID)
Adds the crafting station with the given tile ID to the recipe. Returns true if the operation was suc...
void SetNeedWater(bool needWater)
A convenience method for setting recipe.needWater.
This class allows you to make any changes you want to a recipe, whether it be adding/removing ingredi...
bool DeleteTile(int tileID)
Removes the crafting station with the given tile ID as a requirement from the recipe. Returns true if the operation was successful. Returns false if the recipe did not require the tile in the first place. Can also throw a RecipeException.
void SetNeedHoney(bool needHoney)
A convenience method for setting recipe.needHoney.
bool SetIngredientStack(int itemID, int stack)
Sets the stack requirement of the ingredient with the given item ID in the recipe. Returns true if the operation was successful. Returns false if the recipe does not contain the ingredient. Can also throw a RecipeException.
void SetNeedLava(bool needLava)
A convenience method for setting recipe.needLava.
bool RejectRecipeGroup(string groupName)
Removes the recipe group with the given name from the recipe. This is the opposite of AcceptRecipeGro...
This serves as the central class from which tile-related functions are supported and carried out...
bool DeleteIngredient(int itemID)
Deletes the ingredient requirement with the given ID from the recipe. Returns true if the operation w...
void SetResult(int itemID, int stack=1)
A convenience method for setting the result of the recipe. Similar to calling recipe.createItem.SetDefaults(itemID), followed by recipe.createItem.stack = stack. Can also throw a RecipeException.
This serves as the central class from which item-related functions are carried out. It also stores a list of mod items by ID.
void AddIngredient(int itemID, int stack=1)
Adds an ingredient with the given item ID and stack size to the recipe. If the recipe already contain...
bool DeleteRecipe()
Completely removes the recipe from the game, making it unusable. Returns true if the operation was su...
RecipeEditor(Recipe recipe)
Creates a recipe editor that acts on the given recipe.
bool AcceptRecipeGroup(string groupName)
Adds the recipe group with the given name to the recipe. Note that, unlike ModRecipe and RecipeFinder...