Importing the class

Link to 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.

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

Link to g-

Name: canEnchant

Return Type: boolean

ZenScript
Copy
Enchantment.canEnchant(stack as ItemStack) as boolean
ParameterTypeDescription
Parameter
stack
Type
ItemStack
Description
No Description Provided

Link to g--1

Name: doPostAttack

Return Type: void

ZenScript
Copy
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

Link to g--2

Name: doPostHurt

Return Type: void

ZenScript
Copy
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

Link to g--3

Name: getDamageBonus

Return Type: float

ZenScript
Copy
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

Link to g--4

Name: getDamageProtection

Return Type: int

ZenScript
Copy
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

Link to g--5

Name: getDescriptionId

Return Type: string

ZenScript
Copy
// Enchantment.getDescriptionId() as string

myEnchantment.getDescriptionId();

Link to g--6

Name: getFullname

Return Type: Component

ZenScript
Copy
Enchantment.getFullname(level as int) as Component
ParameterTypeDescription
Parameter
level
Type
int
Description
No Description Provided

Link to g--7

Name: getMaxCost

Return Type: int

ZenScript
Copy
Enchantment.getMaxCost(level as int) as int
ParameterTypeDescription
Parameter
level
Type
int
Description
No Description Provided

Link to g--8

Name: getMaxLevel

Return Type: int

ZenScript
Copy
// Enchantment.getMaxLevel() as int

myEnchantment.getMaxLevel();

Link to g--9

Name: getMinCost

Return Type: int

ZenScript
Copy
Enchantment.getMinCost(level as int) as int
ParameterTypeDescription
Parameter
level
Type
int
Description
No Description Provided

Link to g--10

Name: getMinLevel

Return Type: int

ZenScript
Copy
// Enchantment.getMinLevel() as int

myEnchantment.getMinLevel();

Link to g--11

Name: getRarity

Return Type: Rarity

ZenScript
Copy
// Enchantment.getRarity() as Rarity

myEnchantment.getRarity();

Link to g--12

Name: getSlotItems

Return Type: ItemStack[EquipmentSlot]

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

Link to g--13

Name: isCompatibleWith

Return Type: boolean

ZenScript
Copy
Enchantment.isCompatibleWith(other as Enchantment) as boolean
ParameterTypeDescription
Parameter
other
Type
Enchantment
Description
No Description Provided

Name: isCurse

Return Type: boolean

ZenScript
Copy
// Enchantment.isCurse() as boolean

myEnchantment.isCurse();

Link to g--15

Name: isDiscoverable

Return Type: boolean

ZenScript
Copy
// Enchantment.isDiscoverable() as boolean

myEnchantment.isDiscoverable();

Link to g--16

Name: isTradeable

Return Type: boolean

ZenScript
Copy
// Enchantment.isTradeable() as boolean

myEnchantment.isTradeable();

Link to g--17

Name: isTreasureOnly

Return Type: boolean

ZenScript
Copy
// Enchantment.isTreasureOnly() as boolean

myEnchantment.isTreasureOnly();
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