pub trait Mob: LivingEntity + Leashable {
Show 117 methods
// Required methods
fn mob_base(&self) -> &MobBase;
fn mob_flags(&self) -> i8;
fn set_mob_flags(&self, flags: i8);
// Provided methods
fn check_spawn_rules(
&self,
_world: &Arc<World>,
_reason: EntitySpawnReason,
) -> bool { ... }
fn set_baby(&self, baby: bool) { ... }
fn is_saddled(&self) -> bool { ... }
fn has_line_of_sight_cached(&self, target: &dyn Entity) -> bool { ... }
fn custom_server_ai_step(&self) { ... }
fn ate(&self) { ... }
fn tick_goal_selectors(&self, _entity: &SharedEntity) { ... }
fn xp_reward(&self) -> i32 { ... }
fn set_xp_reward(&self, xp_reward: i32) { ... }
fn target(&self) -> Option<SharedEntity> { ... }
fn set_target(&self, target: Option<&SharedEntity>) -> bool { ... }
fn is_valid_target(&self, target: &dyn LivingEntity) -> bool { ... }
fn can_attack(&self, target: &dyn LivingEntity) -> bool { ... }
fn base_experience_reward_mob(&self) -> i32 { ... }
fn ambient_sound_interval(&self) -> i32 { ... }
fn ambient_sound(&self) -> Option<SoundEventRef> { ... }
fn play_ambient_sound(&self) { ... }
fn reset_ambient_sound_time(&self) { ... }
fn base_tick_mob(&self) { ... }
fn mob_base_tick(&self) { ... }
fn finalize_spawn(
&self,
world: &Arc<World>,
spawn_reason: EntitySpawnReason,
group_data: Option<SpawnGroupData>,
) -> Option<SpawnGroupData> { ... }
fn finalize_spawn_mob_base(
&self,
_world: &Arc<World>,
_spawn_reason: EntitySpawnReason,
group_data: Option<SpawnGroupData>,
) -> Option<SpawnGroupData> { ... }
fn convert_to(
&self,
entity_type: EntityTypeRef,
params: ConversionParams,
after_conversion: Option<&AfterConversion<'_>>,
) -> Option<SharedEntity>
where Self: Sized { ... }
fn check_mob_spawn_rules(
entity_type: EntityTypeRef,
level: &dyn LevelReader,
spawn_reason: EntitySpawnReason,
pos: BlockPos,
) -> bool
where Self: Sized { ... }
fn check_spawn_obstruction(&self, world: &Arc<World>) -> bool { ... }
fn interact_mob(
&self,
player: &Player,
hand: InteractionHand,
location: DVec3,
) -> InteractionResult { ... }
fn check_and_handle_important_interactions(
&self,
player: &Player,
hand: InteractionHand,
) -> InteractionResult { ... }
fn mob_interact(
&self,
_player: &Player,
_hand: InteractionHand,
) -> InteractionResult { ... }
fn can_shear_equipment(&self, _player: &Player) -> bool { ... }
fn use_player_item(&self, player: &Player, hand: InteractionHand) { ... }
fn remove_when_far_away(&self, dist_sqr: f64) -> bool { ... }
fn requires_custom_persistence(&self) -> bool { ... }
fn is_persistence_required(&self) -> bool { ... }
fn set_persistence_required(&self) { ... }
fn mob_can_be_leashed(&self) -> bool { ... }
fn can_pick_up_loot(&self) -> bool { ... }
fn set_can_pick_up_loot(&self, can_pick_up_loot: bool) { ... }
fn equipment_drop_chance(&self, slot: EquipmentSlot) -> f32 { ... }
fn set_equipment_drop_chance(&self, slot: EquipmentSlot, chance: f32) { ... }
fn is_equipment_drop_preserved(&self, slot: EquipmentSlot) -> bool { ... }
fn set_guaranteed_drop(&self, slot: EquipmentSlot) { ... }
fn get_pickup_reach(&self) -> DVec3 { ... }
fn wants_to_pick_up(&self, item_stack: &ItemStack) -> bool { ... }
fn can_hold_item(&self, _item_stack: &ItemStack) -> bool { ... }
fn pick_up_item(&self, world: &Arc<World>, item_entity: &ItemEntity) { ... }
fn equip_item_if_possible(&self, item_stack: ItemStack) -> ItemStack { ... }
fn get_equipment_slot_for_item(
&self,
item_stack: &ItemStack,
) -> EquipmentSlot { ... }
fn equipment_in_slot(&self, slot: EquipmentSlot) -> ItemStack { ... }
fn can_replace_current_item(
&self,
new_item_stack: &ItemStack,
current_item_stack: &ItemStack,
slot: EquipmentSlot,
) -> bool { ... }
fn compare_armor(
&self,
new_item_stack: &ItemStack,
current_item_stack: &ItemStack,
slot: EquipmentSlot,
) -> bool { ... }
fn get_preferred_weapon_type(&self) -> Option<Identifier> { ... }
fn compare_weapons(
&self,
new_item_stack: &ItemStack,
current_item_stack: &ItemStack,
slot: EquipmentSlot,
) -> bool { ... }
fn approximate_attribute_with(
&self,
item_stack: &ItemStack,
attribute: AttributeRef,
slot: EquipmentSlot,
) -> f64 { ... }
fn can_replace_equal_item(
&self,
new_item_stack: &ItemStack,
current_item_stack: &ItemStack,
) -> bool { ... }
fn tick_looting(&self) { ... }
fn drop_custom_death_loot_mob(
&self,
_source: &DamageSource,
killed_by_player: bool,
) { ... }
fn save_mob(&self, nbt: &mut NbtCompound) { ... }
fn load_mob(&self, nbt: BorrowedNbtCompoundView<'_, '_>) { ... }
fn set_death_loot_table(&self, loot_table: Option<Identifier>) { ... }
fn set_death_loot_table_seed(&self, seed: i64) { ... }
fn custom_death_loot_table(&self) -> Option<LootTableRef> { ... }
fn has_custom_death_loot_table(&self) -> bool { ... }
fn death_loot_table_seed(&self) -> i64 { ... }
fn clear_custom_death_loot_table(&self) { ... }
fn is_within_home(&self) -> bool { ... }
fn is_within_home_pos(&self, pos: BlockPos) -> bool { ... }
fn is_within_home_vec(&self, pos: DVec3) -> bool { ... }
fn set_home_to(&self, position: BlockPos, radius: i32) { ... }
fn home_position(&self) -> BlockPos { ... }
fn home_radius(&self) -> i32 { ... }
fn clear_home(&self) { ... }
fn has_home(&self) -> bool { ... }
fn check_mob_despawn(&self) { ... }
fn nearest_player_distance_sqr(&self) -> Option<f64> { ... }
fn controlling_passenger_mob(&self) -> Option<SharedEntity> { ... }
fn get_pathfinding_malus(&self, path_type: PathType) -> f32 { ... }
fn max_fall_distance(&self) -> i32 { ... }
fn set_pathfinding_malus(&self, path_type: PathType, malus: f32) { ... }
fn is_no_ai(&self) -> bool { ... }
fn set_no_ai(&self, no_ai: bool) { ... }
fn is_left_handed(&self) -> bool { ... }
fn set_left_handed(&self, left_handed: bool) { ... }
fn is_aggressive(&self) -> bool { ... }
fn max_head_x_rot(&self) -> f32 { ... }
fn max_head_y_rot(&self) -> f32 { ... }
fn do_hurt_target(
&self,
entity: &SharedEntity,
world: &World,
target: &SharedEntity,
) -> bool { ... }
fn mob_attack_damage_source(
&self,
weapon_item: &ItemStack,
attacker: &SharedEntity,
) -> DamageSource { ... }
fn get_attack_knockback(
&self,
target: &dyn Entity,
weapon_item: &ItemStack,
damage_source: &DamageSource,
) -> f64 { ... }
fn cause_extra_knockback(
&self,
target: &dyn Entity,
knockback_amount: f64,
_old_movement: DVec3,
) { ... }
fn play_attack_sound(&self) { ... }
fn is_within_melee_attack_range(&self, target: &dyn LivingEntity) -> bool { ... }
fn attack_bounding_box(&self, horizontal_expansion: f64) -> WorldAabb { ... }
fn set_aggressive(&self, aggressive: bool) { ... }
fn set_mob_flag(&self, flag: i8, enabled: bool) { ... }
fn controlled_mob_vehicle(&self) -> Option<SharedEntity> { ... }
fn set_wanted_position(&self, position: DVec3, speed_modifier: f64) { ... }
fn jump_control_jump(&self) { ... }
fn set_mob_speed(&self, speed: f32) { ... }
fn mob_server_ai_step(&self, entity: &SharedEntity) { ... }
fn is_sun_burn_tick(&self) -> bool { ... }
fn sun_protection_slot(&self) -> EquipmentSlot { ... }
fn tick_daylight_burning(&self) { ... }
fn mob_ai_step(&self, entity: &SharedEntity) -> Option<MoveResult> { ... }
fn tick_path_navigation(&self) { ... }
fn tick_move_control(&self) { ... }
fn tick_move_to_control(&self, wanted_position: DVec3, speed_modifier: f64) { ... }
fn tick_strafe_control(&self, forward: f32, right: f32) { ... }
fn is_strafe_walkable(&self, dx: f32, dz: f32) -> bool { ... }
fn tick_jumping_control(&self, speed_modifier: f64) { ... }
fn tick_look_control(&self) { ... }
fn clamp_head_rotation_to_body_when_pathing(&self) { ... }
fn tick_jump_control(&self) { ... }
fn update_control_flags(&self) { ... }
fn tick_body_rotation_control(&self) { ... }
}Required Methods§
fn mob_base(&self) -> &MobBase
fn mob_flags(&self) -> i8
fn set_mob_flags(&self, flags: i8)
Provided Methods§
Sourcefn check_spawn_rules(
&self,
_world: &Arc<World>,
_reason: EntitySpawnReason,
) -> bool
fn check_spawn_rules( &self, _world: &Arc<World>, _reason: EntitySpawnReason, ) -> bool
Returns whether the entity-specific spawn predicate accepts this spawn.
Sourcefn set_baby(&self, baby: bool)
fn set_baby(&self, baby: bool)
Sets the vanilla baby state. Vanilla Mob.setBaby is a no-op; ageable
mobs derive it from their start age, and other mobs override as needed.
Sourcefn is_saddled(&self) -> bool
fn is_saddled(&self) -> bool
Returns whether this mob has a saddle equipped.
Sourcefn has_line_of_sight_cached(&self, target: &dyn Entity) -> bool
fn has_line_of_sight_cached(&self, target: &dyn Entity) -> bool
Checks line of sight using this mob sensing cache
fn custom_server_ai_step(&self)
fn tick_goal_selectors(&self, _entity: &SharedEntity)
fn xp_reward(&self) -> i32
fn set_xp_reward(&self, xp_reward: i32)
Sourcefn target(&self) -> Option<SharedEntity>
fn target(&self) -> Option<SharedEntity>
Returns this mob’s current attack target, if it’s still a valid one.
Sourcefn set_target(&self, target: Option<&SharedEntity>) -> bool
fn set_target(&self, target: Option<&SharedEntity>) -> bool
Sets vanilla Mob.target.
Returns false when the supplied entity is not a living entity.
fn is_valid_target(&self, target: &dyn LivingEntity) -> bool
Sourcefn can_attack(&self, target: &dyn LivingEntity) -> bool
fn can_attack(&self, target: &dyn LivingEntity) -> bool
Returns whether this mob may attack the target; excludes ghasts, which mobs never target directly.
fn base_experience_reward_mob(&self) -> i32
fn ambient_sound_interval(&self) -> i32
fn ambient_sound(&self) -> Option<SoundEventRef>
fn play_ambient_sound(&self)
fn reset_ambient_sound_time(&self)
Sourcefn base_tick_mob(&self)
fn base_tick_mob(&self)
Runs the shared living-entity base tick, then mob-specific per-tick behavior.
Sourcefn mob_base_tick(&self)
fn mob_base_tick(&self)
Runs the mob-owned portion of vanilla Mob.baseTick.
fn finalize_spawn( &self, world: &Arc<World>, spawn_reason: EntitySpawnReason, group_data: Option<SpawnGroupData>, ) -> Option<SpawnGroupData>
fn finalize_spawn_mob_base( &self, _world: &Arc<World>, _spawn_reason: EntitySpawnReason, group_data: Option<SpawnGroupData>, ) -> Option<SpawnGroupData>
Sourcefn convert_to(
&self,
entity_type: EntityTypeRef,
params: ConversionParams,
after_conversion: Option<&AfterConversion<'_>>,
) -> Option<SharedEntity>where
Self: Sized,
fn convert_to(
&self,
entity_type: EntityTypeRef,
params: ConversionParams,
after_conversion: Option<&AfterConversion<'_>>,
) -> Option<SharedEntity>where
Self: Sized,
Creates a replacement or split mob and transfers state according to params.
The callback finalizes mob-specific state. Returns None without changing
the source if it is removed or world, difficulty, factory, mob-type, or
insertion checks fail.
Sourcefn check_mob_spawn_rules(
entity_type: EntityTypeRef,
level: &dyn LevelReader,
spawn_reason: EntitySpawnReason,
pos: BlockPos,
) -> boolwhere
Self: Sized,
fn check_mob_spawn_rules(
entity_type: EntityTypeRef,
level: &dyn LevelReader,
spawn_reason: EntitySpawnReason,
pos: BlockPos,
) -> boolwhere
Self: Sized,
Requires the block below to accept the spawn via
BlockBehavior::is_valid_spawn,
unless a spawner bypasses the surface check.
fn check_spawn_obstruction(&self, world: &Arc<World>) -> bool
Sourcefn interact_mob(
&self,
player: &Player,
hand: InteractionHand,
location: DVec3,
) -> InteractionResult
fn interact_mob( &self, player: &Player, hand: InteractionHand, location: DVec3, ) -> InteractionResult
Dispatches held-item, entity, and mob-specific interactions in order.
Sourcefn check_and_handle_important_interactions(
&self,
player: &Player,
hand: InteractionHand,
) -> InteractionResult
fn check_and_handle_important_interactions( &self, player: &Player, hand: InteractionHand, ) -> InteractionResult
Handles interactions that take priority over normal behavior: renaming with a name tag and spawning with a spawn egg.
Sourcefn mob_interact(
&self,
_player: &Player,
_hand: InteractionHand,
) -> InteractionResult
fn mob_interact( &self, _player: &Player, _hand: InteractionHand, ) -> InteractionResult
Mob-specific interaction hook for concrete mobs to override; does nothing by default.
Sourcefn can_shear_equipment(&self, _player: &Player) -> bool
fn can_shear_equipment(&self, _player: &Player) -> bool
Returns whether this mob’s equipment can be sheared; false while something is riding it.
Sourcefn use_player_item(&self, player: &Player, hand: InteractionHand)
fn use_player_item(&self, player: &Player, hand: InteractionHand)
Consumes one of the player’s held item after this mob uses it in an interaction.
fn remove_when_far_away(&self, dist_sqr: f64) -> bool
fn requires_custom_persistence(&self) -> bool
fn is_persistence_required(&self) -> bool
fn set_persistence_required(&self)
Sourcefn mob_can_be_leashed(&self) -> bool
fn mob_can_be_leashed(&self) -> bool
Returns whether this mob can be leashed, before its leash state is considered.
Sourcefn can_pick_up_loot(&self) -> bool
fn can_pick_up_loot(&self) -> bool
Returns whether this mob is allowed to pick up dropped items.
fn set_can_pick_up_loot(&self, can_pick_up_loot: bool)
fn equipment_drop_chance(&self, slot: EquipmentSlot) -> f32
fn set_equipment_drop_chance(&self, slot: EquipmentSlot, chance: f32)
fn is_equipment_drop_preserved(&self, slot: EquipmentSlot) -> bool
fn set_guaranteed_drop(&self, slot: EquipmentSlot)
Sourcefn get_pickup_reach(&self) -> DVec3
fn get_pickup_reach(&self) -> DVec3
Vanilla Mob.getPickupReach: the per-axis distance the item-pickup search
box is inflated by. Overridable so mobs with a longer reach can widen it.
Sourcefn wants_to_pick_up(&self, item_stack: &ItemStack) -> bool
fn wants_to_pick_up(&self, item_stack: &ItemStack) -> bool
Vanilla Mob.wantsToPickUp: whether this mob wants to collect the item it
just walked over. Defaults to whatever the mob is willing to hold.
Sourcefn can_hold_item(&self, _item_stack: &ItemStack) -> bool
fn can_hold_item(&self, _item_stack: &ItemStack) -> bool
Vanilla Mob.canHoldItem: whether this mob is willing to hold the item.
The base mob holds anything; specific mobs narrow this down.
Sourcefn pick_up_item(&self, world: &Arc<World>, item_entity: &ItemEntity)
fn pick_up_item(&self, world: &Arc<World>, item_entity: &ItemEntity)
Vanilla Mob.pickUpItem: take a dropped item into this mob’s equipment.
Delegates the slot routing and gear-swap decision to
equip_item_if_possible, then shrinks the
source stack by however much was equipped, only removing the item entity
once nothing is left.
Sourcefn equip_item_if_possible(&self, item_stack: ItemStack) -> ItemStack
fn equip_item_if_possible(&self, item_stack: ItemStack) -> ItemStack
Vanilla Mob.equipItemIfPossible: route item_stack to the slot its
equippable component asks for (main hand otherwise), swap up when the
target slot already holds worse gear, and drop the replaced piece by its
drop chance. Returns the stack that was equipped, or empty when nothing
was taken.
Sourcefn get_equipment_slot_for_item(&self, item_stack: &ItemStack) -> EquipmentSlot
fn get_equipment_slot_for_item(&self, item_stack: &ItemStack) -> EquipmentSlot
Vanilla LivingEntity.getEquipmentSlotForItem: the slot an item wants to
occupy, falling back to the main hand when it is not equippable or the mob
cannot use that slot.
Sourcefn equipment_in_slot(&self, slot: EquipmentSlot) -> ItemStack
fn equipment_in_slot(&self, slot: EquipmentSlot) -> ItemStack
Returns a copy of whatever this mob currently holds in slot.
Sourcefn can_replace_current_item(
&self,
new_item_stack: &ItemStack,
current_item_stack: &ItemStack,
slot: EquipmentSlot,
) -> bool
fn can_replace_current_item( &self, new_item_stack: &ItemStack, current_item_stack: &ItemStack, slot: EquipmentSlot, ) -> bool
Vanilla Mob.canReplaceCurrentItem: whether the freshly picked-up item
should displace what is already in slot.
Sourcefn compare_armor(
&self,
new_item_stack: &ItemStack,
current_item_stack: &ItemStack,
slot: EquipmentSlot,
) -> bool
fn compare_armor( &self, new_item_stack: &ItemStack, current_item_stack: &ItemStack, slot: EquipmentSlot, ) -> bool
Vanilla Mob.compareArmor: prefer the piece granting more armor, then
more toughness, then the equal-item tiebreak, unless the worn piece is
protected against removal.
Sourcefn get_preferred_weapon_type(&self) -> Option<Identifier>
fn get_preferred_weapon_type(&self) -> Option<Identifier>
Vanilla Mob.getPreferredWeaponType: the item tag a mob favors for its
main hand regardless of raw damage (a skeleton keeps its bow over a
stronger sword). The base mob has no preference; specific mobs override it.
Sourcefn compare_weapons(
&self,
new_item_stack: &ItemStack,
current_item_stack: &ItemStack,
slot: EquipmentSlot,
) -> bool
fn compare_weapons( &self, new_item_stack: &ItemStack, current_item_stack: &ItemStack, slot: EquipmentSlot, ) -> bool
Vanilla Mob.compareWeapons: keep a piece of the mob’s preferred weapon
type over one that is not, otherwise prefer more attack damage, then the
equal-item tiebreak.
Sourcefn approximate_attribute_with(
&self,
item_stack: &ItemStack,
attribute: AttributeRef,
slot: EquipmentSlot,
) -> f64
fn approximate_attribute_with( &self, item_stack: &ItemStack, attribute: AttributeRef, slot: EquipmentSlot, ) -> f64
Vanilla Mob.getApproximateAttributeWith: the value of attribute this
mob would have in slot while wearing item_stack, taking the mob’s base
value (zero when it lacks the attribute) and folding in the item’s
attribute modifiers.
Sourcefn can_replace_equal_item(
&self,
new_item_stack: &ItemStack,
current_item_stack: &ItemStack,
) -> bool
fn can_replace_equal_item( &self, new_item_stack: &ItemStack, current_item_stack: &ItemStack, ) -> bool
Vanilla Mob.canReplaceEqualItem: the tiebreak when two pieces grade out
equally, favoring more enchantments, then less damage, then a custom name.
Sourcefn tick_looting(&self)
fn tick_looting(&self)
Vanilla Mob.aiStep looting loop: while this mob may pick up loot and the
mobGriefing game rule allows it, collect nearby dropped items in reach.
fn drop_custom_death_loot_mob( &self, _source: &DamageSource, killed_by_player: bool, )
fn save_mob(&self, nbt: &mut NbtCompound)
fn load_mob(&self, nbt: BorrowedNbtCompoundView<'_, '_>)
fn set_death_loot_table(&self, loot_table: Option<Identifier>)
fn set_death_loot_table_seed(&self, seed: i64)
fn custom_death_loot_table(&self) -> Option<LootTableRef>
fn has_custom_death_loot_table(&self) -> bool
fn death_loot_table_seed(&self) -> i64
fn clear_custom_death_loot_table(&self)
fn is_within_home(&self) -> bool
fn is_within_home_pos(&self, pos: BlockPos) -> bool
fn is_within_home_vec(&self, pos: DVec3) -> bool
fn set_home_to(&self, position: BlockPos, radius: i32)
fn home_position(&self) -> BlockPos
fn home_radius(&self) -> i32
fn clear_home(&self)
fn has_home(&self) -> bool
fn check_mob_despawn(&self)
fn nearest_player_distance_sqr(&self) -> Option<f64>
fn controlling_passenger_mob(&self) -> Option<SharedEntity>
fn get_pathfinding_malus(&self, path_type: PathType) -> f32
Sourcefn max_fall_distance(&self) -> i32
fn max_fall_distance(&self) -> i32
Blocks a mob can fall before taking fall damage; concrete mobs may raise this.
fn set_pathfinding_malus(&self, path_type: PathType, malus: f32)
fn is_no_ai(&self) -> bool
fn set_no_ai(&self, no_ai: bool)
fn is_left_handed(&self) -> bool
fn set_left_handed(&self, left_handed: bool)
fn is_aggressive(&self) -> bool
Sourcefn max_head_x_rot(&self) -> f32
fn max_head_x_rot(&self) -> f32
Maximum degrees the head may pitch up or down independently of the body.
Sourcefn max_head_y_rot(&self) -> f32
fn max_head_y_rot(&self) -> f32
Maximum degrees the head may yaw left or right independently of the body.
Sourcefn do_hurt_target(
&self,
entity: &SharedEntity,
world: &World,
target: &SharedEntity,
) -> bool
fn do_hurt_target( &self, entity: &SharedEntity, world: &World, target: &SharedEntity, ) -> bool
Performs this mob’s melee attack against target: computes weapon
damage and knockback, applies enchantment effects, and returns whether
the target was hurt.
Sourcefn mob_attack_damage_source(
&self,
weapon_item: &ItemStack,
attacker: &SharedEntity,
) -> DamageSource
fn mob_attack_damage_source( &self, weapon_item: &ItemStack, attacker: &SharedEntity, ) -> DamageSource
Builds the damage source for this mob’s melee attack: the weapon’s custom damage type if set, else its behavior’s item damage source, else the default mob-attack type.
Sourcefn get_attack_knockback(
&self,
target: &dyn Entity,
weapon_item: &ItemStack,
damage_source: &DamageSource,
) -> f64
fn get_attack_knockback( &self, target: &dyn Entity, weapon_item: &ItemStack, damage_source: &DamageSource, ) -> f64
Computes attack knockback strength from the attack-knockback attribute and the weapon’s knockback enchantments.
Sourcefn cause_extra_knockback(
&self,
target: &dyn Entity,
knockback_amount: f64,
_old_movement: DVec3,
)
fn cause_extra_knockback( &self, target: &dyn Entity, knockback_amount: f64, _old_movement: DVec3, )
Knocks the target back in this mob’s facing direction and dampens this mob’s own horizontal velocity.
Sourcefn play_attack_sound(&self)
fn play_attack_sound(&self)
Plays this mob’s attack sound; does nothing by default.
Sourcefn is_within_melee_attack_range(&self, target: &dyn LivingEntity) -> bool
fn is_within_melee_attack_range(&self, target: &dyn LivingEntity) -> bool
Returns whether target is within this mob’s melee attack range.
Sourcefn attack_bounding_box(&self, horizontal_expansion: f64) -> WorldAabb
fn attack_bounding_box(&self, horizontal_expansion: f64) -> WorldAabb
Returns the bounding box used for melee range checks, expanded horizontally and extended to cover a ridden vehicle.
fn set_aggressive(&self, aggressive: bool)
fn set_mob_flag(&self, flag: i8, enabled: bool)
fn controlled_mob_vehicle(&self) -> Option<SharedEntity>
fn set_wanted_position(&self, position: DVec3, speed_modifier: f64)
fn jump_control_jump(&self)
Sourcefn set_mob_speed(&self, speed: f32)
fn set_mob_speed(&self, speed: f32)
Mirrors vanilla Mob.setSpeed: update cached speed and forward AI input.
fn mob_server_ai_step(&self, entity: &SharedEntity)
Sourcefn is_sun_burn_tick(&self) -> bool
fn is_sun_burn_tick(&self) -> bool
Rolls the daylight-burning chance when MONSTERS_BURN is enabled.
Water, rain, and powder snow prevent burning.
fn sun_protection_slot(&self) -> EquipmentSlot
Sourcefn tick_daylight_burning(&self)
fn tick_daylight_burning(&self)
Damages sun-protective gear on a successful burn roll, or ignites the mob if the slot is empty.
Sourcefn mob_ai_step(&self, entity: &SharedEntity) -> Option<MoveResult>
fn mob_ai_step(&self, entity: &SharedEntity) -> Option<MoveResult>
Runs movement, daylight burning, and item pickup.
Burning and pickup belong here, outside the serverAiStep AI gate,
so mobs with NoAI still burn and collect loot as in vanilla.
fn tick_move_control(&self)
fn tick_move_to_control(&self, wanted_position: DVec3, speed_modifier: f64)
fn tick_strafe_control(&self, forward: f32, right: f32)
fn is_strafe_walkable(&self, dx: f32, dz: f32) -> bool
fn tick_jumping_control(&self, speed_modifier: f64)
fn tick_look_control(&self)
fn clamp_head_rotation_to_body_when_pathing(&self)
fn tick_jump_control(&self)
fn update_control_flags(&self)
fn tick_body_rotation_control(&self)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".