Class ItemContainer

Type of TileEntity container that supports multiplayer.

Implements

Constructors

Methods

Properties

Constructors

Methods

  • Parameters

    • name: string
    • id: number
    • count: number
    • data: number
    • extra: ItemExtraData
    • player: number

    Returns number

  • Clears slot's contents.

    Parameters

    • name: string

      slot name

    Returns void

  • Drops slot's contents on the specified coordinates and clears the slot.

    Parameters

    • region: BlockSource
    • name: string

      slot name

    • x: number
    • y: number
    • z: number

    Returns void

  • Parameters

    • name: string
    • id: number
    • count: number
    • data: number
    • extra: ItemExtraData
    • player: number

    Returns number

  • Returns any

    Tile if the following container is part of it, and null otherwise.

  • Parameters

    • elementName: string

      element name

    Returns string

    Value "text" binding, usually the text displayed on the element, or null if no element with specified name exist.

  • Parameters

    • elementName: string

      element name

    • value: number

    Returns number

    Value with "value" binding, e.g. scale value, or null if no element with specified name exist.

  • Parameters

    • player: number
    • inventorySlot: number
    • slotName: string
    • amount: number

    Returns void

  • Parameters

    • player: number
    • slotName: string
    • inventorySlot: number
    • amount: number

    Returns void

  • Parameters

    • player: number
    • slot1: string
    • slot2: string
    • amount: number

    Returns void

  • Returns false

    false if container supports multiplayer, true otherwise.

  • Parameters

    • name: string

    Returns boolean

    2.2.0b82

  • Opens UI for client.

    Parameters

    • client: NetworkClient

      client in which UI will be open

    • screenName: string

      name of the screen to open

    Returns void

  • Parameters

    • name: string

    Returns void

    2.2.0b82

  • Sends changes in container to all clients. Needs to be used every time when something changes in container.

    Returns void

  • Sends event to move specified amount of items from the player inventory slot by given index to container slot by given name. This event is sent from client to server, so you should use it only on the client side, for example, in custom slot element touch events, etc.

    Parameters

    • inventorySlot: number

      numeric index of the inventory slot, from where to retrieve the item

    • slotName: string

      string name of the container slot, where to put taken item

    • amount: number

      item count to be retrieved from inventory slot

    Returns void

  • Sends packet from server container.

    Parameters

    Returns void

    Available only in server container events!

  • Sends event to move specified amount of items from the container slot by given name to player's inventory. The index of the inventory slot, where to put item, can't be specified, because it's decided by ItemContainer automatically, and you just don't need to do this. This event is sent from client to server, so you should use it only on the client side, for example, in custom slot element touch events, etc.

    Parameters

    • slot: string

      string name of the container slot, from where to retrieve item

    • amount: number

      item count to be retrieved from container slot

    Returns void

  • Sends event to move specified amount of items from one container slot to another by given names. This event is sent from client to server, so you should use it only on the client side, for example, in custom slot element touch events, etc.

    Parameters

    • slot1: string

      string name of the container slot, from where to retrieve item

    • slot2: string

      string name of the container slot, where to put taken item

    • amount: number

      item count to be retrieved from container slot

    Returns void

  • Parameters

    • elementName: string
    • value: number

    Returns void

  • Parameters

    • elementName: string
    • text: string

    Returns void

  • Parameters

    • enabled: boolean

    Returns void

    2.2.0b82

  • Sets container's parent object, for TileEntity's container it should be it reference, otherwise you can pass any value to be used in your code later.

    Parameters

    • parent: any

      an object to be set as container's parent

    Returns void

  • Sets "value" binding value for the element. Used to set scales values.

    Parameters

    • elementName: string

      element name

    • value: number

      value to be set for the element

    Returns void

  • Sets slot's content by it's name from given slot object. If a slot with specified name doesn't exist, a new slot with specified name and item will be created.

    Parameters

    Returns void

  • Set slot's content by it's name. If a slot with specified name doesn't exists, creates new with specified name and item.

    Parameters

    • name: string

      slot name

    • id: number
    • count: number
    • data: number

    Returns void

  • Set slot's content by it's name. If a slot with specified name doesn't exists, creates new with specified name and item.

    Parameters

    • name: string

      slot name

    • id: number
    • count: number
    • data: number
    • extra: ItemExtraData

      item extra data

    Returns void

  • Parameters

    • name: string
    • enabled: boolean

    Returns void

    2.2.0b82

  • Sets "text" binding value for the element. Used to set element's text.

    Parameters

    • elementName: string

      element name

    • text: string | number

      value to be set for the element

    Returns void

  • Parameters

    • workbenchFieldSize: number

    Returns void

    2.2.1b106

  • Validates slot contents. If the data value is less then 0, it becomes 0, if ID is 0 or count is less then or equals to zero, slot is reset to an empty one.

    Parameters

    • name: string

      slot name

    Returns void

Properties

isServer: boolean
slots: {
    [key: string]: ItemContainerSlot;
}
transactionLock: any

Copyright © 2024 Nernar. Copyright © 2020 #mineprogramming. Built with ❤ and TypeDoc.