MCEnchantment
Link to mcenchantment
Импорт класса
Link to импорт-класса
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 Copyimport crafttweaker.api.enchantment.MCEnchantment;
Методы
Link to методы
Name: canApply
Checks if this Enchantment can be applied to the given IItemStack.
Returns: True if this Enchantment can apply to the given IItemStack. False otherwise.
Return Type: boolean
ZenScript Copy// MCEnchantment.canApply(stack as IItemStack) as boolean
<enchantment:minecraft:protection>.canApply(<item:minecraft:diamond_sword>);
Параметр | Тип | Описание |
---|---|---|
Параметр stack | Тип IItemStack | Описание The stack to check if this enchantment can be applied to. |
Name: canApplyAtEnchantingTable
Checks if this Enchantment can be applied to the given IItemStack at an enchanting table..
Returns: True if this Enchantment can be applied. False otherwise.
Return Type: boolean
ZenScript Copy// MCEnchantment.canApplyAtEnchantingTable(stack as ItemStack) as boolean
<enchantment:minecraft:protection>.canApplyAtEnchantingTable(<item:minecraft:stone_sword>);
Параметр | Тип | Описание |
---|---|---|
Параметр stack | Тип ItemStack | Описание The IItemStack to check against. |
Name: canGenerateInLoot
Checks if this Enchantment can generate in loot.
Returns: True if this Enchantment can generate in loot.
Return Type: boolean
ZenScript Copy// MCEnchantment.canGenerateInLoot() as boolean
<enchantment:minecraft:protection>.canGenerateInLoot();
Name: canVillagerTrade
Checks if a villager can sell this Enchantment.
Returns: True if a villager can sell this Enchantment. False otherwise.
Return Type: boolean
ZenScript Copy// MCEnchantment.canVillagerTrade() as boolean
<enchantment:minecraft:protection>.canVillagerTrade();
Name: getDisplayName
Gets the display name of this Enchantment at the given level.
Returns: The display name of this Enchantment at the level.
Return Type: MCTextComponent
ZenScript Copy// MCEnchantment.getDisplayName(level as int) as MCTextComponent
<enchantment:minecraft:protection>.getDisplayName(2);
Параметр | Тип | Описание |
---|---|---|
Параметр level | Тип int | Описание The level of this enchantment |
Name: getEntityEquipment
Gets a map of all equipment that the entity is currently holding that this Enchantment can be applied to.
Returns: A map of EquipmentSlotType to IItemStack
Return Type: IItemStack[MCEquipmentSlotType]
ZenScript Copy// MCEnchantment.getEntityEquipment(livingEntity as MCLivingEntity) as IItemStack[MCEquipmentSlotType]
<enchantment:minecraft:protection>.getEntityEquipment(entity);
Параметр | Тип | Описание |
---|---|---|
Параметр livingEntity | Тип MCLivingEntity | Описание The entity to check. |
Name: getMaxEnchantability
Gets the maximum enchantability required to enchant this Enchantment at the given enchantment level.
For example, to enchant an item with Fire Aspect at level 1, you need an enchantability that is less than 60..
Returns: The enchantability of the Enchantment at the given level.
Return Type: int
ZenScript Copy// MCEnchantment.getMaxEnchantability(enchantmentLevel as int) as int
<enchantment:minecraft:protection>.getMaxEnchantability(1);
Параметр | Тип | Описание |
---|---|---|
Параметр enchantmentLevel | Тип int | Описание The enchantment level to get the enchantability for. |
Name: getMaxLevel
Gets the maximum level for this Enchantment.
Returns: The maximum level for this Enchantment.
Return Type: int
ZenScript Copy// MCEnchantment.getMaxLevel() as int
<enchantment:minecraft:protection>.getMaxLevel();
Name: getMinEnchantability
Gets the minimum enchantability required to enchant this Enchantment at the given enchantment level.
For example, to enchant an item with Fire Aspect at level 1, you need an enchantability of at-least 10.
Returns: The enchantability of the Enchantment at the given level.
Return Type: int
ZenScript Copy// MCEnchantment.getMinEnchantability(enchantmentLevel as int) as int
<enchantment:minecraft:protection>.getMinEnchantability(1);
Параметр | Тип | Описание |
---|---|---|
Параметр enchantmentLevel | Тип int | Описание The enchantment level to get the enchantability for. |
Name: getMinLevel
Gets the minimum level for this Enchantment.
Returns: The minimum level for this Enchantment.
Return Type: int
ZenScript Copy// MCEnchantment.getMinLevel() as int
<enchantment:minecraft:protection>.getMinLevel();
Name: getName
Gets the name of this Enchantment
Returns: The name of this Enchantment
Return Type: string
ZenScript Copy// MCEnchantment.getName() as string
<enchantment:minecraft:protection>.getName();
Name: getRarity
Gets the Rarity of this Enchantment
Returns: The Rarity of this Enchantment
Return Type: EnchantmentRarity
ZenScript Copy// MCEnchantment.getRarity() as EnchantmentRarity
<enchantment:minecraft:protection>.getRarity();
Name: isAllowedOnBooks
Check if this Enchantment is allowed on books.
Returns: True if this Enchantment can be applied on books. False otherwise.
Return Type: boolean
ZenScript Copy// MCEnchantment.isAllowedOnBooks() as boolean
<enchantment:minecraft:protection>.isAllowedOnBooks();
Name: isCompatibleWith
Checks if this Enchantment is compatible with the other given Enchantment.
Returns: True if the Enchantments are compatible. False otherwise.
Return Type: boolean
ZenScript Copy// MCEnchantment.isCompatibleWith(other as MCEnchantment) as boolean
<enchantment:minecraft:protection>.isCompatibleWith(<enchantment:minecraft:efficiency>);
Параметр | Тип | Описание |
---|---|---|
Параметр other | Тип MCEnchantment | Описание The other Enchantment to check if it is compatible with this Enchantment |
Name: isCurse
Checks if this Enchantment is a curse Enchantment.
Returns: True if this Enchantment is a curse enchantment. False otherwise.
Return Type: boolean
ZenScript Copy// MCEnchantment.isCurse() as boolean
<enchantment:minecraft:protection>.isCurse();
Name: isTreasureEnchantment
Checks if this Enchantment is a treasure Enchantment.
Returns: True if this Enchantment is a treasure enchantment. False otherwise.
Return Type: boolean
ZenScript Copy// MCEnchantment.isTreasureEnchantment() as boolean
<enchantment:minecraft:protection>.isTreasureEnchantment();
Свойства
Link to свойства
Название | Тип | Имеет Getter | Имеет Setter | Описание |
---|---|---|---|---|
Название allowedOnBook | Тип boolean | Имеет Getter true | Имеет Setter false | Описание Check if this Enchantment is allowed on books. |
Название canGenerateInLoot | Тип boolean | Имеет Getter true | Имеет Setter false | Описание Checks if this Enchantment can generate in loot. |
Название canVillagerTrade | Тип boolean | Имеет Getter true | Имеет Setter false | Описание Checks if a villager can sell this Enchantment. |
Название curse | Тип boolean | Имеет Getter true | Имеет Setter false | Описание Checks if this Enchantment is a curse Enchantment. |
Название maxLevel | Тип int | Имеет Getter true | Имеет Setter false | Описание Gets the maximum level for this Enchantment. |
Название minLevel | Тип int | Имеет Getter true | Имеет Setter false | Описание Gets the minimum level for this Enchantment. |
Название name | Тип string | Имеет Getter true | Имеет Setter false | Описание Gets the name of this Enchantment |
Название rarity | Тип EnchantmentRarity | Имеет Getter true | Имеет Setter false | Описание Gets the Rarity of this Enchantment |
Название treasure | Тип boolean | Имеет Getter true | Имеет Setter false | Описание Checks if this Enchantment is a treasure Enchantment. |