From be4f13c36c281f086602092098522b3f25fc0680 Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 17 Feb 2024 14:43:42 -0600 Subject: upgrade deps, bevy 0.13 --- azalea-client/src/entity_query.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'azalea-client/src/entity_query.rs') diff --git a/azalea-client/src/entity_query.rs b/azalea-client/src/entity_query.rs index 42b7b0ca..be892ee5 100644 --- a/azalea-client/src/entity_query.rs +++ b/azalea-client/src/entity_query.rs @@ -3,7 +3,8 @@ use std::sync::Arc; use bevy_ecs::{ component::Component, entity::Entity, - query::{ROQueryItem, ReadOnlyWorldQuery, WorldQuery}, + query::QueryData, + query::{QueryFilter, ROQueryItem}, world::World, }; use parking_lot::Mutex; @@ -22,13 +23,13 @@ impl Client { /// .is_some(); /// # } /// ``` - pub fn query<'w, Q: WorldQuery>(&self, ecs: &'w mut World) -> ::Item<'w> { - ecs.query::() + pub fn query<'w, D: QueryData>(&self, ecs: &'w mut World) -> D::Item<'w> { + ecs.query::() .get_mut(ecs, self.entity) .unwrap_or_else(|_| { panic!( "Our client is missing a required component {:?}", - std::any::type_name::() + std::any::type_name::() ) }) } @@ -58,7 +59,7 @@ impl Client { /// ``` /// /// [`Entity`]: bevy_ecs::entity::Entity - pub fn entity_by( + pub fn entity_by( &mut self, predicate: impl EntityPredicate, ) -> Option { @@ -93,14 +94,14 @@ impl Client { } } -pub trait EntityPredicate { +pub trait EntityPredicate { fn find(&self, ecs_lock: Arc>) -> Option; } impl EntityPredicate for F where F: Fn(&ROQueryItem) -> bool, - Q: ReadOnlyWorldQuery, - Filter: ReadOnlyWorldQuery, + Q: QueryData, + Filter: QueryFilter, { fn find(&self, ecs_lock: Arc>) -> Option { let mut ecs = ecs_lock.lock(); @@ -114,8 +115,8 @@ where // impl<'a, F, Q1, Q2> EntityPredicate<'a, (Q1, Q2)> for F // where // F: Fn(&::Item<'_>, &::Item<'_>) -> -// bool, Q1: ReadOnlyWorldQuery, -// Q2: ReadOnlyWorldQuery, +// bool, Q1: QueryFilter, +// Q2: QueryFilter, // { // fn find(&self, ecs: &mut Ecs) -> Option { // // (self)(query) -- cgit v1.2.3