SerenityJS
    Preparing search index...

    Class ItemStackEnchantableTrait

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    identifier: string = ...

    The identifier of the trait.

    item: ItemStack

    The item stack that this trait is attached to.

    component: null | typeof ItemTypeComponent = null

    The item component that this trait is compatible with by default. If null, the trait will not attach to any item stack by default.

    identifier: "enchantable"

    The identifier of the trait.

    tag: null | string = null

    The item tag that this trait is compatible with by default. If null, the trait will not attach to any item stack by default.

    types: string[] = []

    The item type identifiers that this trait is compatible with by default.

    Methods

    • Adds an enchantment to the item stack.

      Parameters

      • id: Enchantment

        The enchantment id.

      • level: number

        The enchantment level.

      Returns void

    • Gets an enchantment level from the item stack.

      Parameters

      • id: Enchantment

        The enchantment id.

      Returns null | number

      The enchantment level if it exists; otherwise, null.

    • Checks if the item stack has an enchantment.

      Parameters

      • id: Enchantment

        The enchantment id.

      Returns boolean

      Whether the item stack has the enchantment.

    • Sets an enchantment on the item stack.

      Parameters

      • id: Enchantment

        The enchantment id.

      • level: number

        The enchantment level.

      Returns void