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

EnchantmentsByCost

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.item.enchantment.provider.type.EnchantmentsByCost;

Implements

EnchantmentsByCost implements the following interfaces:

EnchantmentProvider

Members

Getter
script.zs
// EnchantmentsByCost.cost as IntProvider
myEnchantmentsByCost.cost

Return Type: IntProvider

enchant(stack as ItemStack, enchantments as Mutable, random as RandomSource, difficulty as DifficultyInstance)
script.zs
// EnchantmentsByCost.enchant(stack as ItemStack, enchantments as ItemEnchantmentsMutable, random as RandomSource, difficulty as DifficultyInstance);
myEnchantmentsByCost.enchant(myItemStack, myMutable, myRandomSource, myDifficultyInstance);

Parameters:

Getter
script.zs
// EnchantmentsByCost.enchantments as Enchantment[]
myEnchantmentsByCost.enchantments

Return Type: Enchantment[]

static of(enchantments as Enchantment[], cost as IntProvider) as EnchantmentsByCost
script.zs
// EnchantmentsByCost.of(enchantments as Enchantment[], cost as IntProvider) as EnchantmentsByCost;
EnchantmentsByCost.of(myEnchantment[], myIntProvider);

Parameters:

enchantments Type: Enchantment[]
cost Type: IntProvider

Return Type: EnchantmentsByCost