pub struct NoteBlock(pub Address);Expand description
The note_block component (3 methods).
Provided by OpenComputers’ DriverNoteBlock$Environment.
Tuple Fields§
§0: AddressImplementations§
Source§impl NoteBlock
impl NoteBlock
Sourcepub fn get_pitch(&self) -> Result<Number>
pub fn get_pitch(&self) -> Result<Number>
Get the currently set pitch on this note block.
Lua: note_block.getPitch():number
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn get_pitch_async(&self) -> Result<Number>
pub async fn get_pitch_async(&self) -> Result<Number>
Self::get_pitch without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn set_pitch(&self, value: impl Into<Number>) -> Result<()>
pub fn set_pitch(&self, value: impl Into<Number>) -> Result<()>
Set the pitch for this note block. Must be in the interval [1, 25].
Lua: note_block.setPitch(value:number)
Indirect call: waits for the next server tick.
Sourcepub async fn set_pitch_async(&self, value: impl Into<Number>) -> Result<()>
pub async fn set_pitch_async(&self, value: impl Into<Number>) -> Result<()>
Self::set_pitch without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn trigger(&self, pitch: Option<Number>) -> Result<bool>
pub fn trigger(&self, pitch: Option<Number>) -> Result<bool>
Triggers the note block if possible. Allows setting the pitch to save a tick.
Lua: note_block.trigger([pitch:number]):boolean
Indirect call: waits for the next server tick.
Sourcepub async fn trigger_async(&self, pitch: Option<Number>) -> Result<bool>
pub async fn trigger_async(&self, pitch: Option<Number>) -> Result<bool>
Self::trigger 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 NoteBlock
impl Component for NoteBlock
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.