Enchantment
Manages enchantment type data.
Methods
__construct()
public function __construct(\pocketmine\lang\Translatable|string $name, int $rarity, int $primaryItemFlags, int $secondaryItemFlags, int $maxLevel, ?\Closure $minEnchantingPower = null, int $enchantingPowerRange = 50)getMaxEnchantingPower()
public function getMaxEnchantingPower(int $level) : intReturns the maximum enchanting power value allowed for the particular level of the enchantment to be available in an enchanting table.
Enchanting power is a random value based on the number of bookshelves around an enchanting table and the enchantability of the item being enchanted. It is only used when determining the available enchantments for the enchantment options.
getMaxLevel()
public function getMaxLevel() : intReturns the maximum level of this enchantment that can be found on an enchantment table.
getMinEnchantingPower()
public function getMinEnchantingPower(int $level) : intReturns the minimum enchanting power value required for the particular level of the enchantment to be available in an enchanting table.
Enchanting power is a random value based on the number of bookshelves around an enchanting table and the enchantability of the item being enchanted. It is only used when determining the available enchantments for the enchantment options.
getName()
public function getName() : \pocketmine\lang\Translatable|stringReturns a translation key for this enchantment's name.
getPrimaryItemFlags()
public function getPrimaryItemFlags() : intDeprecated
Deprecated.
Returns a bitset indicating what item types can have this item applied from an enchanting table.
getRarity()
public function getRarity() : intReturns an int constant indicating how rare this enchantment type is.
getSecondaryItemFlags()
public function getSecondaryItemFlags() : intDeprecated
Deprecated.
Returns a bitset indicating what item types cannot have this item applied from an enchanting table, but can from an anvil.
hasPrimaryItemType()
public function hasPrimaryItemType(int $flag) : boolDeprecated
Deprecated.
Returns whether this enchantment can apply to the item type from an enchanting table.
hasSecondaryItemType()
public function hasSecondaryItemType(int $flag) : boolDeprecated
Deprecated.
Returns whether this enchantment can apply to the item type from an anvil, if it is not a primary item.
isCompatibleWith()
public function isCompatibleWith(\pocketmine\item\enchantment\Enchantment $other) : boolReturns whether this enchantment can be applied to the item along with the given enchantment.
