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.

ZenScript
Copy
import crafttweaker.api.item.enchantment.Enchantment;

Name: canEnchant

Return Type: boolean

ZenScript
Copy
Enchantment.canEnchant(stack as ItemStack) as boolean
参数类型
参数
堆叠
类型
物品应用

Name: doPostAttack

ZenScript
Copy
Enchantment.doPostAttack(source as LivingEntity, target as Entity, level as int)
参数类型
参数
来源
类型
LivingEntity
参数
target
类型
Entity
参数
level
类型
int

Name: doPostHurt

ZenScript
Copy
Enchantment.doPostHurt(source as LivingEntity, target as Entity, level as int)
参数类型
参数
来源
类型
LivingEntity
参数
target
类型
Entity
参数
level
类型
int

Name: getDamageBonus

Return Type: float

ZenScript
Copy
Enchantment.getDamageBonus(level as int, mobType as MobType) as float
参数类型
参数
level
类型
int
参数
mobType
类型
MobType

Link to getDamageProtection

Name: getDamageProtection

Return Type: int

ZenScript
Copy
Enchantment.getDamageProtection(level as int, source as DamageSource) as int
参数类型
参数
level
类型
int
参数
来源
类型
DamageSource

Link to getDescriptionId

Name: getDescriptionId

Return Type: string

ZenScript
Copy
// Enchantment.getDescriptionId() as string

myEnchantment.getDescriptionId();

Name: getFullname

Return Type: Component

ZenScript
Copy
Enchantment.getFullname(level as int) as Component
参数类型
参数
level
类型
int

Name: getMaxCost

Return Type: int

ZenScript
Copy
Enchantment.getMaxCost(level as int) as int
参数类型
参数
level
类型
int

Name: getMaxLevel

Return Type: int

ZenScript
Copy
// Enchantment.getMaxLevel() as int

myEnchantment.getMaxLevel();

Name: getMinCost

Return Type: int

ZenScript
Copy
Enchantment.getMinCost(level as int) as int
参数类型
参数
level
类型
int

Name: getMinLevel

Return Type: int

ZenScript
Copy
// Enchantment.getMinLevel() as int

myEnchantment.getMinLevel();

Name: getRarity

Return Type: Rarity

ZenScript
Copy
// Enchantment.getRarity() as Rarity

myEnchantment.getRarity();

Name: getRegistryName

Return Type: ResourceLocation

ZenScript
Copy
// Enchantment.getRegistryName() as ResourceLocation

myEnchantment.getRegistryName();

Name: getSlotItems

Return Type: ItemStack[EquipmentSlot]

ZenScript
Copy
Enchantment.getSlotItems(entity as LivingEntity) as ItemStack[EquipmentSlot]
参数类型
参数
entity
类型
LivingEntity

Link to isCompatibleWith

Name: isCompatibleWith

Return Type: boolean

ZenScript
Copy
Enchantment.isCompatibleWith(other as Enchantment) as boolean
参数类型
参数
other
类型
Enchantment

Name: isCurse

Return Type: boolean

ZenScript
Copy
// Enchantment.isCurse() as boolean

myEnchantment.isCurse();

Name: isDiscoverable

Return Type: boolean

ZenScript
Copy
// Enchantment.isDiscoverable() as boolean

myEnchantment.isDiscoverable();

Name: isTradeable

Return Type: boolean

ZenScript
Copy
// Enchantment.isTradeable() as boolean

myEnchantment.isTradeable();

Name: isTreasureOnly

Return Type: boolean

ZenScript
Copy
// Enchantment.isTreasureOnly() as boolean

myEnchantment.isTreasureOnly();
名称类型可获得可设置
名称
commandString #命令字符串
类型
string
可获得
true
可设置
false
名称
descriptionId
类型
string
可获得
true
可设置
false
名称
isCurse
类型
布尔值
可获得
true
可设置
false
名称
isDiscoverable
类型
布尔值
可获得
true
可设置
false
名称
isTradeable
类型
布尔值
可获得
true
可设置
false
名称
isTreasureOnly
类型
布尔值
可获得
true
可设置
false
名称
maxLevel
类型
int
可获得
true
可设置
false
名称
minLevel
类型
int
可获得
true
可设置
false
名称
rarity
类型
Rarity
可获得
true
可设置
false
名称
registryName
类型
资源位置
可获得
true
可设置
false