SerenityJS
    Preparing search index...

    Class BlockContainer

    Represents a container.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    block: Block

    The block that this container is attached to.

    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

    • get emptySlotsCount(): number

      The amount of empty slots in the container.

      Returns number

    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

    • 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