SerenityJS
    Preparing search index...
    Index

    Constructors

    Properties

    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: string

    The identifier of the item stack.

    isStackable: boolean = true

    Whether the item stack is stackable. If true, the item stack can be stacked with other item stacks of the same type.

    maxStackSize: number = 64

    The maximum stack size of the item stack. This is the maximum amount of items that can be stacked in a single item stack.

    metadata: number

    The metadata value of the item stack.

    nbt: ItemStackNbtMap = ...

    The nbt data of the item stack.

    stackSize: number

    The amount of the item stack.

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

    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: ItemStackTrait | 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 size of the item stack.

      Parameters

      • Optionalsize: number

        The size to decrement.

      Returns void

    • Get the display name of the item stack.

      Returns string

      the display name of the item stack.

      This method depends on the ItemStackDisplayTrait.

    • 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

    • Get the lore of the item stack.

      Returns string[]

      The lore of the item stack.

      This method depends on the ItemStackDisplayTrait.

    • 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 size of the item stack.

      Parameters

      • Optionalsize: number

        The size to increment.

      Returns void

    • Removes the specified dynamic property from the itemstack.

      Parameters

      • key: string

        The key of the dynamic property.

      Returns void

    • Set the display name of the item stack.

      Parameters

      • name: null | string

        The display name to set for the item stack.

      Returns void

      This method depends on the ItemStackDisplayTrait, or adds it if it does not exist.

    • Set the lore of the item stack.

      Parameters

      • lore: string[]

        The lore to set for the item stack.

      Returns void

      This method depends on the ItemStackDisplayTrait, or adds it if it does not exist.

    • 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.