pub struct InstrumentValue {
sound_event: SoundEventHolder,
use_duration: f32,
range: f32,
description: TextComponent,
}Expand description
A complete instrument definition, either registered or stored inline.
The direct stream codec carries raw floats, but Steel validates them against the persistent codec before constructing this value so item stacks cannot contain an instrument that later fails to save.
Fields§
§sound_event: SoundEventHolder§use_duration: f32§range: f32§description: TextComponentImplementations§
Source§impl InstrumentValue
impl InstrumentValue
pub fn new( sound_event: SoundEventHolder, use_duration: f32, range: f32, description: TextComponent, ) -> Result<Self, InvalidInstrumentValue>
pub(crate) const fn from_validated_parts( sound_event: SoundEventHolder, use_duration: f32, range: f32, description: TextComponent, ) -> Self
pub const fn sound_event(&self) -> &SoundEventHolder
pub const fn use_duration(&self) -> f32
pub const fn range(&self) -> f32
pub const fn description(&self) -> &TextComponent
fn to_nbt_tag_ref(&self) -> NbtTag
Trait Implementations§
Source§impl Clone for InstrumentValue
impl Clone for InstrumentValue
Source§fn clone(&self) -> InstrumentValue
fn clone(&self) -> InstrumentValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InstrumentValue
impl Debug for InstrumentValue
Source§impl FromNbtTag for InstrumentValue
impl FromNbtTag for InstrumentValue
fn from_nbt_tag(tag: NbtTag<'_, '_>) -> Option<Self>
fn from_optional_nbt_tag( tag: Option<NbtTag<'_, '_>>, ) -> Result<Option<Self>, DeserializeError>
Source§impl HashComponent for InstrumentValue
impl HashComponent for InstrumentValue
Source§fn hash_component(&self, hasher: &mut ComponentHasher)
fn hash_component(&self, hasher: &mut ComponentHasher)
Hashes this value into the given hasher.
Source§fn compute_hash(&self) -> i32
fn compute_hash(&self) -> i32
Computes the hash of this value.
Source§impl PartialEq for InstrumentValue
impl PartialEq for InstrumentValue
Source§impl ReadFrom for InstrumentValue
impl ReadFrom for InstrumentValue
Source§impl ToNbtTag for InstrumentValue
impl ToNbtTag for InstrumentValue
fn to_nbt_tag(self) -> NbtTag
fn to_optional_nbt_tag(self) -> Option<NbtTag>
Auto Trait Implementations§
impl Freeze for InstrumentValue
impl RefUnwindSafe for InstrumentValue
impl Send for InstrumentValue
impl Sync for InstrumentValue
impl Unpin for InstrumentValue
impl UnsafeUnpin for InstrumentValue
impl UnwindSafe for InstrumentValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>