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.
import crafttweaker.api.item.enchantment.Enchantment;
Methods
Return Type: boolean
Enchantment.canEnchant(stack as ItemStack) as boolean
Parameter | Type |
---|---|
Parameter stack | Type ItemStack |
Enchantment.doPostAttack(source as LivingEntity, target as Entity, level as int)
Parameter | Type |
---|---|
Parameter source | Type LivingEntity |
Parameter target | Type Entity |
Parameter level | Type int |
Enchantment.doPostHurt(source as LivingEntity, target as Entity, level as int)
Parameter | Type |
---|---|
Parameter source | Type LivingEntity |
Parameter target | Type Entity |
Parameter level | Type int |
Return Type: float
Enchantment.getDamageBonus(level as int, mobType as MobType) as float
Parameter | Type |
---|---|
Parameter level | Type int |
Parameter mobType | Type MobType |
Return Type: int
Enchantment.getDamageProtection(level as int, source as DamageSource) as int
Parameter | Type |
---|---|
Parameter level | Type int |
Parameter source | Type DamageSource |
Return Type: string
// Enchantment.getDescriptionId() as string
myEnchantment.getDescriptionId();
Return Type: Component
Enchantment.getFullname(level as int) as Component
Parameter | Type |
---|---|
Parameter level | Type int |
Return Type: int
Enchantment.getMaxCost(level as int) as int
Parameter | Type |
---|---|
Parameter level | Type int |
Return Type: int
// Enchantment.getMaxLevel() as int
myEnchantment.getMaxLevel();
Return Type: int
Enchantment.getMinCost(level as int) as int
Parameter | Type |
---|---|
Parameter level | Type int |
Return Type: int
// Enchantment.getMinLevel() as int
myEnchantment.getMinLevel();
Return Type: Rarity
// Enchantment.getRarity() as Rarity
myEnchantment.getRarity();
Return Type: ResourceLocation
// Enchantment.getRegistryName() as ResourceLocation
myEnchantment.getRegistryName();
Return Type: ItemStack[EquipmentSlot]
Enchantment.getSlotItems(entity as LivingEntity) as ItemStack[EquipmentSlot]
Parameter | Type |
---|---|
Parameter entity | Type LivingEntity |
Return Type: boolean
Enchantment.isCompatibleWith(other as Enchantment) as boolean
Parameter | Type |
---|---|
Parameter other | Type Enchantment |
Return Type: boolean
// Enchantment.isCurse() as boolean
myEnchantment.isCurse();
Return Type: boolean
// Enchantment.isDiscoverable() as boolean
myEnchantment.isDiscoverable();
Return Type: boolean
// Enchantment.isTradeable() as boolean
myEnchantment.isTradeable();
Return Type: boolean
// Enchantment.isTreasureOnly() as boolean
myEnchantment.isTreasureOnly();
Properties
Name | Type | Has Getter | Has Setter |
---|---|---|---|
Name commandString | Type string | Has Getter true | Has Setter false |
Name descriptionId | Type string | Has Getter true | Has Setter false |
Name isCurse | Type boolean | Has Getter true | Has Setter false |
Name isDiscoverable | Type boolean | Has Getter true | Has Setter false |
Name isTradeable | Type boolean | Has Getter true | Has Setter false |
Name isTreasureOnly | Type boolean | Has Getter true | Has Setter false |
Name maxLevel | Type int | Has Getter true | Has Setter false |
Name minLevel | Type int | Has Getter true | Has Setter false |
Name rarity | Type Rarity | Has Getter true | Has Setter false |
Name registryName | Type ResourceLocation | Has Getter true | Has Setter false |