Skip to content

EnchantingHelper ​

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

Helper methods used for enchanting using the enchanting table.

Methods ​

enchantItem() ​

php
public static function enchantItem(\pocketmine\item\Item $item, array $enchantments) : \pocketmine\item\Item

enchantWithLevels() 5.46.0 ​

php
public static function enchantWithLevels(\pocketmine\item\Item $item, int $levels, \pocketmine\utils\Random $random) : \pocketmine\item\Item

Enchants the item like an enchanting table option of the given level (vanilla enchant_with_levels loot function, without treasure enchantments). Books become enchanted books. Returns the item unchanged when nothing can be applied.

generateOptions() ​

php
public static function generateOptions(\pocketmine\world\Position $tablePos, \pocketmine\item\Item $input, int $seed) : array

generateSeed() ​

php
public static function generateSeed() : int

Generates a new random seed for enchant option randomization.

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