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

Spell

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.rootsclassic.Spell;

Implemented Interfaces

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

Methods

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

Adds a new Mortar recipe.

script.zs
// Spell.addMortarCrafting(uniqueName as string, items as IItemStack[], output as IItemStack)
<recipetype:rootsclassic:component>.addMortarCrafting("gunpowder_to_gold", [<item:minecraft:gunpowder>, <item:minecraft:coal>], <item:minecraft:gold_ingot>);
ParameterTypeDescription
Parameter
uniqueName
Type
string
Description
The unique name of the recipe
Parameter
items
Type
IItemStack[]
Description
The inputs of the recipe
Parameter
output
Type
IItemStack
Description
The output of the recipe

Return Type: stdlib.List<T>

script.zs
// Spell.getAllRecipes() as stdlib.List<T>
<recipetype:rootsclassic:component>.getAllRecipes();

Return Type: T

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

Return Type: T[ResourceLocation]

script.zs
// Spell.getRecipeMap() as T[ResourceLocation]
<recipetype:rootsclassic:component>.getRecipeMap();

Return Type: stdlib.List<T>

script.zs
Spell.getRecipesByOutput(output as IIngredient) as stdlib.List<T>
ParameterType
Parameter
output
Type
IIngredient
script.zs
Spell.remove(output as IIngredient)
ParameterType
Parameter
output
Type
IIngredient
script.zs
// Spell.removeAll()
<recipetype:rootsclassic:component>.removeAll();
script.zs
Spell.removeByInput(input as IItemStack)
ParameterType
Parameter
input
Type
IItemStack
script.zs
Spell.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
Spell.removeByName(names as string[])
ParameterType
Parameter
names
Type
string[]
script.zs
Spell.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

Modify the ingredients of an existing Spell Recipe, in order to keep the Spell Powder with the right type. Names must be one of:

  • rose_bush,
  • dandelion,
  • chorus,
  • nether_wart,
  • peony,
  • sunflower,
  • azure_bluet,
  • allium,
  • lilac,
  • white_tulip,
  • red_tulip,
  • blue_orchid,
  • poppy,
  • poisonous_potato,
  • orange_tulip,
  • pink_tulip,
  • oxeye_daisy,
  • lily_pad,
  • apple,
  • midnight_bloom,
  • flare_orchid,
  • radiant_daisy
Starting with rootsclassic in order to target the regular roots recipes (Example: "rootsclassic:rose_bush")
script.zs
// Spell.setSpellIngredients(name as ResourceLocation, ingredients as IItemStack[])
<recipetype:rootsclassic:component>.setSpellIngredients(<resource:rootsclassic:rose_bush>, [<item:minecraft:tnt>, <item:minecraft:apple>]);
ParameterTypeDescription
Parameter
name
Type
ResourceLocation
Description
The resourcelocation to target
Parameter
ingredients
Type
IItemStack[]
Description
The new ingredients of the recipe.

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