pub struct MobEffectBehaviorRegistry {
behaviors: Vec<Box<dyn MobEffectBehavior>>,
}Expand description
Registry for mob-effect behaviors.
Created after the main registry is frozen. All mob effects are
initialized with a default behavior matching a bare vanilla MobEffect
instance, then custom behaviors are registered.
Fields§
§behaviors: Vec<Box<dyn MobEffectBehavior>>Implementations§
Source§impl MobEffectBehaviorRegistry
impl MobEffectBehaviorRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new behavior registry with default behaviors for all mob effects.
Sourcepub fn set_behavior(
&mut self,
effect: MobEffectRef,
behavior: Box<dyn MobEffectBehavior>,
)
pub fn set_behavior( &mut self, effect: MobEffectRef, behavior: Box<dyn MobEffectBehavior>, )
Sets a custom behavior for a mob effect.
§Panics
Panics if effect is not registered in the global registry.
Sourcepub fn get_behavior(&self, effect: MobEffectRef) -> &dyn MobEffectBehavior
pub fn get_behavior(&self, effect: MobEffectRef) -> &dyn MobEffectBehavior
Gets the behavior for a mob effect.
§Panics
Panics if effect is not registered in the global registry.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for MobEffectBehaviorRegistry
impl !UnwindSafe for MobEffectBehaviorRegistry
impl Freeze for MobEffectBehaviorRegistry
impl Send for MobEffectBehaviorRegistry
impl Sync for MobEffectBehaviorRegistry
impl Unpin for MobEffectBehaviorRegistry
impl UnsafeUnpin for MobEffectBehaviorRegistry
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
§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<>>