Importare la Classe

Link to importare-la-classe

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
ParametroTipo
Parametro
stack
Tipo
ItemStack

Name: doPostAttack

ZenScript
Copy
Enchantment.doPostAttack(source as LivingEntity, target as Entity, level as int)
ParametroTipo
Parametro
sorgente
Tipo
LivingEntity
Parametro
target
Tipo
Entity
Parametro
level
Tipo
int

Name: doPostHurt

ZenScript
Copy
Enchantment.doPostHurt(source as LivingEntity, target as Entity, level as int)
ParametroTipo
Parametro
sorgente
Tipo
LivingEntity
Parametro
target
Tipo
Entity
Parametro
level
Tipo
int

Name: getDamageBonus

Return Type: float

ZenScript
Copy
Enchantment.getDamageBonus(level as int, mobType as MobType) as float
ParametroTipo
Parametro
level
Tipo
int
Parametro
mobType
Tipo
MobType

Link to getDamageProtection

Name: getDamageProtection

Return Type: int

ZenScript
Copy
Enchantment.getDamageProtection(level as int, source as DamageSource) as int
ParametroTipo
Parametro
level
Tipo
int
Parametro
sorgente
Tipo
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
ParametroTipo
Parametro
level
Tipo
int

Name: getMaxCost

Return Type: int

ZenScript
Copy
Enchantment.getMaxCost(level as int) as int
ParametroTipo
Parametro
level
Tipo
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
ParametroTipo
Parametro
level
Tipo
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]
ParametroTipo
Parametro
entity
Tipo
LivingEntity

Link to isCompatibleWith

Name: isCompatibleWith

Return Type: boolean

ZenScript
Copy
Enchantment.isCompatibleWith(other as Enchantment) as boolean
ParametroTipo
Parametro
other
Tipo
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();
NomeTipoHa GetterHa Setter
Nome
commandString
Tipo
string
Ha Getter
Ha Setter
no
Nome
descriptionId
Tipo
string
Ha Getter
Ha Setter
no
Nome
isCurse
Tipo
boolean
Ha Getter
Ha Setter
no
Nome
isDiscoverable
Tipo
boolean
Ha Getter
Ha Setter
no
Nome
isTradeable
Tipo
boolean
Ha Getter
Ha Setter
no
Nome
isTreasureOnly
Tipo
boolean
Ha Getter
Ha Setter
no
Nome
maxLevel
Tipo
int
Ha Getter
Ha Setter
no
Nome
minLevel
Tipo
int
Ha Getter
Ha Setter
no
Nome
rarity
Tipo
Rarity
Ha Getter
Ha Setter
no
Nome
registryName
Tipo
ResourceLocation
Ha Getter
Ha Setter
no