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

Enchantment

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.Enchantment;

Members

Getter
script.zs
// Enchantment.anvilCost as int
myEnchantment.anvilCost

Return Type: int

canEnchant(stack as IItemStack) as bool
script.zs
// Enchantment.canEnchant(stack as IItemStack) as bool;
myEnchantment.canEnchant(myIItemStack);

Parameters:

stack Type: IItemStack

Return Type: bool

Getter
script.zs
// Enchantment.commandString as string
myEnchantment.commandString

Return Type: string

Getter
script.zs
// Enchantment.definition as EnchantmentDefinition
myEnchantment.definition

Return Type: EnchantmentDefinition

Getter
script.zs
// Enchantment.description as Component
myEnchantment.description

Return Type: Component

Getter
script.zs
// Enchantment.exclusiveSet as Enchantment[]
myEnchantment.exclusiveSet

Return Type: Enchantment[]

getMaxCost(level as int) as int
script.zs
// Enchantment.getMaxCost(level as int) as int;
myEnchantment.getMaxCost(myInt);

Parameters:

level Type: int

Return Type: int

getMinCost(level as int) as int
script.zs
// Enchantment.getMinCost(level as int) as int;
myEnchantment.getMinCost(myInt);

Parameters:

level Type: int

Return Type: int

getSlotItems(entity as LivingEntity) as IItemStack[EquipmentSlot]
script.zs
// Enchantment.getSlotItems(entity as LivingEntity) as IItemStack[EquipmentSlot];
myEnchantment.getSlotItems(myLivingEntity);

Parameters:

entity Type: LivingEntity

Return Type: IItemStack[EquipmentSlot]

isPrimaryItem(stack as IItemStack) as bool
script.zs
// Enchantment.isPrimaryItem(stack as IItemStack) as bool;
myEnchantment.isPrimaryItem(myIItemStack);

Parameters:

stack Type: IItemStack

Return Type: bool

isSupportedItem(stack as IItemStack) as bool
script.zs
// Enchantment.isSupportedItem(stack as IItemStack) as bool;
myEnchantment.isSupportedItem(myIItemStack);

Parameters:

stack Type: IItemStack

Return Type: bool

matchingSlot(slot as EquipmentSlot) as bool
script.zs
// Enchantment.matchingSlot(slot as EquipmentSlot) as bool;
myEnchantment.matchingSlot(myEquipmentSlot);

Parameters:

Return Type: bool

Getter
script.zs
// Enchantment.maxLevel as int
myEnchantment.maxLevel

Return Type: int

Getter
script.zs
// Enchantment.minLevel as int
myEnchantment.minLevel

Return Type: int

Getter
script.zs
// Enchantment.registryName as ResourceLocation
myEnchantment.registryName

Return Type: ResourceLocation

Getter
script.zs
// Enchantment.supportedItems as ItemDefinition[]
myEnchantment.supportedItems

Return Type: ItemDefinition[]

Getter
script.zs
// Enchantment.weight as int
myEnchantment.weight

Return Type: int