ItemContainer
Implements
Index
Constructors
Properties
Methods
- addServerCloseListener
- addServerEventListener
- addServerOpenListener
- addToSlot
- asLegacyContainer
- asScriptableField
- clearSlot
- close
- closeFor
- dropAt
- dropSlot
- getAddTransferPolicy
- getBinding
- getBindingValidator
- getClientContainerTypeName
- getFieldSlot
- getFromSlot
- getFullSlot
- getGetTransferPolicy
- getNetworkEntity
- getNetworkName
- getParent
- getSlot
- getText
- getUiAdapter
- getValue
- getWindow
- getWindowContent
- getWorkbenchFieldSize
- handleDirtyBindingsPacket
- handleInventoryToSlotTransaction
- handleSlotToInventoryTransaction
- handleSlotToSlotTransaction
- isGlobalSlotSavingEnabled
- isLegacyContainer
- isSlotSavingEnabled
- markAllSlotsDirty
- markSlotDirty
- openFor
- removeEntity
- resetSlotSavingEnabled
- runTransaction
- sealAllSlots
- sealSlot
- sendChanges
- sendClosed
- sendDirtyClientBinding
- sendEvent
- sendInventoryToSlotTransaction
- sendResponseEvent
- sendSlotToInventoryTransaction
- sendSlotToSlotTransaction
- setBinding
- setBindingValidator
- setClientBinding
- setClientContainerTypeName
- setClientScale
- setClientText
- setDirtySlotListener
- setGlobalAddTransferPolicy
- setGlobalBindingValidator
- setGlobalDirtySlotListener
- setGlobalGetTransferPolicy
- setGlobalSlotSavingEnabled
- setParent
- setScale
- setSlot
- setSlotAddTransferPolicy
- setSlotGetTransferPolicy
- setSlotSavingEnabled
- setText
- setWorkbenchFieldPrefix
- setWorkbenchFieldSize
- validateAll
- validateSlot
- addClientCloseListener
- addClientEventListener
- addClientOpenListener
- getClientContainerInstance
- loadClass
- registerScreenFactory
Constructors
constructor
Constructs a new ItemContainer object.
Returns ItemContainer
Properties
readonlyisServer
readonlyslots
Type declaration
[key string]: ItemContainerSlot
readonlytransactionLock
Methods
addServerCloseListener
Parameters
listener: ServerOnCloseListener
Returns void
addServerEventListener
Parameters
name: string
listener: ServerEventListener
Returns void
addServerOpenListener
Parameters
listener: ServerOnOpenListener
Returns void
addToSlot
Parameters
name: string
id: number
count: number
data: number
extra: ItemExtraData
player: number
Returns number
asLegacyContainer
Parameters
allSlots: boolean
Returns Container
asScriptableField
Returns AbstractSlot[]
JS array of all slots.
clearSlot
Clears slot's contents.
Parameters
name: string
slot name
Returns void
close
Closes UI for all clients
Returns void
closeFor
Closes UI for client.
Parameters
client: NetworkClient
client in which UI will be open
Returns void
dropAt
Parameters
region: BlockSource
x: number
y: number
z: number
Returns void
dropSlot
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
getAddTransferPolicy
Parameters
slot: string
Returns TransferPolicy
getBinding
Parameters
composedBindingName: string
Returns PrimitiveTypes
getBindingValidator
Parameters
composedBindingName: string
Returns BindingValidator
getClientContainerTypeName
Returns string
getFieldSlot
Parameters
slot: number
slot index
Returns AbstractSlot
Workbench slot instance by slot index.
getFromSlot
Parameters
name: string
id: number
count: number
data: number
extra: ItemExtraData
player: number
Returns number
getFullSlot
Parameters
name: string
Returns ItemContainerSlot
getGetTransferPolicy
Parameters
slot: string
Returns TransferPolicy
getNetworkEntity
Returns NetworkEntity
getNetworkName
Returns string
getParent
Returns any
Tile if the following container is part of it, and
null
otherwise.
getSlot
Gets the slot by it's name. If a slot with specified name doesn't exists, creates an empty one with specified name.
Parameters
name: string
slot name
Returns ItemContainerSlot
Contents of the slot in a ItemContainerSlot object. You can modify it to change the contents of the slot.
getText
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.
getUiAdapter
Returns ItemContainerUiHandler
getValue
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.
getWindow
Returns IWindow
getWindowContent
Returns WindowContent
getWorkbenchFieldSize
Returns number
handleDirtyBindingsPacket
Parameters
client: NetworkClient
packet: JSONObject
Returns void
handleInventoryToSlotTransaction
Parameters
player: number
inventorySlot: number
slotName: string
amount: number
Returns void
handleSlotToInventoryTransaction
Parameters
player: number
slotName: string
inventorySlot: number
amount: number
Returns void
handleSlotToSlotTransaction
Parameters
player: number
slot1: string
slot2: string
amount: number
Returns void
isGlobalSlotSavingEnabled
Returns boolean
isLegacyContainer
Returns false
false
if container supports multiplayer,true
otherwise.
isSlotSavingEnabled
Parameters
name: string
Returns boolean
markAllSlotsDirty
Returns void
markSlotDirty
Parameters
name: string
Returns void
openFor
Opens UI for client.
Parameters
client: NetworkClient
client in which UI will be open
screenName: string
name of the screen to open
Returns void
removeEntity
Returns void
resetSlotSavingEnabled
Parameters
name: string
Returns void
runTransaction
Parameters
transaction: Transaction
Returns void
sealAllSlots
Returns void
sealSlot
Parameters
slotName: string
Returns void
sendChanges
Sends changes in container to all clients. Needs to be used every time when something changes in container.
Returns void
sendClosed
Returns void
sendDirtyClientBinding
Parameters
key: string
value: PrimitiveTypes
Returns void
sendEvent
Sends packet from client container copy to server.
Parameters
name: string
data: string | PacketData
Returns void
sendInventoryToSlotTransaction
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
sendResponseEvent
Sends packet from server container.
Parameters
name: string
data: string | PacketData
Returns void
sendSlotToInventoryTransaction
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
sendSlotToSlotTransaction
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
setBinding
Parameters
composedBindingName: string
value: PrimitiveTypes
Returns void
setBindingValidator
Parameters
composedBindingName: string
validator: BindingValidator
Returns void
setClientBinding
Parameters
composedBindingName: string
value: PrimitiveTypes
Returns void
setClientContainerTypeName
Parameters
type: string
Returns void
setClientScale
Parameters
elementName: string
value: number
Returns void
setClientText
Parameters
elementName: string
text: string
Returns void
setDirtySlotListener
Parameters
listener: DirtySlotListener
Returns void
setGlobalAddTransferPolicy
Parameters
policy: TransferPolicy
Returns ItemContainer
setGlobalBindingValidator
Parameters
validator: BindingValidator
Returns void
setGlobalDirtySlotListener
Parameters
listener: DirtySlotListener
Returns ItemContainer
setGlobalGetTransferPolicy
Parameters
policy: TransferPolicy
Returns ItemContainer
setGlobalSlotSavingEnabled
Parameters
enabled: boolean
Returns void
setParent
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
setScale
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
setSlot
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
name: string
slot name
slot: ItemContainerSlot
ItemContainerSlot object to specify slot contents
Returns void
setSlotAddTransferPolicy
Parameters
slotName: string
policy: TransferPolicy
Returns ItemContainer
setSlotGetTransferPolicy
Parameters
slotName: string
policy: TransferPolicy
Returns ItemContainer
setSlotSavingEnabled
Parameters
name: string
enabled: boolean
Returns void
setText
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
setWorkbenchFieldPrefix
Parameters
prefix: string
Returns void
setWorkbenchFieldSize
Parameters
workbenchFieldSize: number
Returns void
validateAll
Validates all the slots in the container.
Returns void
validateSlot
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
staticaddClientCloseListener
Parameters
typeName: string
listener: ClientOnCloseListener
Returns void
staticaddClientEventListener
Parameters
typeName: string
packetName: string
listener: ClientEventListener
Returns void
staticaddClientOpenListener
Parameters
typeName: string
listener: ClientOnOpenListener
Returns void
staticgetClientContainerInstance
Parameters
name: string
Returns ItemContainer
staticloadClass
Returns void
staticregisterScreenFactory
Parameters
factoryName: string
factory: UiScreenFactory
Returns void
Type of TileEntity container that supports multiplayer.