SerenityJS
    Preparing search index...

    Represents a container.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    identifier: null | ContainerId = null

    The identifier override of the container. If null, the container will assign a incremental identifier for each player.

    storage: (null | ItemStack)[] = []

    The storage of the container.

    type: ContainerType

    The type of the container.

    Accessors

    Methods

    • Adds an item stack to the container. The item stack is merged into the stacks of the same item that are not full, and the rest is placed in empty slots. What does not fit is left in the item stack.

      Parameters

      Returns boolean

      Whether all of the item stack was added into the container.

    • Close the container for a player.

      Parameters

      • player: Player

        The player to close the container for.

      • serverInitiated: boolean = true

        Whether the close was initiated by the server.

      Returns void

    • Removes an item from the container.

      Parameters

      • slot: number

        The slot to remove the item from.

      • amount: number

        The amount of the item to remove.

      Returns null | ItemStack

    • Sets the size of the container.

      Parameters

      • value: number

        The new size of the container.

      Returns void

    • Shows the container to a player.

      Parameters

      • player: Player

        The player to show the container to.

      Returns number

      The container identifier assigned to the player.

    • Swaps items in the container.

      Parameters

      • slot: number

        The slot to swap the item from.

      • otherSlot: number

        The slot to swap the item to.

      • OptionalotherContainer: Container

        The other container to swap the item to.

      Returns void

    • Takes an item from the container.

      Parameters

      • slot: number

        The slot to take the item from.

      • amount: number

        The amount of the item to take.

      Returns null | ItemStack

      The taken item.