pub trait AgeableMob: Mob {
Show 29 methods
// Required methods
fn ageable_base(&self) -> &AgeableMobBase;
fn is_age_locked(&self) -> bool;
fn set_age_locked(&self, age_locked: bool);
fn set_synced_baby(&self, baby: bool);
// Provided methods
fn age_boundary_changed(&self, _baby: bool) { ... }
fn get_baby_start_age(&self) -> i32 { ... }
fn get_age(&self) -> i32 { ... }
fn set_age(&self, age: i32) { ... }
fn is_baby(&self) -> bool { ... }
fn set_baby(&self, baby: bool) { ... }
fn forced_age(&self) -> i32 { ... }
fn set_forced_age(&self, forced_age: i32) { ... }
fn forced_age_timer(&self) -> i32 { ... }
fn set_forced_age_timer(&self, forced_age_timer: i32) { ... }
fn age_lock_particle_timer(&self) -> i32 { ... }
fn set_age_lock_particle_timer(&self, timer: i32) { ... }
fn can_age_up(&self) -> bool { ... }
fn get_speed_up_seconds_when_feeding(ticks_until_adult: i32) -> i32
where Self: Sized { ... }
fn age_up(&self, seconds: i32, forced: bool) { ... }
fn finalize_spawn_ageable_mob(
&self,
world: &Arc<World>,
spawn_reason: EntitySpawnReason,
group_data: Option<SpawnGroupData>,
) -> Option<SpawnGroupData> { ... }
fn mob_interact_ageable(
&self,
player: &Player,
hand: InteractionHand,
) -> InteractionResult { ... }
fn create_breed_offspring(&self, world: &Arc<World>) -> Option<SharedEntity> { ... }
fn get_breed_offspring(
&self,
world: &Arc<World>,
partner: &dyn AgeableMob,
) -> Option<SharedEntity> { ... }
fn breed_variant_key(&self) -> Option<&Identifier> { ... }
fn set_breed_variant_key(&self, _key: &Identifier) -> bool { ... }
fn initialize_breed_offspring(
&self,
_partner: &dyn AgeableMob,
_offspring: &dyn AgeableMob,
) { ... }
fn tick_ageable_mob(&self) { ... }
fn save_ageable_mob(&self, nbt: &mut NbtCompound) { ... }
fn load_ageable_mob(&self, nbt: BorrowedNbtCompoundView<'_, '_>) { ... }
}Expand description
Vanilla-shaped behavior shared by entities that extend AgeableMob.
Required Methods§
Sourcefn ageable_base(&self) -> &AgeableMobBase
fn ageable_base(&self) -> &AgeableMobBase
Returns shared ageable runtime state.
Sourcefn is_age_locked(&self) -> bool
fn is_age_locked(&self) -> bool
Returns the synchronized vanilla age-lock flag.
Sourcefn set_age_locked(&self, age_locked: bool)
fn set_age_locked(&self, age_locked: bool)
Sets the synchronized vanilla age-lock flag.
Sourcefn set_synced_baby(&self, baby: bool)
fn set_synced_baby(&self, baby: bool)
Sets the synchronized baby flag.
Provided Methods§
Sourcefn age_boundary_changed(&self, _baby: bool)
fn age_boundary_changed(&self, _baby: bool)
Hook called after the baby/adult boundary changes.
Sourcefn get_baby_start_age(&self) -> i32
fn get_baby_start_age(&self) -> i32
Returns vanilla AgeableMob.getBabyStartAge.
Sourcefn forced_age(&self) -> i32
fn forced_age(&self) -> i32
Returns vanilla AgeableMob.forcedAge.
Sourcefn set_forced_age(&self, forced_age: i32)
fn set_forced_age(&self, forced_age: i32)
Sets vanilla AgeableMob.forcedAge.
Sourcefn forced_age_timer(&self) -> i32
fn forced_age_timer(&self) -> i32
Returns vanilla AgeableMob.forcedAgeTimer.
Sourcefn set_forced_age_timer(&self, forced_age_timer: i32)
fn set_forced_age_timer(&self, forced_age_timer: i32)
Sets vanilla AgeableMob.forcedAgeTimer.
Sourcefn age_lock_particle_timer(&self) -> i32
fn age_lock_particle_timer(&self) -> i32
Returns vanilla AgeableMob.ageLockParticleTimer.
Sourcefn set_age_lock_particle_timer(&self, timer: i32)
fn set_age_lock_particle_timer(&self, timer: i32)
Sets vanilla AgeableMob.ageLockParticleTimer.
Sourcefn can_age_up(&self) -> bool
fn can_age_up(&self) -> bool
Returns whether this mob can naturally age toward adulthood this tick.
Sourcefn get_speed_up_seconds_when_feeding(ticks_until_adult: i32) -> i32where
Self: Sized,
fn get_speed_up_seconds_when_feeding(ticks_until_adult: i32) -> i32where
Self: Sized,
Returns vanilla AgeableMob.getSpeedUpSecondsWhenFeeding.
Sourcefn finalize_spawn_ageable_mob(
&self,
world: &Arc<World>,
spawn_reason: EntitySpawnReason,
group_data: Option<SpawnGroupData>,
) -> Option<SpawnGroupData>
fn finalize_spawn_ageable_mob( &self, world: &Arc<World>, spawn_reason: EntitySpawnReason, group_data: Option<SpawnGroupData>, ) -> Option<SpawnGroupData>
Runs vanilla AgeableMob.finalizeSpawn, then delegates to Mob.finalizeSpawn.
Sourcefn mob_interact_ageable(
&self,
player: &Player,
hand: InteractionHand,
) -> InteractionResult
fn mob_interact_ageable( &self, player: &Player, hand: InteractionHand, ) -> InteractionResult
Handles vanilla AgeableMob.mobInteract.
Sourcefn create_breed_offspring(&self, world: &Arc<World>) -> Option<SharedEntity>
fn create_breed_offspring(&self, world: &Arc<World>) -> Option<SharedEntity>
Creates a same-type offspring using the registered entity factory.
Sourcefn get_breed_offspring(
&self,
world: &Arc<World>,
partner: &dyn AgeableMob,
) -> Option<SharedEntity>
fn get_breed_offspring( &self, world: &Arc<World>, partner: &dyn AgeableMob, ) -> Option<SharedEntity>
Creates this animal’s vanilla breeding offspring.
Sourcefn breed_variant_key(&self) -> Option<&Identifier>
fn breed_variant_key(&self) -> Option<&Identifier>
Returns this animal’s breedable variant key when offspring inherit it.
Sourcefn set_breed_variant_key(&self, _key: &Identifier) -> bool
fn set_breed_variant_key(&self, _key: &Identifier) -> bool
Applies a breedable variant key to offspring that inherit one.
Sourcefn initialize_breed_offspring(
&self,
_partner: &dyn AgeableMob,
_offspring: &dyn AgeableMob,
)
fn initialize_breed_offspring( &self, _partner: &dyn AgeableMob, _offspring: &dyn AgeableMob, )
Applies entity-specific state to freshly created breeding offspring.
Sourcefn tick_ageable_mob(&self)
fn tick_ageable_mob(&self)
Ticks vanilla age progression.
Sourcefn save_ageable_mob(&self, nbt: &mut NbtCompound)
fn save_ageable_mob(&self, nbt: &mut NbtCompound)
Saves vanilla ageable mob fields.
Sourcefn load_ageable_mob(&self, nbt: BorrowedNbtCompoundView<'_, '_>)
fn load_ageable_mob(&self, nbt: BorrowedNbtCompoundView<'_, '_>)
Loads vanilla ageable mob fields.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".