Component name: inventory_controller
This component is provided by the inventory controller upgrade.
With this API the robot can receive additional information about items or inventories and is able to put items into and take them from specific slots.
Sides required for most operations are specified in the Sides API. If no or an invalid side is provided functions will usually throw an error. To interact with the robot's own inventory you need to use the side back
, which however makes it impossible to interact with inventories behind the robot.
Returns the size of the inventory at the specified side.
side - must be a valid side.
Returns: the size of the inventory, or nil
followed by a description why this function failed (usually no inventory
).
Returns a table describing the item in the specified slot or nil.
side - must be a valid side.
slot - the slot to analyze. This does not check the inventory size and will consider slots outside the inventory bounds to be empty.
Returns: nil
if the slot was empty (or outside the inventory's bounds), a table otherwise with the following information about the item in that slot:
oc:item.FloppyDisk
Puts up to count items from the currently selected slot into the specified slot of the inventory at the specified side.
side - a valid side.
slot - the slot to drop the item into.
count - how many items to transfer.
Returns: true
if at least one item was moved, false
and a secondary result that describes the error otherwise.
Note that the robot cannot drop items into it's own inventory, attempting to do so will cause this to throw an error. You need to use robot.transferTo
from the Robot API to do so.
Takes up to count items from the specified slot of the inventory at the specified side and puts them into the currently selected slot.
side - a valid side.
slot - the slot to take the item from.
count - how many items to transfer.
Returns: true
if at least one item was moved, false
otherwise.
If the currently selected slot is occupied, then the items will be stacked with similar items in the robot's inventory or moved to the next free slot if available. If no slot is available this operation will fail.
Note that the robot cannot suck items from it's own inventory, attempting to do so will cause this to throw an error. You need to use robot.transferTo
from the Robot API to do so.
Swaps the content of the robot's tool slot with the content of the currently selected inventory slot.
Returns: true
if the items were swapped, false
otherwise. This operation usually succeeds.
Note that you can put any kind of item into the robot's tool slot, not only tools, even items that the robot cannot use at all.
Components | 3D Printer - Abstract Bus - Access Point - Chunkloader - Computer - Crafting - Data Card - Database - Debug - Drone - Drive - EEPROM - Experience - Filesystem - Generator - Geolyzer - GPU - Hologram - Internet - Inventory Controller - Leash - Microcontroller - Modem - Motion Sensor - Navigation - Net Splitter - Piston - Redstone - Redstone in Motion - Robot - Screen - Sign - Tank Controller - Tractor Beam - Transposer - Tunnel - World Sensor | |
---|---|---|
Others | Component Access - Signals | |
Cross-Mod Integration | Applied Energistics |