TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ Create() [2/2]

static Recipe Terraria.Recipe.Create ( int result,
int amount = 1 )
inlinestatic

Creates a recipe resulting in the given item and amount but does not yet register it into the game. Call this at the very beginning when creating a new craft.

Parameters
resultWhat item will be given when the craft has been completed
amountThe stack -> how many result items given when the recipe is crafted. (eg. 1 wood -> 4 wood platform)
Exceptions
T:Terraria.ModLoader.Exceptions.RecipeExceptionA Recipe can only be created inside recipe related methods

Definition at line 16629 of file Recipe.cs.

16630 {
16632 {
16633 throw new RecipeException("A Recipe can only be created inside recipe related methods");
16634 }
16635 ArgumentNullException.ThrowIfNull(RecipeLoader.CurrentMod, "RecipeLoader.CurrentMod");
16636 Recipe recipe = new Recipe(RecipeLoader.CurrentMod);
16637 recipe.createItem.SetDefaults(result, noMatCheck: false, null);
16638 recipe.createItem.stack = amount;
16639 return recipe;
16640 }
static bool setupRecipes
Set when tML sets up modded recipes. Used to detect misuse of CreateRecipe.
static Mod CurrentMod
The mod currently adding recipes.
This is where all Recipe hooks are gathered and called.
static Recipe()
Definition Recipe.cs:130

References Terraria.Recipe.Recipe(), Terraria.Recipe.createItem, Terraria.ModLoader.RecipeLoader.CurrentMod, Terraria.Item.SetDefaults(), and Terraria.ModLoader.RecipeLoader.setupRecipes.

+ Here is the call graph for this function: