Home Migration Guide Getting Started With Scripts Commands Examples
Generic JSON Recipes

ItemStackIngredient

This class was added by a mod with mod-id mekanism. So you need to have this mod installed if you want to use this feature.

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.mekanism.api.ingredient.ItemStackIngredient;

Static Methods

Combines multiple ItemStackIngredients into a single ItemStackIngredient.

Returns: A single ItemStackIngredient representing all the passed in ingredients.
Return Type: ItemStackIngredient

script.zs
ItemStackIngredient.createMulti(ingredients as ItemStackIngredient[]) as ItemStackIngredient
ParameterTypeDescription
Parameter
ingredients
Type
ItemStackIngredient[]
Description
Ingredients to combine

Creates a ItemStackIngredient that matches a given ingredient with an amount of one.

Returns: A ItemStackIngredient that matches a given ingredient with an amount of one.
Return Type: ItemStackIngredient

script.zs
ItemStackIngredient.from(ingredient as IIngredient) as ItemStackIngredient
ParameterTypeDescription
Parameter
ingredient
Type
IIngredient
Description
Ingredient to match

Creates a ItemStackIngredient that matches a given ingredient with amount.

Returns: A ItemStackIngredient that matches a given ingredient with amount.
Return Type: ItemStackIngredient

script.zs
ItemStackIngredient.from(ingredient as IIngredientWithAmount) as ItemStackIngredient
ParameterTypeDescription
Parameter
ingredient
Type
IIngredientWithAmount
Description
Ingredient and amount to match

Creates a ItemStackIngredient out of all the ingredients in the given IngredientList.

Returns: A ItemStackIngredient made up of all the ingredients in the given IngredientList.
Return Type: ItemStackIngredient

script.zs
ItemStackIngredient.from(ingredientList as IngredientList) as ItemStackIngredient
ParameterTypeDescription
Parameter
ingredientList
Type
IngredientList
Description
Ingredients to match

Creates a ItemStackIngredient that matches a given item with an amount of one.

Returns: A ItemStackIngredient that matches a given item with an amount of one.
Return Type: ItemStackIngredient

script.zs
ItemStackIngredient.from(item as MCItemDefinition) as ItemStackIngredient
ParameterTypeDescription
Parameter
item
Type
MCItemDefinition
Description
Item to match

Creates a ItemStackIngredient that matches a given item tag with an amount of one.

Returns: A ItemStackIngredient that matches a given item tag with an amount of one.
Return Type: ItemStackIngredient

script.zs
ItemStackIngredient.from(itemTag as MCTag<MCItemDefinition>) as ItemStackIngredient
ParameterTypeDescription
Parameter
itemTag
Type
MCTag<MCItemDefinition>
Description
Tag to match

Creates a ItemStackIngredient that matches a given item tag with amount.

Returns: A ItemStackIngredient that matches a given item tag with amount.
Return Type: ItemStackIngredient

script.zs
ItemStackIngredient.from(itemTag as MCTagWithAmount<MCItemDefinition>) as ItemStackIngredient
ParameterTypeDescription
Parameter
itemTag
Type
MCTagWithAmount<MCItemDefinition>
Description
Tag and amount to match

Creates a ItemStackIngredient that matches a given item stack.

Returns: A ItemStackIngredient that matches a given item stack.
Return Type: ItemStackIngredient

script.zs
ItemStackIngredient.from(stack as IItemStack) as ItemStackIngredient
ParameterTypeDescription
Parameter
stack
Type
IItemStack
Description
Item stack to match

Creates a ItemStackIngredient that matches a given ingredient and amount.

Returns: A ItemStackIngredient that matches a given ingredient and amount.
Return Type: ItemStackIngredient

script.zs
ItemStackIngredient.from(ingredient as IIngredient, amount as int) as ItemStackIngredient
ParameterTypeDescription
Parameter
ingredient
Type
IIngredient
Description
Ingredient to match
Parameter
amount
Type
int
Description
Amount needed

Creates a ItemStackIngredient that matches a given item and amount.

Returns: A ItemStackIngredient that matches a given item and amount.
Return Type: ItemStackIngredient

script.zs
ItemStackIngredient.from(item as MCItemDefinition, amount as int) as ItemStackIngredient
ParameterTypeDescription
Parameter
item
Type
MCItemDefinition
Description
Item to match
Parameter
amount
Type
int
Description
Amount needed

Creates a ItemStackIngredient that matches a given item tag with a given amount.

Returns: A ItemStackIngredient that matches a given item tag with a given amount.
Return Type: ItemStackIngredient

script.zs
ItemStackIngredient.from(itemTag as MCTag<MCItemDefinition>, amount as int) as ItemStackIngredient
ParameterTypeDescription
Parameter
itemTag
Type
MCTag<MCItemDefinition>
Description
Tag to match
Parameter
amount
Type
int
Description
Amount needed

Casters

Result typeIs Implicit
Result type
IData
Is Implicit
true

Methods

Converts this ItemStackIngredient into JSON (IData).

Returns: ItemStackIngredient as JSON.
Return Type: IData

script.zs
// ItemStackIngredient.asIData() as IData
myItemStackIngredient.asIData();

OR’s this ItemStackIngredient with another ItemStackIngredient to create a multi ItemStackIngredient

Returns: Multi ItemStackIngredient that matches both the source ItemStackIngredient and the OR’d ItemStackIngredient.
Return Type: ItemStackIngredient

script.zs
ItemStackIngredient.or(other as ItemStackIngredient) as ItemStackIngredient
ParameterTypeDescription
Parameter
other
Type
ItemStackIngredient
Description
ItemStackIngredient to combine with.

Operators

Returns a new ItemStackIngredient using the two ItemStackIngredient as a base.

script.zs
(ing1 as ItemStackIngredient) | (ing2 as ItemStackIngredient);