SerenityJS
    Preparing search index...

    Represents a container.

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new container.

      Parameters

      • type: ContainerType
      • identifier: ContainerId

        The type of the container.

      • size: number

        The size of the container.

      Returns Container

    Properties

    identifier: ContainerId

    The identifier of the container.

    occupants: Set<Player> = ...

    The occupants of the container.

    storage: (null | ItemStack)[]

    The storage of the container.

    type: ContainerType

    The type of the container.

    Accessors

    Methods

    • 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

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

    • Updates a slot in the container for all the occupants.

      Parameters

      • slot: number

        The slot to be updated.

      Returns void