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

This class provides hooks that control all recipes in the game. More...

Public Member Functions

virtual bool Autoload (ref string name)
 Allows you to automatically load a GlobalRecipe instead of using Mod.AddGlobalRecipe. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name. Use this method to either force or stop an autoload, and to change the default internal name. More...
 
virtual void OnCraft (Item item, Recipe recipe)
 Allows you to make anything happen when the player uses the given recipe. The item parameter is the item the player has just crafted. More...
 
virtual bool RecipeAvailable (Recipe recipe)
 Whether or not the conditions are met for the given 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...
 

Properties

Mod mod [get, set]
 The mod which added this GlobalRecipe. More...
 
string Name [get, set]
 The name of this GlobaRecipe. More...
 

Detailed Description

This class provides hooks that control all recipes in the game.

Definition at line 6 of file GlobalRecipe.cs.

Member Function Documentation

◆ Autoload()

virtual bool Terraria.ModLoader.GlobalRecipe.Autoload ( ref string  name)
virtual

Allows you to automatically load a GlobalRecipe instead of using Mod.AddGlobalRecipe. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name. Use this method to either force or stop an autoload, and to change the default internal name.

Definition at line 27 of file GlobalRecipe.cs.

27 {
28 return mod.Properties.Autoload;
29 }
Mod mod
The mod which added this GlobalRecipe.
Definition: GlobalRecipe.cs:11
ModProperties Properties
Definition: Mod.cs:52
bool Autoload
Whether or not this mod will autoload content by default. Autoloading content means you do not need t...

References Terraria.ModLoader.ModProperties.Autoload, Terraria.ModLoader.GlobalRecipe.mod, and Terraria.ModLoader.Mod.Properties.

Referenced by Terraria.ModLoader.Mod.AutoloadGlobalRecipe().

+ Here is the caller graph for this function:

◆ OnCraft()

virtual void Terraria.ModLoader.GlobalRecipe.OnCraft ( Item  item,
Recipe  recipe 
)
virtual

Allows you to make anything happen when the player uses the given recipe. The item parameter is the item the player has just crafted.

Parameters
itemThe item created.
recipeThe recipe used to create the item.

Definition at line 43 of file GlobalRecipe.cs.

43 {
44 }

Referenced by Terraria.ModLoader.RecipeHooks.OnCraft().

+ Here is the caller graph for this function:

◆ RecipeAvailable()

virtual bool Terraria.ModLoader.GlobalRecipe.RecipeAvailable ( Recipe  recipe)
virtual

Whether or not the conditions are met for the given 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 34 of file GlobalRecipe.cs.

34 {
35 return true;
36 }

Referenced by Terraria.ModLoader.RecipeHooks.RecipeAvailable().

+ Here is the caller graph for this function:

Property Documentation

◆ mod

Mod Terraria.ModLoader.GlobalRecipe.mod
getset

The mod which added this GlobalRecipe.

Definition at line 11 of file GlobalRecipe.cs.

11 {
12 get;
13 internal set;
14 }

Referenced by Terraria.ModLoader.GlobalRecipe.Autoload().

◆ Name

string Terraria.ModLoader.GlobalRecipe.Name
getset

The name of this GlobaRecipe.

Definition at line 19 of file GlobalRecipe.cs.

19 {
20 get;
21 internal set;
22 }

Referenced by Terraria.ModLoader.Mod.AutoloadGlobalRecipe().