diff options
| author | mat <git@matdoes.dev> | 2025-02-22 23:01:54 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-02-22 23:01:54 +0000 |
| commit | 34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6 (patch) | |
| tree | 7920fec1203e8e96463a142f5f6da6164e76e684 /azalea-entity/src | |
| parent | bdd2fc91e11e2896d8e1c7046df247e1075bd40d (diff) | |
| download | azalea-drasl-34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6.tar.xz | |
update to rust edition 2024
Diffstat (limited to 'azalea-entity/src')
| -rw-r--r-- | azalea-entity/src/attributes.rs | 2 | ||||
| -rw-r--r-- | azalea-entity/src/lib.rs | 2 | ||||
| -rw-r--r-- | azalea-entity/src/mining.rs | 2 | ||||
| -rw-r--r-- | azalea-entity/src/plugin/indexing.rs | 25 | ||||
| -rw-r--r-- | azalea-entity/src/plugin/mod.rs | 6 |
5 files changed, 21 insertions, 16 deletions
diff --git a/azalea-entity/src/attributes.rs b/azalea-entity/src/attributes.rs index 9af3bcaa..d3881147 100644 --- a/azalea-entity/src/attributes.rs +++ b/azalea-entity/src/attributes.rs @@ -1,6 +1,6 @@ //! See <https://minecraft.fandom.com/wiki/Attribute>. -use std::collections::{hash_map, HashMap}; +use std::collections::{HashMap, hash_map}; use azalea_buf::AzBuf; use azalea_core::resource_location::ResourceLocation; diff --git a/azalea-entity/src/lib.rs b/azalea-entity/src/lib.rs index 472ba29a..1024ffe6 100644 --- a/azalea-entity/src/lib.rs +++ b/azalea-entity/src/lib.rs @@ -17,7 +17,7 @@ use std::{ }; pub use attributes::Attributes; -use azalea_block::{fluid_state::FluidKind, BlockState}; +use azalea_block::{BlockState, fluid_state::FluidKind}; use azalea_buf::AzBuf; use azalea_core::{ aabb::AABB, diff --git a/azalea-entity/src/mining.rs b/azalea-entity/src/mining.rs index b17cddf0..370478ee 100644 --- a/azalea-entity/src/mining.rs +++ b/azalea-entity/src/mining.rs @@ -2,7 +2,7 @@ use azalea_block::{Block, BlockBehavior}; use azalea_core::tier::get_item_tier; use azalea_registry as registry; -use crate::{effects, FluidOnEyes, Physics}; +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. diff --git a/azalea-entity/src/plugin/indexing.rs b/azalea-entity/src/plugin/indexing.rs index 78d5fb7e..21dd273a 100644 --- a/azalea-entity/src/plugin/indexing.rs +++ b/azalea-entity/src/plugin/indexing.rs @@ -181,19 +181,24 @@ pub fn remove_despawned_entities_from_indexes( // remove the entity from the chunk index let chunk = ChunkPos::from(*position); - if let Some(entities_in_chunk) = instance.entities_by_chunk.get_mut(&chunk) { - if entities_in_chunk.remove(&entity) { - // remove the chunk if there's no entities in it anymore - if entities_in_chunk.is_empty() { - instance.entities_by_chunk.remove(&chunk); + match instance.entities_by_chunk.get_mut(&chunk) { + Some(entities_in_chunk) => { + if entities_in_chunk.remove(&entity) { + // remove the chunk if there's no entities in it anymore + if entities_in_chunk.is_empty() { + instance.entities_by_chunk.remove(&chunk); + } + } else { + warn!( + "Tried to remove entity {entity:?} from chunk {chunk:?} but the entity was not there." + ); } - } else { - warn!( - "Tried to remove entity {entity:?} from chunk {chunk:?} but the entity was not there." + } + _ => { + debug!( + "Tried to remove entity {entity:?} from chunk {chunk:?} but the chunk was not found." ); } - } else { - debug!("Tried to remove entity {entity:?} from chunk {chunk:?} but the chunk was not found."); } // remove it from the uuid index if entity_uuid_index.entity_by_uuid.remove(uuid).is_none() { diff --git a/azalea-entity/src/plugin/mod.rs b/azalea-entity/src/plugin/mod.rs index 560d0ec6..bddb4b66 100644 --- a/azalea-entity/src/plugin/mod.rs +++ b/azalea-entity/src/plugin/mod.rs @@ -3,7 +3,7 @@ mod relative_updates; use std::collections::HashSet; -use azalea_block::{fluid_state::FluidKind, BlockState}; +use azalea_block::{BlockState, fluid_state::FluidKind}; use azalea_core::{ position::{BlockPos, ChunkPos, Vec3}, tick::GameTick, @@ -17,8 +17,8 @@ pub use relative_updates::RelativeEntityUpdate; use tracing::debug; use crate::{ - metadata::Health, Dead, EyeHeight, FluidOnEyes, LocalEntity, LookDirection, OnClimbable, - Physics, Position, + Dead, EyeHeight, FluidOnEyes, LocalEntity, LookDirection, OnClimbable, Physics, Position, + metadata::Health, }; /// A Bevy [`SystemSet`] for various types of entity updates. |
