diff options
Diffstat (limited to 'azalea-entity/src')
| -rw-r--r-- | azalea-entity/src/lib.rs | 31 | ||||
| -rw-r--r-- | azalea-entity/src/mining.rs | 9 | ||||
| -rw-r--r-- | azalea-entity/src/particle.rs | 6 | ||||
| -rw-r--r-- | azalea-entity/src/plugin/indexing.rs | 7 | ||||
| -rw-r--r-- | azalea-entity/src/plugin/mod.rs | 16 | ||||
| -rw-r--r-- | azalea-entity/src/plugin/relative_updates.rs | 10 |
6 files changed, 49 insertions, 30 deletions
diff --git a/azalea-entity/src/lib.rs b/azalea-entity/src/lib.rs index 1ffce394..4645e4ba 100644 --- a/azalea-entity/src/lib.rs +++ b/azalea-entity/src/lib.rs @@ -125,8 +125,10 @@ pub fn on_pos(offset: f32, chunk_storage: &ChunkStorage, pos: Position) -> Block pos } -/// The Minecraft UUID of the entity. For players, this is their actual player -/// UUID, and for other entities it's just random. +/// The Minecraft UUID of the entity. +/// +/// For players, this is their actual player UUID, and for other entities it's +/// just random. #[derive(Component, Deref, DerefMut, Clone, Copy, Default, PartialEq)] pub struct EntityUuid(Uuid); impl EntityUuid { @@ -181,7 +183,9 @@ impl From<&Position> for BlockPos { } /// The second most recent position of the entity that was sent over the -/// network. This is currently only updated for our own local player entities. +/// network. +/// +/// This is currently only updated for our own local player entities. #[derive(Component, Clone, Copy, Debug, Default, PartialEq, Deref, DerefMut)] pub struct LastSentPosition(Vec3); impl From<&LastSentPosition> for Vec3 { @@ -248,9 +252,10 @@ impl LookDirection { self.x_rot } - /// Update this look direction to the new value, while handling relative - /// rotations correctly and with the default Minecraft sensitivity to avoid - /// triggering anticheats. + /// Update this look direction to the new value. + /// + /// This handles relative rotations correctly and with the default Minecraft + /// sensitivity to avoid triggering anticheats. pub fn update(&mut self, new: LookDirection) { self.update_with_sensitivity(new, 1.); } @@ -353,8 +358,9 @@ pub struct Physics { /// and sets to 0 if we're not trying to jump. pub no_jump_delay: u32, - /// The bounding box of the entity. This is more than just width and height, - /// unlike dimensions. + /// The bounding box of the entity. + /// + /// This is more than just width and height, unlike dimensions. pub bounding_box: Aabb, pub has_impulse: bool, @@ -460,8 +466,9 @@ pub struct Dead; #[derive(Component, Clone, Copy, Debug, PartialEq, Deref)] pub struct EntityKindComponent(pub azalea_registry::EntityKind); -/// A bundle of components that every entity has. This doesn't contain metadata, -/// that has to be added separately. +/// A bundle of components that every entity has. +/// +/// This doesn't contain metadata; that has to be added separately. #[derive(Bundle)] pub struct EntityBundle { pub kind: EntityKindComponent, @@ -559,7 +566,9 @@ pub struct OnClimbable(bool); pub struct Crouching(bool); /// A component that contains the abilities the player has, like flying -/// or instantly breaking blocks. This is only present on local players. +/// or instantly breaking blocks. +/// +/// This is only present on local players. #[derive(Clone, Debug, Component, Default)] pub struct PlayerAbilities { pub invulnerable: bool, diff --git a/azalea-entity/src/mining.rs b/azalea-entity/src/mining.rs index ea521a9a..cd526799 100644 --- a/azalea-entity/src/mining.rs +++ b/azalea-entity/src/mining.rs @@ -5,7 +5,9 @@ use azalea_registry as registry; use crate::{FluidOnEyes, Physics, effects}; /// How much progress is made towards mining the block per tick, as a -/// percentage. If this is 1 then the block gets broken instantly. +/// percentage. +/// +/// If this is 1, then the block gets broken instantly. /// /// You can divide 1 by this and then round up to get the number of ticks it /// takes to mine the block. @@ -71,8 +73,9 @@ fn has_correct_tool_for_drops(block: &dyn BlockTrait, tool: registry::Item) -> b } /// Returns the destroy speed of the given block with the given tool, taking -/// into account enchantments and effects. If the player is not holding anything -/// then `tool` should be `Item::Air`. +/// enchantments and effects into account. +/// +/// If the player is not holding anything, then `tool` should be `Item::Air`. fn destroy_speed( block: registry::Block, tool: registry::Item, diff --git a/azalea-entity/src/particle.rs b/azalea-entity/src/particle.rs index ce5f5350..5b7bb6af 100644 --- a/azalea-entity/src/particle.rs +++ b/azalea-entity/src/particle.rs @@ -130,8 +130,10 @@ pub enum Particle { } impl From<ParticleKind> for Particle { - /// Convert a particle kind into particle data. If the particle has data - /// attached (like block particles), then it's set to the default. + /// Convert a particle kind into particle data. + /// + /// If the particle has data attached (like block particles), then it's set + /// to the default. fn from(kind: ParticleKind) -> Self { // this is mostly just here so it fails to compile when a new particle is added // to ParticleKind, since `Particle` has to be updated manually diff --git a/azalea-entity/src/plugin/indexing.rs b/azalea-entity/src/plugin/indexing.rs index f1926286..6f170dc6 100644 --- a/azalea-entity/src/plugin/indexing.rs +++ b/azalea-entity/src/plugin/indexing.rs @@ -45,9 +45,10 @@ impl EntityUuidIndex { } } -/// An index of Minecraft entity IDs to Azalea ECS entities. This is a -/// `Component` so local players can keep track of entity IDs independently from -/// the instance. +/// An index of Minecraft entity IDs to Azalea ECS entities. +/// +/// This is a `Component` so local players can keep track of entity IDs +/// independently from the instance. /// /// If you need a per-instance instead of per-client version of this, you can /// use [`Instance::entity_by_id`]. diff --git a/azalea-entity/src/plugin/mod.rs b/azalea-entity/src/plugin/mod.rs index e20ed860..a3ea11d0 100644 --- a/azalea-entity/src/plugin/mod.rs +++ b/azalea-entity/src/plugin/mod.rs @@ -80,8 +80,9 @@ fn debug_new_entity(query: Query<(Entity, Option<&LocalEntity>), Added<Minecraft } /// System that adds the [`Dead`] marker component if an entity's health is set -/// to 0 (or less than 0). This will be present if an entity is doing the death -/// animation. +/// to 0 (or less than 0). +/// +/// This will be present if an entity is doing the death animation. /// /// Entities that are dead cannot be revived. pub fn add_dead(mut commands: Commands, query: Query<(Entity, &Health), Changed<Health>>) { @@ -188,7 +189,9 @@ fn is_trapdoor_useable_as_ladder( } /// A component that lists all the local player entities that have this entity -/// loaded. If this is empty, the entity will be removed from the ECS. +/// loaded. +/// +/// If this is empty, the entity will be removed from the ECS. #[derive(Component, Clone, Deref, DerefMut)] pub struct LoadedBy(pub HashSet<Entity>); @@ -203,10 +206,13 @@ pub fn apply_clamp_look_direction(mut look_direction: LookDirection) -> LookDire look_direction } -/// Sets the position of the entity. This doesn't update the cache in -/// azalea-world, and should only be used within azalea-world! +/// Sets the position of the entity. +/// +/// This doesn't update the cache in azalea-world, and should only be used +/// within azalea-world. /// /// # Safety +/// /// Cached position in the world must be updated. #[allow(clippy::type_complexity)] pub fn update_bounding_box( diff --git a/azalea-entity/src/plugin/relative_updates.rs b/azalea-entity/src/plugin/relative_updates.rs index 1c0a899f..3917c946 100644 --- a/azalea-entity/src/plugin/relative_updates.rs +++ b/azalea-entity/src/plugin/relative_updates.rs @@ -54,6 +54,7 @@ impl RelativeEntityUpdate { } /// A component that counts the number of times this entity has been modified. +/// /// This is used for making sure two clients don't do the same relative update /// on an entity. /// @@ -102,15 +103,12 @@ impl EntityCommand for RelativeEntityUpdate { } } -/// The [`UpdatesReceived`] component should never be on [`LocalEntity`] -/// entities. This warns if an entity has both components. +/// A system that logs a warning if an entity has both [`UpdatesReceived`] +/// and [`LocalEntity`]. pub fn debug_detect_updates_received_on_local_entities( query: Query<Entity, (With<LocalEntity>, With<UpdatesReceived>)>, ) { for entity in &query { - warn!( - "Entity {:?} has both LocalEntity and UpdatesReceived", - entity - ); + warn!("Entity {entity:?} has both LocalEntity and UpdatesReceived"); } } |
