Home Getting Started With Scripts Commands Examples
BracketDumpers BracketHandlers BracketValidators

Enchantment

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 crafttweaker.api.item.enchantment.Enchantment;

Methods

Return Type: boolean

script.zs
Enchantment.canEnchant(stack as ItemStack) as boolean
ParameterTypeDescription
Parameter
stack
Type
ItemStack
Description
No Description Provided

Return Type: void

script.zs
Enchantment.doPostAttack(source as LivingEntity, target as Entity, level as int) as void
ParameterTypeDescription
Parameter
source
Type
LivingEntity
Description
No Description Provided
Parameter
target
Type
Entity
Description
No Description Provided
Parameter
level
Type
int
Description
No Description Provided

Return Type: void

script.zs
Enchantment.doPostHurt(source as LivingEntity, target as Entity, level as int) as void
ParameterTypeDescription
Parameter
source
Type
LivingEntity
Description
No Description Provided
Parameter
target
Type
Entity
Description
No Description Provided
Parameter
level
Type
int
Description
No Description Provided

Return Type: float

script.zs
Enchantment.getDamageBonus(level as int, mobType as MobType) as float
ParameterTypeDescription
Parameter
level
Type
int
Description
No Description Provided
Parameter
mobType
Type
MobType
Description
No Description Provided

Return Type: int

script.zs
Enchantment.getDamageProtection(level as int, source as DamageSource) as int
ParameterTypeDescription
Parameter
level
Type
int
Description
No Description Provided
Parameter
source
Type
DamageSource
Description
No Description Provided

Return Type: string

script.zs
// Enchantment.getDescriptionId() as string
myEnchantment.getDescriptionId();

Return Type: Component

script.zs
Enchantment.getFullname(level as int) as Component
ParameterTypeDescription
Parameter
level
Type
int
Description
No Description Provided

Return Type: int

script.zs
Enchantment.getMaxCost(level as int) as int
ParameterTypeDescription
Parameter
level
Type
int
Description
No Description Provided

Return Type: int

script.zs
// Enchantment.getMaxLevel() as int
myEnchantment.getMaxLevel();

Return Type: int

script.zs
Enchantment.getMinCost(level as int) as int
ParameterTypeDescription
Parameter
level
Type
int
Description
No Description Provided

Return Type: int

script.zs
// Enchantment.getMinLevel() as int
myEnchantment.getMinLevel();

Return Type: Rarity

script.zs
// Enchantment.getRarity() as Rarity
myEnchantment.getRarity();

Return Type: ItemStack[EquipmentSlot]

script.zs
Enchantment.getSlotItems(entity as LivingEntity) as ItemStack[EquipmentSlot]
ParameterTypeDescription
Parameter
entity
Type
LivingEntity
Description
No Description Provided

Return Type: boolean

script.zs
Enchantment.isCompatibleWith(other as Enchantment) as boolean
ParameterTypeDescription
Parameter
other
Type
Enchantment
Description
No Description Provided

Return Type: boolean

script.zs
// Enchantment.isCurse() as boolean
myEnchantment.isCurse();

Return Type: boolean

script.zs
// Enchantment.isDiscoverable() as boolean
myEnchantment.isDiscoverable();

Return Type: boolean

script.zs
// Enchantment.isTradeable() as boolean
myEnchantment.isTradeable();

Return Type: boolean

script.zs
// Enchantment.isTreasureOnly() as boolean
myEnchantment.isTreasureOnly();

Properties

NameTypeHas GetterHas SetterDescription
Name
commandString
Type
string
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
descriptionId
Type
string
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isCurse
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isDiscoverable
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isTradeable
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isTreasureOnly
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
maxLevel
Type
int
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
minLevel
Type
int
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
rarity
Type
Rarity
Has Getter
true
Has Setter
false
Description
No Description Provided