Skip to main content

InventoryController

Struct InventoryController 

Source
pub struct InventoryController(pub Address);
Expand description

The inventory_controller component (24 methods).

Provided by OpenComputers’ UpgradeInventoryController$Adapter, UpgradeInventoryController$Drone, UpgradeInventoryController$Robot.

Tuple Fields§

§0: Address

Implementations§

Source§

impl InventoryController

Source

pub fn are_stacks_equivalent( &self, side: impl Into<Number>, slot_a: impl Into<Number>, slot_b: impl Into<Number>, ) -> Result<bool>

Get whether the items in the two specified slots of the inventory on the specified side of the device are equivalent (have shared item tags).

Lua: inventory_controller.areStacksEquivalent(side:number, slotA:number, slotB:number):boolean Indirect call: waits for the next server tick.

Source

pub async fn are_stacks_equivalent_async( &self, side: impl Into<Number>, slot_a: impl Into<Number>, slot_b: impl Into<Number>, ) -> Result<bool>

Self::are_stacks_equivalent without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn compare_stack_to_database( &self, side: impl Into<Number>, slot: impl Into<Number>, db_address: impl AsRef<[u8]>, db_slot: impl Into<Number>, check_nbt: Option<bool>, ) -> Result<bool>

Compare an item in the specified slot in the inventory on the specified side with one in the database with the specified address.

Lua: inventory_controller.compareStackToDatabase(side:number, slot:number, dbAddress:string, dbSlot:number[, checkNBT:boolean=false]):boolean Indirect call: waits for the next server tick. check_nbt defaults to false.

Source

pub async fn compare_stack_to_database_async( &self, side: impl Into<Number>, slot: impl Into<Number>, db_address: impl AsRef<[u8]>, db_slot: impl Into<Number>, check_nbt: Option<bool>, ) -> Result<bool>

Self::compare_stack_to_database without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn compare_stacks( &self, side: impl Into<Number>, slot_a: impl Into<Number>, slot_b: impl Into<Number>, check_nbt: Option<bool>, ) -> Result<bool>

Get whether the items in the two specified slots of the inventory on the specified side of the device are of the same type.

Lua: inventory_controller.compareStacks(side:number, slotA:number, slotB:number[, checkNBT:boolean=false]):boolean Indirect call: waits for the next server tick. check_nbt defaults to false.

Source

pub async fn compare_stacks_async( &self, side: impl Into<Number>, slot_a: impl Into<Number>, slot_b: impl Into<Number>, check_nbt: Option<bool>, ) -> Result<bool>

Self::compare_stacks without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn compare_to_database( &self, slot: impl Into<Number>, db_address: impl AsRef<[u8]>, db_slot: impl Into<Number>, check_nbt: Option<bool>, ) -> Result<bool>

Compare an item in the specified slot with one in the database with the specified address.

Lua: inventory_controller.compareToDatabase(slot:number, dbAddress:string, dbSlot:number[, checkNBT:boolean=false]):boolean Indirect call: waits for the next server tick. check_nbt defaults to false.

Source

pub async fn compare_to_database_async( &self, slot: impl Into<Number>, db_address: impl AsRef<[u8]>, db_slot: impl Into<Number>, check_nbt: Option<bool>, ) -> Result<bool>

Self::compare_to_database without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn drop_into_item_inventory( &self, inventory_slot: impl Into<Number>, slot: impl Into<Number>, count: Option<Number>, ) -> Result<Number>

Drops an item from the selected slot into the specified slot in the item inventory.

Lua: inventory_controller.dropIntoItemInventory(inventorySlot:number, slot:number[, count:number=64]):number Indirect call: waits for the next server tick. count defaults to 64.

Source

pub async fn drop_into_item_inventory_async( &self, inventory_slot: impl Into<Number>, slot: impl Into<Number>, count: Option<Number>, ) -> Result<Number>

Self::drop_into_item_inventory without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn drop_into_slot( &self, facing: impl Into<Number>, slot: impl Into<Number>, count: Option<Number>, from_side: Option<Number>, ) -> Result<bool>

Drops the selected item stack into the specified slot of an inventory.

Lua: inventory_controller.dropIntoSlot(facing:number, slot:number[, count:number[, fromSide:number]]):boolean Indirect call: waits for the next server tick.

Source

pub async fn drop_into_slot_async( &self, facing: impl Into<Number>, slot: impl Into<Number>, count: Option<Number>, from_side: Option<Number>, ) -> Result<bool>

Self::drop_into_slot without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn equip(&self) -> Result<bool>

Swaps the equipped tool with the content of the currently selected inventory slot.

Lua: inventory_controller.equip():boolean Indirect call: waits for the next server tick.

Source

pub async fn equip_async(&self) -> Result<bool>

Self::equip without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn get_all_stacks(&self, side: impl Into<Number>) -> Result<Handle>

Get a description of all stacks in the inventory on the specified side of the device.

Lua: inventory_controller.getAllStacks(side:number):userdata Indirect call: waits for the next server tick.

Source

pub async fn get_all_stacks_async( &self, side: impl Into<Number>, ) -> Result<Handle>

Self::get_all_stacks without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn get_inventory_name(&self, side: impl Into<Number>) -> Result<OcString>

Get the name of the inventory on the specified side of the device.

Lua: inventory_controller.getInventoryName(side:number):string Indirect call: waits for the next server tick.

Source

pub async fn get_inventory_name_async( &self, side: impl Into<Number>, ) -> Result<OcString>

Self::get_inventory_name without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn get_inventory_size(&self, side: impl Into<Number>) -> Result<Number>

Get the number of slots in the inventory on the specified side of the device.

Lua: inventory_controller.getInventorySize(side:number):number Indirect call: waits for the next server tick.

Source

pub async fn get_inventory_size_async( &self, side: impl Into<Number>, ) -> Result<Number>

Self::get_inventory_size without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn get_item_inventory_size(&self, slot: impl Into<Number>) -> Result<Number>

The size of an item inventory in the specified slot.

Lua: inventory_controller.getItemInventorySize(slot:number):number Indirect call: waits for the next server tick.

Source

pub async fn get_item_inventory_size_async( &self, slot: impl Into<Number>, ) -> Result<Number>

Self::get_item_inventory_size without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn get_slot_max_stack_size( &self, side: impl Into<Number>, slot: impl Into<Number>, ) -> Result<Number>

Get the maximum number of items in the specified slot of the inventory on the specified side of the device.

Lua: inventory_controller.getSlotMaxStackSize(side:number, slot:number):number Indirect call: waits for the next server tick.

Source

pub async fn get_slot_max_stack_size_async( &self, side: impl Into<Number>, slot: impl Into<Number>, ) -> Result<Number>

Self::get_slot_max_stack_size without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn get_slot_stack_size( &self, side: impl Into<Number>, slot: impl Into<Number>, ) -> Result<Number>

Get number of items in the specified slot of the inventory on the specified side of the device.

Lua: inventory_controller.getSlotStackSize(side:number, slot:number):number Indirect call: waits for the next server tick.

Source

pub async fn get_slot_stack_size_async( &self, side: impl Into<Number>, slot: impl Into<Number>, ) -> Result<Number>

Self::get_slot_stack_size without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn get_stack_in_internal_slot(&self, slot: Option<Number>) -> Result<Value>

Get a description of the stack in the specified slot or the selected slot.

Lua: inventory_controller.getStackInInternalSlot([slot:number]):table Indirect call: waits for the next server tick.

Source

pub async fn get_stack_in_internal_slot_async( &self, slot: Option<Number>, ) -> Result<Value>

Self::get_stack_in_internal_slot without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn get_stack_in_slot( &self, side: impl Into<Number>, slot: impl Into<Number>, ) -> Result<Value>

Get a description of the stack in the inventory on the specified side of the device.

Lua: inventory_controller.getStackInSlot(side:number, slot:number):table Indirect call: waits for the next server tick.

Source

pub async fn get_stack_in_slot_async( &self, side: impl Into<Number>, slot: impl Into<Number>, ) -> Result<Value>

Self::get_stack_in_slot without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn get_upgrade_container_tier( &self, slot: impl Into<Number>, ) -> Result<Number>

get upgrade container tier at the given slot.

Lua: inventory_controller.getUpgradeContainerTier(slot:number):number Indirect call: waits for the next server tick.

Source

pub async fn get_upgrade_container_tier_async( &self, slot: impl Into<Number>, ) -> Result<Number>

Self::get_upgrade_container_tier without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn get_upgrade_container_type( &self, slot: impl Into<Number>, ) -> Result<OcString>

get upgrade container type at the given slot.

Lua: inventory_controller.getUpgradeContainerType(slot:number):string Indirect call: waits for the next server tick.

Source

pub async fn get_upgrade_container_type_async( &self, slot: impl Into<Number>, ) -> Result<OcString>

Self::get_upgrade_container_type without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn install_upgrade(&self, slot: Option<Number>) -> Result<bool>

Swaps the installed upgrade in the slot (1 by default) with the content of the currently selected inventory slot.

Lua: inventory_controller.installUpgrade([slot:number]):boolean Indirect call: waits for the next server tick.

Source

pub async fn install_upgrade_async(&self, slot: Option<Number>) -> Result<bool>

Self::install_upgrade without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn is_equivalent_to(&self, other_slot: impl Into<Number>) -> Result<bool>

Get whether the stack in the selected slot is equivalent to the item in the specified slot (have shared OreDictionary IDs).

Lua: inventory_controller.isEquivalentTo(otherSlot:number):boolean Indirect call: waits for the next server tick.

Source

pub async fn is_equivalent_to_async( &self, other_slot: impl Into<Number>, ) -> Result<bool>

Self::is_equivalent_to without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn set_stack_display_name( &self, side: impl Into<Number>, slot: impl Into<Number>, label: impl AsRef<[u8]>, ) -> Result<bool>

Change the display name of the stack.

Lua: inventory_controller.setStackDisplayName(side:number, slot:number, label:string):boolean Indirect call: waits for the next server tick.

Source

pub async fn set_stack_display_name_async( &self, side: impl Into<Number>, slot: impl Into<Number>, label: impl AsRef<[u8]>, ) -> Result<bool>

Self::set_stack_display_name without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn store( &self, side: impl Into<Number>, slot: impl Into<Number>, db_address: impl AsRef<[u8]>, db_slot: impl Into<Number>, ) -> Result<bool>

Store an item stack description in the specified slot of the database with the specified address.

Lua: inventory_controller.store(side:number, slot:number, dbAddress:string, dbSlot:number):boolean Indirect call: waits for the next server tick.

Source

pub async fn store_async( &self, side: impl Into<Number>, slot: impl Into<Number>, db_address: impl AsRef<[u8]>, db_slot: impl Into<Number>, ) -> Result<bool>

Self::store without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn store_internal( &self, slot: impl Into<Number>, db_address: impl AsRef<[u8]>, db_slot: impl Into<Number>, ) -> Result<bool>

Store an item stack description in the specified slot of the database with the specified address.

Lua: inventory_controller.storeInternal(slot:number, dbAddress:string, dbSlot:number):boolean Indirect call: waits for the next server tick.

Source

pub async fn store_internal_async( &self, slot: impl Into<Number>, db_address: impl AsRef<[u8]>, db_slot: impl Into<Number>, ) -> Result<bool>

Self::store_internal without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn suck_from_item_inventory( &self, inventory_slot: impl Into<Number>, slot: impl Into<Number>, count: Option<Number>, ) -> Result<Number>

Sucks an item out of the specified slot in the item inventory.

Lua: inventory_controller.suckFromItemInventory(inventorySlot:number, slot:number[, count:number=64]):number Indirect call: waits for the next server tick. count defaults to 64.

Source

pub async fn suck_from_item_inventory_async( &self, inventory_slot: impl Into<Number>, slot: impl Into<Number>, count: Option<Number>, ) -> Result<Number>

Self::suck_from_item_inventory without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Source

pub fn suck_from_slot( &self, facing: impl Into<Number>, slot: impl Into<Number>, count: Option<Number>, from_side: Option<Number>, ) -> Result<bool>

Sucks items from the specified slot of an inventory.

Lua: inventory_controller.suckFromSlot(facing:number, slot:number[, count:number[, fromSide:number]]):boolean Indirect call: waits for the next server tick.

Source

pub async fn suck_from_slot_async( &self, facing: impl Into<Number>, slot: impl Into<Number>, count: Option<Number>, from_side: Option<Number>, ) -> Result<bool>

Self::suck_from_slot without blocking: the call is queued, and the program keeps running until the result comes back; see crate::task.

Trait Implementations§

Source§

impl Clone for InventoryController

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Component for InventoryController

Source§

const KIND: &'static str = "inventory_controller"

The OpenComputers component type, such as "gpu".
Source§

fn from_address(address: Address) -> Self

Wraps an address without checking what is there.
Source§

fn address(&self) -> &Address

Source§

fn first() -> Option<Self>

The first component of this type, by address order.
Source§

fn all() -> Vec<Self>

Every component of this type, by address order.
Source§

fn at(address: impl Into<Address>) -> Option<Self>

The component at address, if it is of this type.
Source§

fn invoke(&self, method: &str, args: Vec<Value>) -> Result<Vec<Value>>

An untyped call, for methods the wrapper doesn’t know.
Source§

fn invoke_async(&self, method: &str, args: Vec<Value>) -> Call ⓘ

Component::invoke without blocking; see invoke_async.
Source§

impl Debug for InventoryController

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for InventoryController

Source§

impl Hash for InventoryController

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for InventoryController

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for InventoryController

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.