tModLoader v0.11.8.9
A mod to make and play Terraria mods
|
This class extends Terraria.Recipe, meaning you can use it in a similar manner to vanilla recipes. However, it provides methods that simplify recipe creation. Recipes are added by creating new instances of ModRecipe, then calling the AddRecipe method. More...
Public Member Functions | |
ModRecipe (Mod mod) | |
Constructor More... | |
void | AddIngredient (int itemID, int stack=1) |
Adds an ingredient to this recipe with the given item type and stack size. Ex: recipe.AddIngredient(ItemID.IronAxe) More... | |
void | AddIngredient (Mod mod, string itemName, int stack=1) |
Adds an ingredient to this recipe with the given item name from the given mod, and with the given stack stack. If the mod parameter is null, then it will automatically use an item from the mod creating this recipe. More... | |
void | AddIngredient (ModItem item, int stack=1) |
Adds an ingredient to this recipe of the given type of item and stack size. More... | |
void | AddRecipe () |
Adds this recipe to the game. Call this after you have finished setting the result, ingredients, etc. More... | |
void | AddRecipeGroup (int recipeGroupID, int stack=1) |
Adds a recipe group ingredient to this recipe with the given RecipeGroupID and stack size. Vanilla recipe group IDs can be found in Terraria.ID.RecipeGroupID and modded recipe group IDs will be returned from RecipeGroup.RegisterGroup. More... | |
void | AddRecipeGroup (string name, int stack=1) |
Adds a recipe group ingredient to this recipe with the given RecipeGroup name and stack size. Vanilla recipe groups consist of "Wood", "IronBar", "PresurePlate", "Sand", and "Fragment". More... | |
void | AddTile (int tileID) |
Adds a required crafting station with the given tile type to this recipe. Ex: recipe.AddTile(TileID.WorkBenches) More... | |
void | AddTile (Mod mod, string tileName) |
Adds a required crafting station to this recipe with the given tile name from the given mod. If the mod parameter is null, then it will automatically use a tile from the mod creating this recipe. More... | |
void | AddTile (ModTile tile) |
Adds a required crafting station to this recipe of the given type of tile. More... | |
virtual int | ConsumeItem (int type, int numRequired) |
Allows you to determine how many of a certain ingredient is consumed when this recipe is used. Return the number of ingredients that will actually be consumed. By default returns numRequired. More... | |
virtual void | OnCraft (Item item) |
Allows you to make anything happen when the player uses this recipe. The item parameter is the item the player has just crafted. More... | |
virtual bool | RecipeAvailable () |
Whether or not the conditions are met for this recipe to be available for the player to use. This hook can be used for conditions unrelated to items or tiles (for example, biome or time). More... | |
void | SetResult (int itemID, int stack=1) |
Sets the result of this recipe with the given item type and stack size. More... | |
void | SetResult (Mod mod, string itemName, int stack=1) |
Sets the result of this recipe with the given item name from the given mod, and with the given stack stack. If the mod parameter is null, then it will automatically use an item from the mod creating this recipe. More... | |
void | SetResult (ModItem item, int stack=1) |
Sets the result of this recipe to the given type of item and stack size. Useful in ModItem.AddRecipes. More... | |
Public Attributes | |
readonly Mod | mod |
Properties | |
int | RecipeIndex [get, private set] |
The index of the recipe in the Main.recipe array. More... | |
Private Attributes | |
int | numIngredients = 0 |
int | numTiles = 0 |
This class extends Terraria.Recipe, meaning you can use it in a similar manner to vanilla recipes. However, it provides methods that simplify recipe creation. Recipes are added by creating new instances of ModRecipe, then calling the AddRecipe method.
Definition at line 10 of file ModRecipe.cs.
Terraria.ModLoader.ModRecipe.ModRecipe | ( | Mod | mod | ) |
Constructor
mod | The mod the recipe originates from. |
Definition at line 28 of file ModRecipe.cs.
References Terraria.ModLoader.ModRecipe.mod.
void Terraria.ModLoader.ModRecipe.AddIngredient | ( | int | itemID, |
int | stack = 1 |
||
) |
Adds an ingredient to this recipe with the given item type and stack size. Ex: recipe.AddIngredient(ItemID.IronAxe)
itemID | The item identifier. |
stack | The stack. |
Definition at line 78 of file ModRecipe.cs.
References Terraria.ModLoader.ModRecipe.numIngredients.
Referenced by Terraria.ModLoader.ModRecipe.AddIngredient(), and Terraria.ModLoader.ModRecipe.AddRecipeGroup().
void Terraria.ModLoader.ModRecipe.AddIngredient | ( | Mod | mod, |
string | itemName, | ||
int | stack = 1 |
||
) |
Adds an ingredient to this recipe with the given item name from the given mod, and with the given stack stack. If the mod parameter is null, then it will automatically use an item from the mod creating this recipe.
mod | The mod. |
itemName | Name of the item. |
stack | The stack. |
RecipeException | The item " + itemName + " does not exist in mod " + mod.Name + ". If you are trying to use a vanilla item, try removing the first argument. |
Definition at line 93 of file ModRecipe.cs.
References Terraria.ModLoader.ModRecipe.AddIngredient(), Terraria.ModLoader.Environment, Terraria.ModLoader.Mod.ItemType(), and Terraria.ModLoader.ModRecipe.mod.
void Terraria.ModLoader.ModRecipe.AddIngredient | ( | ModItem | item, |
int | stack = 1 |
||
) |
Adds an ingredient to this recipe of the given type of item and stack size.
item | The item. |
stack | The stack. |
Definition at line 111 of file ModRecipe.cs.
References Terraria.ModLoader.ModRecipe.AddIngredient(), and Terraria.ModLoader.ModItem.item.
void Terraria.ModLoader.ModRecipe.AddRecipe | ( | ) |
Adds this recipe to the game. Call this after you have finished setting the result, ingredients, etc.
RecipeException | A recipe without any result has been added. |
Definition at line 221 of file ModRecipe.cs.
References Terraria.ModLoader.ModRecipe.mod.
void Terraria.ModLoader.ModRecipe.AddRecipeGroup | ( | int | recipeGroupID, |
int | stack = 1 |
||
) |
Adds a recipe group ingredient to this recipe with the given RecipeGroupID and stack size. Vanilla recipe group IDs can be found in Terraria.ID.RecipeGroupID and modded recipe group IDs will be returned from RecipeGroup.RegisterGroup.
recipeGroupID | The RecipeGroupID. |
stack | The stack. |
RecipeException | A recipe group with the ID " + recipeGroupID + " does not exist. |
Definition at line 137 of file ModRecipe.cs.
References Terraria.ModLoader.ModRecipe.AddIngredient().
void Terraria.ModLoader.ModRecipe.AddRecipeGroup | ( | string | name, |
int | stack = 1 |
||
) |
Adds a recipe group ingredient to this recipe with the given RecipeGroup name and stack size. Vanilla recipe groups consist of "Wood", "IronBar", "PresurePlate", "Sand", and "Fragment".
name | The name. |
stack | The stack. |
RecipeException | A recipe group with the name " + name + " does not exist. |
Definition at line 121 of file ModRecipe.cs.
References Terraria.ModLoader.ModRecipe.AddIngredient().
void Terraria.ModLoader.ModRecipe.AddTile | ( | int | tileID | ) |
Adds a required crafting station with the given tile type to this recipe. Ex: recipe.AddTile(TileID.WorkBenches)
tileID | The tile identifier. |
RecipeException | No tile has ID " + tileID |
Definition at line 152 of file ModRecipe.cs.
References Terraria.ModLoader.ModRecipe.numTiles, and Terraria.ModLoader.TileLoader.TileCount.
Referenced by Terraria.ModLoader.ModRecipe.AddTile().
void Terraria.ModLoader.ModRecipe.AddTile | ( | Mod | mod, |
string | tileName | ||
) |
Adds a required crafting station to this recipe with the given tile name from the given mod. If the mod parameter is null, then it will automatically use a tile from the mod creating this recipe.
mod | The mod. |
tileName | Name of the tile. |
RecipeException | The tile " + tileName + " does not exist in mod " + mod.Name + ". If you are trying to use a vanilla tile, try using ModRecipe.AddTile(tileID). |
Definition at line 168 of file ModRecipe.cs.
References Terraria.ModLoader.ModRecipe.AddTile(), Terraria.ModLoader.Environment, Terraria.ModLoader.ModRecipe.mod, and Terraria.ModLoader.Mod.TileType().
void Terraria.ModLoader.ModRecipe.AddTile | ( | ModTile | tile | ) |
Adds a required crafting station to this recipe of the given type of tile.
tile | The tile. |
Definition at line 185 of file ModRecipe.cs.
References Terraria.ModLoader.ModRecipe.AddTile(), and Terraria.ModLoader.ModTile.Type.
|
virtual |
Allows you to determine how many of a certain ingredient is consumed when this recipe is used. Return the number of ingredients that will actually be consumed. By default returns numRequired.
type | The type. |
numRequired | The number required. |
Definition at line 213 of file ModRecipe.cs.
|
virtual |
Allows you to make anything happen when the player uses this recipe. The item parameter is the item the player has just crafted.
item | The item. |
Definition at line 201 of file ModRecipe.cs.
Referenced by Terraria.ModLoader.RecipeHooks.OnCraft().
|
virtual |
Whether or not the conditions are met for this recipe to be available for the player to use. This hook can be used for conditions unrelated to items or tiles (for example, biome or time).
Definition at line 193 of file ModRecipe.cs.
Referenced by Terraria.ModLoader.RecipeHooks.RecipeAvailable().
void Terraria.ModLoader.ModRecipe.SetResult | ( | int | itemID, |
int | stack = 1 |
||
) |
Sets the result of this recipe with the given item type and stack size.
itemID | The item identifier. |
stack | The stack. |
Definition at line 39 of file ModRecipe.cs.
Referenced by Terraria.ModLoader.ModRecipe.SetResult().
void Terraria.ModLoader.ModRecipe.SetResult | ( | Mod | mod, |
string | itemName, | ||
int | stack = 1 |
||
) |
Sets the result of this recipe with the given item name from the given mod, and with the given stack stack. If the mod parameter is null, then it will automatically use an item from the mod creating this recipe.
mod | The mod the item originates from. |
itemName | Name of the item. |
stack | The stack. |
RecipeException | The item " + itemName + " does not exist in mod " + mod.Name + ". If you are trying to use a vanilla item, try removing the first argument. |
Definition at line 51 of file ModRecipe.cs.
References Terraria.ModLoader.Environment, Terraria.ModLoader.Mod.ItemType(), Terraria.ModLoader.ModRecipe.mod, and Terraria.ModLoader.ModRecipe.SetResult().
void Terraria.ModLoader.ModRecipe.SetResult | ( | ModItem | item, |
int | stack = 1 |
||
) |
Sets the result of this recipe to the given type of item and stack size. Useful in ModItem.AddRecipes.
item | The item. |
stack | The stack. |
Definition at line 69 of file ModRecipe.cs.
References Terraria.ModLoader.ModItem.item, and Terraria.ModLoader.ModRecipe.SetResult().
readonly Mod Terraria.ModLoader.ModRecipe.mod |
Definition at line 12 of file ModRecipe.cs.
Referenced by Terraria.ModLoader.ModRecipe.ModRecipe(), Terraria.ModLoader.ModRecipe.AddIngredient(), Terraria.ModLoader.ModRecipe.AddRecipe(), Terraria.ModLoader.ModRecipe.AddTile(), and Terraria.ModLoader.ModRecipe.SetResult().
|
private |
Definition at line 13 of file ModRecipe.cs.
Referenced by Terraria.ModLoader.ModRecipe.AddIngredient().
|
private |
Definition at line 14 of file ModRecipe.cs.
Referenced by Terraria.ModLoader.ModRecipe.AddTile().
|
getprivate set |
The index of the recipe in the Main.recipe array.
Definition at line 19 of file ModRecipe.cs.