tModLoader v0.11.8.9
A mod to make and play Terraria mods
Terraria.ModLoader.RecipeHooks Class Reference

This is where all ModRecipe and GlobalRecipe hooks are gathered and called. More...

+ Collaboration diagram for Terraria.ModLoader.RecipeHooks:

Static Public Member Functions

static void OnCraft (Item item, Recipe recipe)
 Allows you to make anything happen when a player uses this recipe. More...
 
static bool RecipeAvailable (Recipe recipe)
 Returns whether or not the conditions are met for this recipe to be available for the player to use. More...
 

Detailed Description

This is where all ModRecipe and GlobalRecipe hooks are gathered and called.

Definition at line 9 of file RecipeHooks.cs.

Member Function Documentation

◆ OnCraft()

static void Terraria.ModLoader.RecipeHooks.OnCraft ( Item  item,
Recipe  recipe 
)
static

Allows you to make anything happen when a player uses this recipe.

Parameters
itemThe item crafted.
recipeThe recipe used to craft the item.

Definition at line 78 of file RecipeHooks.cs.

78 {
79 ModRecipe modRecipe = recipe as ModRecipe;
80 if (modRecipe != null) {
81 modRecipe.OnCraft(item);
82 }
83 foreach (GlobalRecipe globalRecipe in globalRecipes) {
84 globalRecipe.OnCraft(item, recipe);
85 }
86 }

References Terraria.ModLoader.ModRecipe.OnCraft(), and Terraria.ModLoader.GlobalRecipe.OnCraft().

+ Here is the call graph for this function:

◆ RecipeAvailable()

static bool Terraria.ModLoader.RecipeHooks.RecipeAvailable ( Recipe  recipe)
static

Returns whether or not the conditions are met for this recipe to be available for the player to use.

Parameters
recipeThe recipe to check.
Returns
Whether or not the conditions are met for this recipe.

Definition at line 60 of file RecipeHooks.cs.

60 {
61 ModRecipe modRecipe = recipe as ModRecipe;
62 if (modRecipe != null && !modRecipe.RecipeAvailable()) {
63 return false;
64 }
65 foreach (GlobalRecipe globalRecipe in globalRecipes) {
66 if (!globalRecipe.RecipeAvailable(recipe)) {
67 return false;
68 }
69 }
70 return true;
71 }

References Terraria.ModLoader.ModRecipe.RecipeAvailable(), and Terraria.ModLoader.GlobalRecipe.RecipeAvailable().

+ Here is the call graph for this function: