pub struct MobEffectInstance {
effect: MobEffectRef,
duration: i32,
amplifier: i32,
ambient: bool,
show_particles: bool,
show_icon: bool,
hidden_effect: Option<Box<MobEffectInstanceDetails>>,
}Expand description
One status-effect instance, including Vanilla’s hidden fallback chain.
Fields§
§effect: MobEffectRef§duration: i32§amplifier: i32§ambient: bool§show_particles: bool§show_icon: boolImplementations§
Source§impl MobEffectInstance
impl MobEffectInstance
pub fn new( effect: MobEffectRef, duration: i32, amplifier: i32, ambient: bool, show_particles: bool, show_icon: bool, hidden_effect: Option<MobEffectInstanceDetails>, ) -> Self
pub fn simple(effect: MobEffectRef, duration: i32, amplifier: i32) -> Self
pub const fn effect(&self) -> MobEffectRef
pub const fn duration(&self) -> i32
pub const fn amplifier(&self) -> i32
Sourcepub const fn is_infinite_duration(&self) -> bool
pub const fn is_infinite_duration(&self) -> bool
Whether this effect never expires.
Sourcepub fn map_duration(&self, mapper: impl FnOnce(i32) -> i32) -> i32
pub fn map_duration(&self, mapper: impl FnOnce(i32) -> i32) -> i32
Applies mapper to this effect’s duration, leaving the infinite and zero sentinels alone.
Sourcepub fn with_scaled_duration(&self, scale: f32) -> Self
pub fn with_scaled_duration(&self, scale: f32) -> Self
Returns a copy of this effect with its duration scaled by scale,
never rounding a finite duration below 1 tick. The infinite and zero
sentinels are left alone.
pub const fn ambient(&self) -> bool
pub const fn show_particles(&self) -> bool
pub const fn show_icon(&self) -> bool
fn details(&self) -> MobEffectInstanceDetails
fn from_details(effect: MobEffectRef, details: MobEffectInstanceDetails) -> Self
pub(crate) fn to_nbt_tag_ref(&self) -> NbtTag
pub(crate) fn from_owned_nbt(tag: &NbtTag) -> Option<Self>
Trait Implementations§
Source§impl Clone for MobEffectInstance
impl Clone for MobEffectInstance
Source§impl Debug for MobEffectInstance
impl Debug for MobEffectInstance
Source§impl FromNbtTag for MobEffectInstance
impl FromNbtTag for MobEffectInstance
fn from_nbt_tag(tag: NbtTag<'_, '_>) -> Option<Self>
fn from_optional_nbt_tag( tag: Option<NbtTag<'_, '_>>, ) -> Result<Option<Self>, DeserializeError>
Source§impl HashComponent for MobEffectInstance
impl HashComponent for MobEffectInstance
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 MobEffectInstance
impl PartialEq for MobEffectInstance
Source§impl ReadFrom for MobEffectInstance
impl ReadFrom for MobEffectInstance
Source§impl ToNbtTag for MobEffectInstance
impl ToNbtTag for MobEffectInstance
fn to_nbt_tag(self) -> NbtTag
fn to_optional_nbt_tag(self) -> Option<NbtTag>
Auto Trait Implementations§
impl Freeze for MobEffectInstance
impl RefUnwindSafe for MobEffectInstance
impl Send for MobEffectInstance
impl Sync for MobEffectInstance
impl Unpin for MobEffectInstance
impl UnsafeUnpin for MobEffectInstance
impl UnwindSafe for MobEffectInstance
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<>>