From b3af8d73faa2663e25e5688897720e57842f99ae Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 25 Apr 2025 01:10:03 -0100 Subject: update to bevy 0.16 --- azalea-entity/src/plugin/indexing.rs | 7 +------ azalea-entity/src/plugin/relative_updates.rs | 24 ++++++++---------------- 2 files changed, 9 insertions(+), 22 deletions(-) (limited to 'azalea-entity/src/plugin') diff --git a/azalea-entity/src/plugin/indexing.rs b/azalea-entity/src/plugin/indexing.rs index 2a7643b0..a91e6b6d 100644 --- a/azalea-entity/src/plugin/indexing.rs +++ b/azalea-entity/src/plugin/indexing.rs @@ -7,12 +7,7 @@ use std::{ use azalea_core::position::ChunkPos; use azalea_world::{Instance, InstanceContainer, InstanceName, MinecraftEntityId}; -use bevy_ecs::{ - component::Component, - entity::Entity, - query::{Added, Changed, Without}, - system::{Commands, Query, Res, ResMut, Resource}, -}; +use bevy_ecs::prelude::*; use derive_more::{Deref, DerefMut}; use nohash_hasher::IntMap; use tracing::{debug, trace, warn}; diff --git a/azalea-entity/src/plugin/relative_updates.rs b/azalea-entity/src/plugin/relative_updates.rs index 5ad7d7a0..1c0a899f 100644 --- a/azalea-entity/src/plugin/relative_updates.rs +++ b/azalea-entity/src/plugin/relative_updates.rs @@ -18,12 +18,7 @@ use std::sync::Arc; use azalea_world::{MinecraftEntityId, PartialInstance}; -use bevy_ecs::{ - prelude::{Component, Entity}, - query::With, - system::{EntityCommand, Query}, - world::{EntityWorldMut, World}, -}; +use bevy_ecs::prelude::*; use derive_more::{Deref, DerefMut}; use parking_lot::RwLock; use tracing::warn; @@ -68,19 +63,17 @@ impl RelativeEntityUpdate { pub struct UpdatesReceived(u32); impl EntityCommand for RelativeEntityUpdate { - fn apply(self, entity: Entity, world: &mut World) { + fn apply(self, mut entity: EntityWorldMut) { let partial_entity_infos = &mut self.partial_world.write().entity_infos; - let mut entity_mut = world.entity_mut(entity); - - if Some(entity) == partial_entity_infos.owner_entity { + if Some(entity.id()) == partial_entity_infos.owner_entity { // if the entity owns this partial world, it's always allowed to update itself - (self.update)(&mut entity_mut); + (self.update)(&mut entity); return; }; - let entity_id = *entity_mut.get::().unwrap(); - if entity_mut.contains::() { + let entity_id = *entity.get::().unwrap(); + if entity.contains::() { // a client tried to update another client, which isn't allowed return; } @@ -90,7 +83,7 @@ impl EntityCommand for RelativeEntityUpdate { .get(&entity_id) .copied(); - let can_update = if let Some(updates_received) = entity_mut.get::() { + let can_update = if let Some(updates_received) = entity.get::() { this_client_updates_received.unwrap_or(1) == **updates_received } else { // no UpdatesReceived means the entity was just spawned @@ -102,9 +95,8 @@ impl EntityCommand for RelativeEntityUpdate { .updates_received .insert(entity_id, new_updates_received); - entity_mut.insert(UpdatesReceived(new_updates_received)); + entity.insert(UpdatesReceived(new_updates_received)); - let mut entity = world.entity_mut(entity); (self.update)(&mut entity); } } -- cgit v1.2.3