aboutsummaryrefslogtreecommitdiff
path: root/azalea/src
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-02-24 04:14:54 +0000
committermat <git@matdoes.dev>2025-02-24 04:14:54 +0000
commit9e061be903a2293ed7cfce705acd5551c875ac5c (patch)
treec96a273222bf50a199a67ac7cfa5beb473381e97 /azalea/src
parent172e0ce0793206a3cd7ae04f70beadf2e3f66c7e (diff)
downloadazalea-drasl-9e061be903a2293ed7cfce705acd5551c875ac5c.tar.xz
fix an error in set_entity_data
Diffstat (limited to 'azalea/src')
-rw-r--r--azalea/src/swarm/mod.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs
index a9b2512b..04bc94dc 100644
--- a/azalea/src/swarm/mod.rs
+++ b/azalea/src/swarm/mod.rs
@@ -488,7 +488,9 @@ where
}
if let Some(handler) = &self.handler {
- let Some(first_bot_state) = first_bot.get_component::<S>() else {
+ let ecs_mutex = first_bot.ecs.clone();
+ let mut ecs = ecs_mutex.lock();
+ let Some(first_bot_state) = first_bot.query::<Option<&S>>(&mut ecs).cloned() else {
error!(
"the first bot ({} / {}) is missing the required state component! none of the client handler functions will be called.",
first_bot.profile.name, first_bot.entity
@@ -506,7 +508,7 @@ where
let state = match states.entry(bot.entity) {
hash_map::Entry::Occupied(e) => e.into_mut(),
hash_map::Entry::Vacant(e) => {
- let Some(state) = bot.get_component::<S>() else {
+ let Some(state) = bot.query::<Option<&S>>(&mut ecs).cloned() else {
error!(
"one of our bots ({} / {}) is missing the required state component! its client handler function will not be called.",
bot.profile.name, bot.entity