Item Interface: Difference between revisions
Appearance
Created page with "alt=Item interface block|thumb|Item interface block The Item Interface allows interacting with in-world inventories and moving items between inventories of blocks that are adjacent to the item interface. A basic example would be reading inventory contents, or making a sorting system that automatically voids certain items by dropping them into lava. File:ItemInterfaceExampleSetup.png|alt=Example setup utilizing the item interface to trans..." |
No edit summary |
||
| Line 15: | Line 15: | ||
| style="white-space: nowrap;" | <code>:getNeighborSlotCount(side:integer)</code>|| <code>integer</code>|| Returns the number of slots of the given inventory. | | style="white-space: nowrap;" | <code>:getNeighborSlotCount(side:integer)</code>|| <code>integer</code>|| Returns the number of slots of the given inventory. | ||
|- | |- | ||
|<code>moveItemStackFromTo(sideSource:integer, slotSource:integer, sideDest:integer, slotDest:integer | |<code>moveItemStackFromTo(sideSource:integer, slotSource:integer, sideDest:integer, slotDest:integer[, maxAmount:integer])</code> | ||
|<code>integer</code> | |<code>integer</code> | ||
|Moves the maximum amount of items from the given ''source side'' and ''source slot'' to the given ''destination side'' and ''destination slot''. If <code>maxAmount</code> is omitted, it defaults to <math display="inline">2^{31}-1</math>. | |Moves the maximum amount of items from the given ''source side'' and ''source slot'' to the given ''destination side'' and ''destination slot''. If <code>maxAmount</code> is omitted, it defaults to <math display="inline">2^{31}-1</math>. | ||
Revision as of 18:07, 1 August 2026

The Item Interface allows interacting with in-world inventories and moving items between inventories of blocks that are adjacent to the item interface. A basic example would be reading inventory contents, or making a sorting system that automatically voids certain items by dropping them into lava.

Provided component
This block provides the itemInterface component, offering methods shown below. For information on the side argument, see API:Sides.
| Name | Type | Description |
|---|---|---|
:getNeighborBlockName(side:integer) |
String |
Returns the name of the block that is connected on that side, e.g. minecraft:chest or minecraft:air.
|
:getNeighborSlotCount(side:integer) |
integer |
Returns the number of slots of the given inventory. |
moveItemStackFromTo(sideSource:integer, slotSource:integer, sideDest:integer, slotDest:integer[, maxAmount:integer])
|
integer
|
Moves the maximum amount of items from the given source side and source slot to the given destination side and destination slot. If maxAmount is omitted, it defaults to .
|
getStackInSlot(side:integer, slot:integer)
|
table
|
Returns information about the itemstack in the slot of the inventory at the given side. This will be a table with the following entries: name, stackSize, maxStackSize, damage, maxDamage, hasNbt, isEdible.
|