pub struct MobEffectInstance {
effect: MobEffectRef,
duration: i32,
amplifier: i32,
ambient: bool,
visible: bool,
show_icon: bool,
hidden_effect: Option<Box<MobEffectInstance>>,
}Expand description
Runtime mob-effect state.
Mirrors vanilla MobEffectInstance state that affects server-side living
physics and client synchronization.
Fields§
§effect: MobEffectRef§duration: i32§amplifier: i32§ambient: bool§visible: bool§show_icon: boolImplementations§
Source§impl MobEffectInstance
impl MobEffectInstance
Sourcepub const fn new(effect: MobEffectRef, amplifier: i32) -> Self
pub const fn new(effect: MobEffectRef, amplifier: i32) -> Self
Creates infinite active mob-effect state for internal physics tests and hooks.
Sourcepub const fn with_duration(
effect: MobEffectRef,
duration: i32,
amplifier: i32,
) -> Self
pub const fn with_duration( effect: MobEffectRef, duration: i32, amplifier: i32, ) -> Self
Creates active mob-effect state with vanilla default visibility flags.
Sourcepub const fn with_ambient(self, ambient: bool) -> Self
pub const fn with_ambient(self, ambient: bool) -> Self
Sets whether this effect is ambient.
Sourcepub const fn with_visible(self, visible: bool) -> Self
pub const fn with_visible(self, visible: bool) -> Self
Sets whether this effect should show particles.
Sourcepub const fn with_show_icon(self, show_icon: bool) -> Self
pub const fn with_show_icon(self, show_icon: bool) -> Self
Sets whether this effect should show its inventory icon.
Sourcepub const fn is_ambient(&self) -> bool
pub const fn is_ambient(&self) -> bool
Returns vanilla MobEffectInstance.isAmbient().
Sourcepub const fn is_visible(&self) -> bool
pub const fn is_visible(&self) -> bool
Returns vanilla MobEffectInstance.isVisible().
Sourcepub const fn is_infinite_duration(&self) -> bool
pub const fn is_infinite_duration(&self) -> bool
Returns whether this effect uses vanilla’s infinite-duration sentinel.
Sourcepub(crate) fn to_vanilla_nbt(&self) -> NbtCompound
pub(crate) fn to_vanilla_nbt(&self) -> NbtCompound
Serializes this effect with vanilla’s MobEffectInstance.CODEC shape.
fn details_to_vanilla_nbt(&self) -> NbtCompound
pub(crate) const fn has_remaining_duration(&self) -> bool
pub(crate) fn should_apply_effect_tick_this_tick( &self, entity_tick_count: i32, ) -> bool
pub(crate) fn apply_effect_tick<E: LivingEntity + ?Sized>( &self, world: &World, entity: &E, ) -> bool
const fn is_shorter_duration_than(&self, other: &Self) -> bool
Sourcepub fn update(&mut self, take_over: Self) -> bool
pub fn update(&mut self, take_over: Self) -> bool
Merges another instance of the same effect into this instance.
Mirrors vanilla MobEffectInstance.update.
fn tick_duration(&mut self) -> MobEffectTickResult
fn tick_down_duration(&mut self)
Trait Implementations§
Source§impl Clone for MobEffectInstance
impl Clone for MobEffectInstance
Source§fn clone(&self) -> MobEffectInstance
fn clone(&self) -> MobEffectInstance
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MobEffectInstance
impl Debug for MobEffectInstance
impl Eq for MobEffectInstance
Source§impl PartialEq for MobEffectInstance
impl PartialEq for MobEffectInstance
impl StructuralPartialEq for MobEffectInstance
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
self with key and returns true if they are equal.§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> ⓘ
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> ⓘ
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 moreArc<SyncMutex<>>