pub struct Inventory(pub Address);Expand description
The inventory component (8 methods).
Provided by OpenComputers’ DriverInventory$Environment.
Tuple Fields§
§0: AddressImplementations§
Source§impl Inventory
impl Inventory
Sourcepub fn compare_stacks(
&self,
slot_a: impl Into<Number>,
slot_b: impl Into<Number>,
) -> Result<bool>
pub fn compare_stacks( &self, slot_a: impl Into<Number>, slot_b: impl Into<Number>, ) -> Result<bool>
Compare the two item stacks in the specified slots for equality.
Lua: inventory.compareStacks(slotA:number, slotB:number):boolean
Indirect call: waits for the next server tick.
Sourcepub async fn compare_stacks_async(
&self,
slot_a: impl Into<Number>,
slot_b: impl Into<Number>,
) -> Result<bool>
pub async fn compare_stacks_async( &self, slot_a: impl Into<Number>, slot_b: impl Into<Number>, ) -> Result<bool>
Self::compare_stacks without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_all_stacks(&self) -> Result<Value>
pub fn get_all_stacks(&self) -> Result<Value>
Get a list of descriptions for all item stacks in this inventory.
Lua: inventory.getAllStacks():table
Indirect call: waits for the next server tick.
Sourcepub async fn get_all_stacks_async(&self) -> Result<Value>
pub async fn get_all_stacks_async(&self) -> Result<Value>
Self::get_all_stacks without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_inventory_name(&self) -> Result<OcString>
pub fn get_inventory_name(&self) -> Result<OcString>
Get the name of this inventory.
Lua: inventory.getInventoryName():string
Indirect call: waits for the next server tick.
Sourcepub async fn get_inventory_name_async(&self) -> Result<OcString>
pub async fn get_inventory_name_async(&self) -> 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.
Sourcepub fn get_inventory_size(&self) -> Result<Number>
pub fn get_inventory_size(&self) -> Result<Number>
Get the number of slots in this inventory.
Lua: inventory.getInventorySize():number
Indirect call: waits for the next server tick.
Sourcepub async fn get_inventory_size_async(&self) -> Result<Number>
pub async fn get_inventory_size_async(&self) -> 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.
Sourcepub fn get_slot_max_stack_size(&self, slot: impl Into<Number>) -> Result<Number>
pub fn get_slot_max_stack_size(&self, slot: impl Into<Number>) -> Result<Number>
Get the maximum stack size of the item stack in the specified slot.
Lua: inventory.getSlotMaxStackSize(slot:number):number
Indirect call: waits for the next server tick.
Sourcepub async fn get_slot_max_stack_size_async(
&self,
slot: impl Into<Number>,
) -> Result<Number>
pub async fn get_slot_max_stack_size_async( &self, 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.
Sourcepub fn get_slot_stack_size(&self, slot: impl Into<Number>) -> Result<Number>
pub fn get_slot_stack_size(&self, slot: impl Into<Number>) -> Result<Number>
Get the stack size of the item stack in the specified slot.
Lua: inventory.getSlotStackSize(slot:number):number
Indirect call: waits for the next server tick.
Sourcepub async fn get_slot_stack_size_async(
&self,
slot: impl Into<Number>,
) -> Result<Number>
pub async fn get_slot_stack_size_async( &self, 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.
Sourcepub fn get_stack_in_slot(&self, slot: impl Into<Number>) -> Result<Value>
pub fn get_stack_in_slot(&self, slot: impl Into<Number>) -> Result<Value>
Get a description of the item stack in the specified slot.
Lua: inventory.getStackInSlot(slot:number):table
Indirect call: waits for the next server tick.
Sourcepub async fn get_stack_in_slot_async(
&self,
slot: impl Into<Number>,
) -> Result<Value>
pub async fn get_stack_in_slot_async( &self, 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.
Sourcepub fn transfer_stack(
&self,
slot_a: impl Into<Number>,
slot_b: impl Into<Number>,
count: Option<Number>,
) -> Result<bool>
pub fn transfer_stack( &self, slot_a: impl Into<Number>, slot_b: impl Into<Number>, count: Option<Number>, ) -> Result<bool>
Move up to the specified number of items from the first specified slot to the second.
Lua: inventory.transferStack(slotA:number, slotB:number[, count:number=math.huge]):boolean
Indirect call: waits for the next server tick.
count defaults to math.huge.
Sourcepub async fn transfer_stack_async(
&self,
slot_a: impl Into<Number>,
slot_b: impl Into<Number>,
count: Option<Number>,
) -> Result<bool>
pub async fn transfer_stack_async( &self, slot_a: impl Into<Number>, slot_b: impl Into<Number>, count: Option<Number>, ) -> Result<bool>
Self::transfer_stack without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Trait Implementations§
Source§impl Component for Inventory
impl Component for Inventory
Source§fn from_address(address: Address) -> Self
fn from_address(address: Address) -> Self
fn address(&self) -> &Address
Source§fn at(address: impl Into<Address>) -> Option<Self>
fn at(address: impl Into<Address>) -> Option<Self>
address, if it is of this type.Source§fn invoke(&self, method: &str, args: Vec<Value>) -> Result<Vec<Value>>
fn invoke(&self, method: &str, args: Vec<Value>) -> Result<Vec<Value>>
Source§fn invoke_async(&self, method: &str, args: Vec<Value>) -> Call ⓘ
fn invoke_async(&self, method: &str, args: Vec<Value>) -> Call ⓘ
Component::invoke without blocking; see invoke_async.