aboutsummaryrefslogtreecommitdiff
path: root/azalea-entity/src/plugin/indexing.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-02-22 23:01:54 +0000
committermat <git@matdoes.dev>2025-02-22 23:01:54 +0000
commit34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6 (patch)
tree7920fec1203e8e96463a142f5f6da6164e76e684 /azalea-entity/src/plugin/indexing.rs
parentbdd2fc91e11e2896d8e1c7046df247e1075bd40d (diff)
downloadazalea-drasl-34f53baf85fb5c7163ec5d71a8ab9d45d3f271b6.tar.xz
update to rust edition 2024
Diffstat (limited to 'azalea-entity/src/plugin/indexing.rs')
-rw-r--r--azalea-entity/src/plugin/indexing.rs25
1 files changed, 15 insertions, 10 deletions
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() {