Home Commands Examples Getting Started With Scripts Global Keywords 1.21 Migration Guide
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

ItemCost

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.villager.ItemCost;

Members

components() as DataComponentPredicate
script.zs
// ItemCost.components() as DataComponentPredicate;
myItemCost.components();

Return Type: DataComponentPredicate

Getter
script.zs
// ItemCost.count as int
myItemCost.count

Return Type: int

Getter
script.zs
// ItemCost.item as ItemDefinition
myItemCost.item

Return Type: ItemDefinition

Getter
script.zs
// ItemCost.itemStack as IItemStack
myItemCost.itemStack

Return Type: IItemStack

static of(stack as IItemStack) as ItemCost
script.zs
// ItemCost.of(stack as IItemStack) as ItemCost;
ItemCost.of(myIItemStack);

Parameters:

stack Type: IItemStack

Return Type: ItemCost

static of(stack as IItemStack, predicate as DataComponentPredicate) as ItemCost
script.zs
// ItemCost.of(stack as IItemStack, predicate as DataComponentPredicate) as ItemCost;
ItemCost.of(myIItemStack, myDataComponentPredicate);

Parameters:

Return Type: ItemCost

test(stack as IItemStack) as bool
script.zs
// ItemCost.test(stack as IItemStack) as bool;
myItemCost.test(myIItemStack);

Parameters:

stack Type: IItemStack

Return Type: bool

withComponents(operator as UnaryOperator<Builder>) as ItemCost
script.zs
// ItemCost.withComponents(operator as UnaryOperator<DataComponentPredicateBuilder>) as ItemCost;
myItemCost.withComponents(myUnaryOperator);

Parameters:

operator Type: UnaryOperator<DataComponentPredicateBuilder>

Return Type: ItemCost