pub struct CommandBlock(pub Address);Expand description
The command_block component (3 methods).
Provided by OpenComputers’ DriverCommandBlock$Environment.
Tuple Fields§
§0: AddressImplementations§
Source§impl CommandBlock
impl CommandBlock
Sourcepub fn execute_command(&self) -> Result<Number>
pub fn execute_command(&self) -> Result<Number>
Execute the currently set command. This has a slight delay to allow the command block to properly update.
Lua: command_block.executeCommand():number
Indirect call: waits for the next server tick.
Sourcepub async fn execute_command_async(&self) -> Result<Number>
pub async fn execute_command_async(&self) -> Result<Number>
Self::execute_command without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_command(&self) -> Result<OcString>
pub fn get_command(&self) -> Result<OcString>
Get the command currently set in this command block.
Lua: command_block.getCommand():string
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn get_command_async(&self) -> Result<OcString>
pub async fn get_command_async(&self) -> Result<OcString>
Self::get_command without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn set_command(&self, value: impl AsRef<[u8]>) -> Result<()>
pub fn set_command(&self, value: impl AsRef<[u8]>) -> Result<()>
Set the specified command for the command block.
Lua: command_block.setCommand(value:string)
Indirect call: waits for the next server tick.
Sourcepub async fn set_command_async(&self, value: impl AsRef<[u8]>) -> Result<()>
pub async fn set_command_async(&self, value: impl AsRef<[u8]>) -> Result<()>
Self::set_command 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 CommandBlock
impl Clone for CommandBlock
Source§impl Component for CommandBlock
impl Component for CommandBlock
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.