Documentation

ItemEnchantmentHandlingTrait

This trait encapsulates all enchantment handling needed for itemstacks.

The primary purpose of this trait is providing scope isolation for the methods it contains.

Table of Contents

$enchantments  : array<string|int, EnchantmentInstance>
addEnchantment()  : $this
getEnchantment()  : EnchantmentInstance|null
getEnchantmentLevel()  : int
Returns the level of the enchantment on this item with the specified ID, or 0 if the item does not have the enchantment.
getEnchantments()  : array<string|int, EnchantmentInstance>
hasEnchantment()  : bool
hasEnchantments()  : bool
removeEnchantment()  : $this
removeEnchantments()  : $this

Properties

Methods

getEnchantmentLevel()

Returns the level of the enchantment on this item with the specified ID, or 0 if the item does not have the enchantment.

public getEnchantmentLevel(Enchantment $enchantment) : int
Parameters
$enchantment : Enchantment
Return values
int

Search results