AvailableEnchantmentRegistry
Registry of enchantments that can be applied to items during in-game enchanting (enchanting table, anvil, fishing, etc.).
Methods
getAll()
public function getAll() : arraygetAllEnchantmentsForItem()
public function getAllEnchantmentsForItem(\pocketmine\item\Item $item) : arrayReturns all available enchantments compatible with the item.
Warning: not suitable for obtaining enchantments for an enchanting table (use AvailableEnchantmentRegistry::getPrimaryEnchantmentsForItem() for that).
getPrimaryEnchantmentsForItem()
public function getPrimaryEnchantmentsForItem(\pocketmine\item\Item $item) : arrayReturns enchantments that can be applied to the specified item in an enchanting table (primary only).
getPrimaryItemTags()
public function getPrimaryItemTags(\pocketmine\item\enchantment\Enchantment $enchantment) : arrayReturns primary compatibility tags for the specified enchantment.
An item matching at least one of these tags (or its descendents) can be:
- Offered this enchantment in an enchanting table
- Enchanted by any means allowed by secondary tags
getSecondaryItemTags()
public function getSecondaryItemTags(\pocketmine\item\enchantment\Enchantment $enchantment) : arrayReturns secondary compatibility tags for the specified enchantment.
An item matching at least one of these tags (or its descendents) can be:
- Combined with an enchanted book with this enchantment in an anvil
- Obtained as loot with this enchantment, e.g. fishing, treasure chests, mob equipment, etc.
isAvailableForItem()
public function isAvailableForItem(\pocketmine\item\enchantment\Enchantment $enchantment, \pocketmine\item\Item $item) : boolReturns whether the specified enchantment can be applied to the particular item.
Warning: not suitable for checking the availability of enchantment for an enchanting table.
isRegistered()
public function isRegistered(\pocketmine\item\enchantment\Enchantment $enchantment) : boolregister()
public function register(\pocketmine\item\enchantment\Enchantment $enchantment, array $primaryItemTags, array $secondaryItemTags) : voidsetPrimaryItemTags()
public function setPrimaryItemTags(\pocketmine\item\enchantment\Enchantment $enchantment, array $tags) : voidsetSecondaryItemTags()
public function setSecondaryItemTags(\pocketmine\item\enchantment\Enchantment $enchantment, array $tags) : voidunregister()
public function unregister(\pocketmine\item\enchantment\Enchantment $enchantment) : voidunregisterAll()
public function unregisterAll() : void