Script API - v1.20.30
    Preparing search index...

    This class represents a collection of enchantments that can be applied to an item.

    Implements

    Index

    Constructors

    • Beta

      Parameters

      • enchantmentSlot: number

      Returns EnchantmentList

      Creates a new EnchantmentList.

    Properties

    slot: number

    The item slot/type that this collection is applied to.

    Methods

    • Beta

      Returns Iterator<Enchantment>

      This function can't be called in read-only mode.

    • Beta

      Parameters

      Returns boolean

      Attempts to add the enchantment to this collection. Returns true if successful.

      This function can't be called in read-only mode.

    • Beta

      Parameters

      Returns boolean

      Returns whether or not the provided EnchantmentInstance can be added to this collection.

      This function can't be called in read-only mode.

    • Beta

      Parameters

      Returns Enchantment

      Returns an enchantment associated with a type.

      This function can't be called in read-only mode.

      This function can throw errors.

    • Beta

      Parameters

      Returns number

      If this collection has an EnchantmentInstance with type, returns the level of the enchantment. Returns 0 if not present.

      This function can throw errors.

    • Beta

      Returns IteratorResult<Enchantment>

      This function can't be called in read-only mode.

    • Beta

      Parameters

      Returns void

      Removes an EnchantmentInstance with type from this collection if present.

      This function can't be called in read-only mode.

      This function can throw errors.