Home Commands Examples Getting Started With Scripts Global Keywords
Generic JSON Recipes

AlloyRecipe

Importing the class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

script.zs
import mods.tfc.AlloyRecipe;

Implemented Interfaces

AlloyRecipe implements the following interfaces. That means all methods defined in these interfaces are also available in AlloyRecipe

Methods

script.zs
AlloyRecipe.addJsonRecipe(name as string, mapData as MapData)
ParameterType
Parameter
name
Type
string
Parameter
mapData
Type
MapData

Add an alloy recipe

script.zs
// AlloyRecipe.addRecipe(name as string, consumer as Consumer<AlloyBuilder>)
<recipetype:tfc:alloy>.addRecipe("alloy_test", (alloy) => {
alloy.Add("tfc:tin", 0.08, 0.12);
alloy.Add("tfc:copper", 0.88, 0.92);
alloy.Output("tfc:bronze");
// can also do it this way
// alloy.Add(<metal:tfc:tin>, 0.08, 0.12);
// alloy.Add(<metal:tfc:copper>, 0.88, 0.92);
// alloy.Output(<metal:tfc:bronze>);
});
ParameterTypeDescription
Parameter
name
Type
string
Description
recipe name
Parameter
consumer
Type
Consumer<AlloyBuilder>
Description
builder

Return Type: stdlib.List<T>

script.zs
// AlloyRecipe.getAllRecipes() as stdlib.List<T>
<recipetype:tfc:alloy>.getAllRecipes();

Return Type: T

script.zs
AlloyRecipe.getRecipeByName(name as string) as T
ParameterType
Parameter
name
Type
string

Return Type: T[ResourceLocation]

script.zs
// AlloyRecipe.getRecipeMap() as T[ResourceLocation]
<recipetype:tfc:alloy>.getRecipeMap();

Return Type: stdlib.List<T>

script.zs
AlloyRecipe.getRecipesByOutput(output as IIngredient) as stdlib.List<T>
ParameterType
Parameter
output
Type
IIngredient
script.zs
AlloyRecipe.remove(output as IIngredient)
ParameterType
Parameter
output
Type
IIngredient
script.zs
// AlloyRecipe.removeAll()
<recipetype:tfc:alloy>.removeAll();
script.zs
AlloyRecipe.removeByInput(input as IItemStack)
ParameterType
Parameter
input
Type
IItemStack
script.zs
AlloyRecipe.removeByModid(modid as string, exclude as Predicate<string>)
ParameterTypeOptionalDefault Value
Parameter
modid
Type
string
Optional
false
Default Value
Parameter
exclude
Type
Predicate<string>
Optional
true
Default Value
(name as string) as bool => false
script.zs
AlloyRecipe.removeByName(names as string[])
ParameterType
Parameter
names
Type
string[]
script.zs
AlloyRecipe.removeByRegex(regex as string, exclude as Predicate<string>)
ParameterTypeOptionalDefault Value
Parameter
regex
Type
string
Optional
false
Default Value
Parameter
exclude
Type
Predicate<string>
Optional
true
Default Value
(name as string) as bool => false

Properties

NameTypeHas GetterHas Setter
Name
allRecipes
Type
stdlib.List<T>
Has Getter
true
Has Setter
false
Name
recipeMap
Type
T[ResourceLocation]
Has Getter
true
Has Setter
false