Skip to main content

Module entity

Module entity 

Source
Expand description

This module contains entity-related traits and types.

Re-exportsΒ§

pub use projectile::EntityHitResult;
pub use projectile::Projectile;
pub use projectile::ProjectileBase;
pub use projectile::ProjectileDeflection;
pub use projectile::ProjectileEventSource;
pub use projectile::ProjectileHit;
pub use projectile::ThrowableItemProjectile;
pub use projectile::ThrowableProjectile;
pub use projectile::compute_margin;

ModulesΒ§

ageable πŸ”’
Shared vanilla AgeableMob state and hooks.
ai πŸ”’
Vanilla-shaped mob AI foundations.
animal πŸ”’
Shared vanilla Animal state and hooks.
attribute
Runtime entity attribute system.
base πŸ”’
Common base functionality shared by all entities.
block_effects πŸ”’
callback πŸ”’
Entity lifecycle callbacks for movement and removal tracking.
combat_rules πŸ”’
damage
Damage source system.
entities
Concrete entity implementations.
entity πŸ”’
fluid_contact πŸ”’
Entity contact with world fluids.
generated_entities πŸ”’
Generated entity factory registrations.
inside_block_effects πŸ”’
item_based_steering πŸ”’
Vanilla item-steered vehicle helpers.
item_frame πŸ”’
Shared item-frame entity behavior.
living_base πŸ”’
Shared fields for all living entities.
living_entity πŸ”’
manager πŸ”’
World-level entity ownership and lookup.
mob πŸ”’
Vanilla-shaped mob foundations.
movement_sync πŸ”’
Shared movement synchronization state for tracked entities.
projectile
Vanilla Projectile class hierarchy, mirrored as Rust traits + base structs.
registry πŸ”’
Entity registry for creating entity instances.
spawn πŸ”’
storage πŸ”’
Proto-chunk entity storage.
synced_data πŸ”’
ticking πŸ”’
Shared vanilla entity tick helpers.
tracker πŸ”’
Entity tracking system for managing which players can see which entities.

StructsΒ§

AcceptedClientMovement
Final state accepted from a client-authored movement packet.
BlockEffectFireSnapshot πŸ”’
ChunkEntityLoadResult
Entity changes produced when a chunk becomes loaded.
EntityAmethystStepSound
Sound parameters for vanilla amethyst step chimes.
EntityBase
Common fields and methods shared by all entities.
EntityBaseLoad
Base fields restored from persistent entity data.
EntityBaseSaveData
Shared vanilla entity save data that is not part of the movement snapshot.
EntityBaseState
Vanilla Entity movement state stored as one locked snapshot.
EntityChangeSenders
Packet sinks used by EntityTracker::send_changes.
EntityChunkCallback
Callback attached to each entity for tracking chunk/section movement.
EntityFireFreezeState
Vanilla base fire and freezing state.
EntityFluidContact
Fluid heights intersecting an entity’s current bounding box.
EntityGroundContact
Vanilla ground-support state updated by Entity.checkSupportingBlock.
EntityLifecycleChanges
Entity lifecycle changes caused by manager membership or visibility updates.
EntityLoadRequest
Entity load request before the registry assigns a runtime ID.
EntityMoveUpdate
Section/chunk membership update caused by a committed entity move.
EntityMovement
A vanilla movement segment used by block-contact effects.
EntityMovementFlags
Vanilla collision and ground-contact flags updated by Entity.move.
EntityMovementProgress
Vanilla movement distance counters used by step, swim, and flap side effects.
EntityMovementSyncPackets
At most two movement packets are emitted for one tracked movement update: one body movement/rotation packet and one head-rotation packet.
EntityMovementSyncState
Per-entity movement sync state for tracked position and rotation.
EntityMovementSyncUpdate
Runtime values accepted by tracked entity movement sync.
EntityPositionSyncSnapshot
Runtime values needed to build a vanilla position sync packet.
EntityPositionSyncState
Per-entity position sync state shared by player and entity tracking.
EntityRegistry
Registry for entity factories.
EntityRotationSyncState
Last packed rotation values known to tracking clients.
EntityTracker
World-level entity tracker.
EntityVelocitySyncState
Per-entity velocity sync state for tracked entities.
InactiveEntityCallback
Callback for entities retained outside live world membership.
InsideBlockEffectCollector
Step-scoped collector for vanilla inside-block side effects.
LivingEntityBase
Common runtime fields shared by all living entities.
LivingRotationState
Vanilla living-entity body/head rotation state.
LivingSwingState
Vanilla arm-swing animation state stored on LivingEntity.
LivingTravelInput
Movement input stored on vanilla LivingEntity.
MobEffectInstance
Runtime mob-effect state.
NullEntityCallback
Null callback for entities not yet in the world.
PackedEntityRotation
Packed body rotation used by entity movement packets.
PendingWorldChangeToken
Runtime token for an in-flight world change request.
PlayerEntityCallback
Callback for players.
ServerEntityMovementSyncState
Per-tracked-entity movement state owned by the entity tracker.
ServerEntityMovementSyncUpdate
Runtime values accepted by vanilla ServerEntity.sendChanges movement sync.
SwimmingEnvironment πŸ”’
WorldEntityManager
Central world entity manager.

EnumsΒ§

AcceptedClientMovementOutcome
Result of applying accepted client-authored movement.
AddEntityError
Error returned when adding an entity to the runtime world fails.
BlockEffectSegmentResult πŸ”’
EntityAnchor
The point on an entity used by commands that resolve positions or facing.
EntityMoveError
Error returned when a live entity move cannot be committed.
EntityMovementEmission
Vanilla movement side effects emitted by Entity.move.
EntityMovementSyncPacket
Concrete movement sync packet ready for broadcast.
EntityOwnership
Whether the manager owns persistence for an entity.
EntityPositionRotSyncPacket
Position sync packet for entities that include rotation in delta updates.
EntityPositionSyncDecision
Encoded position sync selected for an entity movement update.
EntityPositionSyncPacket
Position sync packet for entities that do not include rotation in delta updates.
EntityVerticalMovementStateUpdate
Vanilla server-driven gate for vertical collision and ground-contact updates.
EntityVisibility
Entity visibility for a chunk column.
InsideBlockEffectType
Vanilla inside-block effect kinds applied after entity/block intersections.
MobEffectSyncChange
A queued mob-effect packet change produced by living effect state.
MobEffectSyncPacket
Concrete mob-effect packet ready to send to a player connection.
RemovalReason
Reasons an entity can be removed from the world.
TeleportPositionCommit πŸ”’

ConstantsΒ§

BUBBLE_COLUMN_ABOVE_DOWN_MIN_SPEED πŸ”’
BUBBLE_COLUMN_ABOVE_UP_ACCELERATION πŸ”’
BUBBLE_COLUMN_ABOVE_UP_MAX_SPEED πŸ”’
BUBBLE_COLUMN_DOWN_ACCELERATION πŸ”’
BUBBLE_COLUMN_INSIDE_DOWN_MIN_SPEED πŸ”’
BUBBLE_COLUMN_INSIDE_UP_ACCELERATION πŸ”’
BUBBLE_COLUMN_INSIDE_UP_MAX_SPEED πŸ”’
DAMAGE_KNOCKBACK_POWER πŸ”’
DEATH_DURATION
Duration in ticks of the death animation before entity removal.
DEFAULT_MAX_AIR_SUPPLY
Default vanilla Entity.getMaxAirSupply value.
DEFAULT_SWING_DURATION
Vanilla default SwingAnimation duration in ticks.
DEFAULT_TICKS_REQUIRED_TO_FREEZE
Default vanilla Entity.getTicksRequiredToFreeze value.
IN_WALL_EYE_BOX_HEIGHT πŸ”’
KNOCKBACK_DIRECTION_EPSILON_SQ πŸ”’
LEASH_SCAN_HALF_SIZE πŸ”’
LEASH_SCAN_SIZE πŸ”’
MAX_ENTITY_TAGS
Vanilla scoreboard tag limit for a single entity.
MOVEMENT_RECORD_EPSILON πŸ”’
MOVE_TOWARDS_CLOSEST_SPACE_DIRECTIONS πŸ”’
NO_PHYSICS_COLLISION_EPSILON πŸ”’
POSITION_SYNC_THRESHOLD
Squared position delta needed before vanilla considers a movement worth syncing.
SPEED_MODIFIER_POWDER_SNOW_ID πŸ”’
WATER_ENTITY_FLOW_SCALE πŸ”’

StaticsΒ§

ENTITIES
Global entity registry.
ENTITY_COUNTER πŸ”’
Global counter for allocating unique entity IDs.

TraitsΒ§

Entity
A trait for entities.
EntityEventSource
Object-safe access to an entity trait object from default Entity methods.
EntityLevelCallback
Callback interface for entity lifecycle events.
EntitySyncedData
Thread-safe access to an entity’s vanilla synchronized data.
ItemFrame
Vanilla ItemFrame behavior used by comparators.
LivingEntity
A trait for living entities that can take damage, heal, and die.

FunctionsΒ§

aabb_contains_any_liquid πŸ”’
apply_block_effect_segment πŸ”’
apply_effects_from_block_movements πŸ”’
apply_post_teleport_transition πŸ”’
apply_step_on_block πŸ”’
axis_component πŸ”’
block_state_suffocates_eye_box πŸ”’
change_entity_world πŸ”’
change_non_player_entity_world πŸ”’
closest_open_space_direction πŸ”’
collided_with_fluid πŸ”’
direction_step πŸ”’
entity_eye_suffocation_box πŸ”’
entity_loot_ref πŸ”’
entity_type_name πŸ”’
equipment_items_to_packet_items πŸ”’
fall_damage_reset_clip_target πŸ”’
fall_flying_collision_damage πŸ”’
fall_flying_free_fall_interval πŸ”’
finish_inside_block_effects πŸ”’
get_input_vector πŸ”’
horizontal_distance πŸ”’
indirect_passengers πŸ”’
init_entities
Initializes the global entity registry, once the main registry is frozen.
is_in_rain πŸ”’
leash_scan_area πŸ”’
nbt_bool πŸ”’
next_entity_id
Allocates a new unique entity ID.
passenger_transition πŸ”’
passenger_transition_position πŸ”’
passenger_transition_rotation πŸ”’
physics_state_for_move πŸ”’
record_movement_for_block_effects πŸ”’
relative_on_axis πŸ”’
remove_after_changing_dimensions πŸ”’
remove_entity_name_actions πŸ”’
reset_forward_direction_of_relative_portal_position πŸ”’
Matches vanilla LivingEntity.resetForwardDirectionOfRelativePortalPosition.
select_swimming_state πŸ”’
send_teleport_transition_to_riding_players πŸ”’
should_apply_entity_cramming_damage πŸ”’
should_apply_resolved_movement πŸ”’
start_riding_entities πŸ”’
teleport_entity_cross_world πŸ”’
teleport_entity_same_world πŸ”’
teleport_set_position πŸ”’
transfer_leashables_to_holder πŸ”’
trapdoor_usable_as_ladder_state πŸ”’
world_aabb_center πŸ”’

Type AliasesΒ§

ActiveMobEffect
Active mob-effect state stored on a living entity.
InsideBlockEffectCallback
Callback queued around an inside-block effect.
SharedEntity
Type alias for a shared entity reference.
WeakEntity
Type alias for a weak entity reference.