Terraria ModLoader  0.10.1.5
A framework for 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

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 70 of file RecipeHooks.cs.

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

70  {
71  ModRecipe modRecipe = recipe as ModRecipe;
72  if (modRecipe != null) {
73  modRecipe.OnCraft(item);
74  }
75  foreach (GlobalRecipe globalRecipe in globalRecipes) {
76  globalRecipe.OnCraft(item, recipe);
77  }
78  }

+ Here is the call graph for this function:

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 52 of file RecipeHooks.cs.

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

52  {
53  ModRecipe modRecipe = recipe as ModRecipe;
54  if (modRecipe != null && !modRecipe.RecipeAvailable()) {
55  return false;
56  }
57  foreach (GlobalRecipe globalRecipe in globalRecipes) {
58  if (!globalRecipe.RecipeAvailable(recipe)) {
59  return false;
60  }
61  }
62  return true;
63  }

+ Here is the call graph for this function: