Skip to content

AvailableEnchantmentRegistry ​

final class · pocketmine\item\enchantment\AvailableEnchantmentRegistry · source

Registry of enchantments that can be applied to items during in-game enchanting (enchanting table, anvil, fishing, etc.).

Methods ​

getAll() ​

php
public function getAll() : array

getAllEnchantmentsForItem() ​

php
public function getAllEnchantmentsForItem(\pocketmine\item\Item $item) : array

Returns all available enchantments compatible with the item.

Warning: not suitable for obtaining enchantments for an enchanting table (use AvailableEnchantmentRegistry::getPrimaryEnchantmentsForItem() for that).

getPrimaryEnchantmentsForItem() ​

php
public function getPrimaryEnchantmentsForItem(\pocketmine\item\Item $item) : array

Returns enchantments that can be applied to the specified item in an enchanting table (primary only).

getPrimaryItemTags() ​

php
public function getPrimaryItemTags(\pocketmine\item\enchantment\Enchantment $enchantment) : array

Returns 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() ​

php
public function getSecondaryItemTags(\pocketmine\item\enchantment\Enchantment $enchantment) : array

Returns 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() ​

php
public function isAvailableForItem(\pocketmine\item\enchantment\Enchantment $enchantment, \pocketmine\item\Item $item) : bool

Returns 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() ​

php
public function isRegistered(\pocketmine\item\enchantment\Enchantment $enchantment) : bool

register() ​

php
public function register(\pocketmine\item\enchantment\Enchantment $enchantment, array $primaryItemTags, array $secondaryItemTags) : void

setPrimaryItemTags() ​

php
public function setPrimaryItemTags(\pocketmine\item\enchantment\Enchantment $enchantment, array $tags) : void

setSecondaryItemTags() ​

php
public function setSecondaryItemTags(\pocketmine\item\enchantment\Enchantment $enchantment, array $tags) : void

unregister() ​

php
public function unregister(\pocketmine\item\enchantment\Enchantment $enchantment) : void

unregisterAll() ​

php
public function unregisterAll() : void

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.