SerenityJS
    Preparing search index...
    Index

    Constructors

    Properties

    amount: number

    The amount of the item stack.

    container: null | Container = null

    The container the item stack is in. If the item stack is not in a container, this will be null.

    dynamicProperties: Map<string, JSONLikeValue> = ...

    The dynamic properties of the item stack.

    identifier: ItemIdentifier

    The identifier of the item stack.

    metadata: number

    The metadata value of the item stack.

    nbt: ItemStackNbtMap = ...

    The nbt data of the item stack.

    traits: Map<string, ItemTrait> = ...

    The traits of the item stack.

    type: ItemType

    The type of the item stack.

    world: World

    The world the item stack is in.

    Accessors

    Methods

    • Adds a trait to the itemstack.

      Type Parameters

      Parameters

      • trait: ItemTrait | K

        The trait to add to the itemstack.

      • Optionaloptions: ConstructorParameters<K>[1]

        The additional options to pass to the trait.

      Returns InstanceType<K>

      The trait instance that was added to the itemstack.

    • Decrements the amount of the item stack.

      Parameters

      • Optionalamount: number

        The amount to decrement.

      Returns void

    • Gets the specified dynamic property from the itemstack.

      Type Parameters

      Parameters

      • key: string

        The key of the dynamic property.

      Returns null | T

      The dynamic property if it exists, otherwise null

    • Gets the specified trait from the itemstack.

      Type Parameters

      Parameters

      • trait: K

        The trait to get from the itemstack

      Returns InstanceType<K>

      The trait if it exists, otherwise null

    • Gets the specified trait from the itemstack.

      Parameters

      • trait: string

        The trait to get from the itemstack

      Returns null | ItemTrait

      The trait if it exists, otherwise null

    • Checks if the itemstack has the specified dynamic property.

      Parameters

      • key: string

        The key of the dynamic property.

      Returns boolean

      Whether the itemstack has the dynamic property.

    • Increments the amount of the item stack.

      Parameters

      • Optionalamount: number

        The amount to increment.

      Returns void

    • Removes the specified dynamic property from the itemstack.

      Parameters

      • key: string

        The key of the dynamic property.

      Returns void

    • Start a cooldown for the item stack.

      Parameters

      • duration: number

        The duration of the cooldown in ticks.

      Returns void

    • Converts a network item instance descriptor to an item stack.

      Parameters

      • descriptor: NetworkItemInstanceDescriptor

        The network item instance descriptor.

      Returns null | ItemStack

      The item stack.

    • Converts the item stack to a network item instance descriptor. Which is used on the protocol level.

      Parameters

      Returns NetworkItemInstanceDescriptor

      The network item instance descriptor.

    • Converts the item stack to a network item stack descriptor. Which is used on the protocol level.

      Parameters

      Returns NetworkItemStackDescriptor

      The network item stack descriptor.