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.enchantment.EnchantmentType;

EnchantmentType is an enum. It has 14 enum constants. They are accessible using the code below.

ZenScript
Copy
EnchantmentType.ARMOR
EnchantmentType.ARMOR_FEET
EnchantmentType.ARMOR_LEGS
EnchantmentType.ARMOR_CHEST
EnchantmentType.ARMOR_HEAD
EnchantmentType.WEAPON
EnchantmentType.DIGGER
EnchantmentType.FISHING_ROD
EnchantmentType.TRIDENT
EnchantmentType.BREAKABLE
EnchantmentType.BOW
EnchantmentType.WEARABLE
EnchantmentType.CROSSBOW
EnchantmentType.VANISHABLE

Name: create

Creates a new EnchantmentType with the given name and given can enchantment predicate.

Returns: A new EnchantmentType with the given name and predicate.
Return Type: EnchantmentType

ZenScript
Copy
EnchantmentType.create(name as string, canEnchantPredicate as Predicate<MCItemDefinition>) as EnchantmentType
ParametroTipoDescrizione
Parametro
nome
Tipo
string
Descrizione
The name of the new EnchantmentType.
Parametro
canEnchantPredicate
Tipo
Predicate<MCItemDefinition>
Descrizione
The can enchant predicate.

Name: canEnchantItem

Checks if the given Item can be enchanted with this EnchantmentType

Returns: True if the Item can be enchanted. False otherwise.
Return Type: boolean

ZenScript
Copy
EnchantmentType.canEnchantItem(itemIn as MCItemDefinition) as boolean
ParametroTipoDescrizione
Parametro
itemIn
Tipo
MCItemDefinition
Descrizione
No Description Provided