diff options
| author | mat <git@matdoes.dev> | 2025-04-25 01:10:03 -0100 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-04-25 01:10:03 -0100 |
| commit | b3af8d73faa2663e25e5688897720e57842f99ae (patch) | |
| tree | fdc16e01fabce7b7ec4e9f1ff702fe3e6c10dfe5 /azalea/src | |
| parent | 65c9f555b0274ce9c56aafb73f3f59dbf80f3a85 (diff) | |
| download | azalea-drasl-b3af8d73faa2663e25e5688897720e57842f99ae.tar.xz | |
update to bevy 0.16
Diffstat (limited to 'azalea/src')
| -rw-r--r-- | azalea/src/auto_respawn.rs | 2 | ||||
| -rw-r--r-- | azalea/src/bot.rs | 3 | ||||
| -rw-r--r-- | azalea/src/nearest_entity.rs | 2 | ||||
| -rw-r--r-- | azalea/src/pathfinder/mod.rs | 24 | ||||
| -rw-r--r-- | azalea/src/pathfinder/moves/mod.rs | 14 | ||||
| -rw-r--r-- | azalea/src/prelude.rs | 2 | ||||
| -rw-r--r-- | azalea/src/swarm/chat.rs | 9 | ||||
| -rw-r--r-- | azalea/src/swarm/events.rs | 2 | ||||
| -rw-r--r-- | azalea/src/swarm/mod.rs | 2 |
9 files changed, 26 insertions, 34 deletions
diff --git a/azalea/src/auto_respawn.rs b/azalea/src/auto_respawn.rs index 0d878595..6e970a71 100644 --- a/azalea/src/auto_respawn.rs +++ b/azalea/src/auto_respawn.rs @@ -26,7 +26,7 @@ fn auto_respawn( mut perform_respawn_events: EventWriter<PerformRespawnEvent>, ) { for event in events.read() { - perform_respawn_events.send(PerformRespawnEvent { + perform_respawn_events.write(PerformRespawnEvent { entity: event.entity, }); } diff --git a/azalea/src/bot.rs b/azalea/src/bot.rs index dd8e6209..bca0174b 100644 --- a/azalea/src/bot.rs +++ b/azalea/src/bot.rs @@ -11,8 +11,7 @@ use azalea_entity::{ }; use azalea_physics::PhysicsSet; use bevy_app::Update; -use bevy_ecs::prelude::Event; -use bevy_ecs::schedule::IntoSystemConfigs; +use bevy_ecs::prelude::*; use futures_lite::Future; use tracing::trace; diff --git a/azalea/src/nearest_entity.rs b/azalea/src/nearest_entity.rs index 867e3fe8..aa6c6e6f 100644 --- a/azalea/src/nearest_entity.rs +++ b/azalea/src/nearest_entity.rs @@ -34,7 +34,7 @@ use bevy_ecs::{ /// continue; /// }; /// -/// chat_events.send(SendChatEvent { +/// chat_events.write(SendChatEvent { /// entity: bot_id, /// content: String::from("Ahhh!"), /// }); diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs index c747ef67..aba8610a 100644 --- a/azalea/src/pathfinder/mod.rs +++ b/azalea/src/pathfinder/mod.rs @@ -32,9 +32,7 @@ use azalea_entity::{Physics, Position}; use azalea_physics::PhysicsSet; use azalea_world::{InstanceContainer, InstanceName}; use bevy_app::{PreUpdate, Update}; -use bevy_ecs::prelude::Event; -use bevy_ecs::query::Changed; -use bevy_ecs::schedule::IntoSystemConfigs; +use bevy_ecs::prelude::*; use bevy_tasks::{AsyncComputeTaskPool, Task}; use futures_lite::future; use goals::BlockPosGoal; @@ -477,7 +475,7 @@ pub fn handle_tasks( for (entity, mut task) in &mut transform_tasks { if let Some(optional_path_found_event) = future::block_on(future::poll_once(&mut task.0)) { if let Some(path_found_event) = optional_path_found_event { - path_found_events.send(path_found_event); + path_found_events.write(path_found_event); } // Task is complete, so remove task component from entity @@ -698,7 +696,7 @@ pub fn check_node_reached( if executing_path.path.is_empty() { info!("the path we just swapped to was empty, so reached end of path"); - walk_events.send(StartWalkEvent { + walk_events.write(StartWalkEvent { entity, direction: WalkDirection::None, }); @@ -712,7 +710,7 @@ pub fn check_node_reached( if executing_path.path.is_empty() { debug!("pathfinder path is now empty"); - walk_events.send(StartWalkEvent { + walk_events.write(StartWalkEvent { entity, direction: WalkDirection::None, }); @@ -923,7 +921,7 @@ pub fn recalculate_near_end_of_path( "recalculate_near_end_of_path executing_path.is_path_partial: {}", executing_path.is_path_partial ); - goto_events.send(GotoEvent { + goto_events.write(GotoEvent { entity, goal, successors_fn, @@ -947,7 +945,7 @@ pub fn recalculate_near_end_of_path( info!( "the path we just swapped to was empty, so reached end of path" ); - walk_events.send(StartWalkEvent { + walk_events.write(StartWalkEvent { entity, direction: WalkDirection::None, }); @@ -955,7 +953,7 @@ pub fn recalculate_near_end_of_path( break; } } else { - walk_events.send(StartWalkEvent { + walk_events.write(StartWalkEvent { entity, direction: WalkDirection::None, }); @@ -966,7 +964,7 @@ pub fn recalculate_near_end_of_path( _ => { if executing_path.path.is_empty() { // idk when this can happen but stop moving just in case - walk_events.send(StartWalkEvent { + walk_events.write(StartWalkEvent { entity, direction: WalkDirection::None, }); @@ -1033,7 +1031,7 @@ pub fn recalculate_if_has_goal_but_no_path( if pathfinder.goal.is_some() && !pathfinder.is_calculating { if let Some(goal) = pathfinder.goal.as_ref().cloned() { debug!("Recalculating path because it has a goal but no ExecutingPath"); - goto_events.send(GotoEvent { + goto_events.write(GotoEvent { entity, goal, successors_fn: pathfinder.successors_fn.unwrap(), @@ -1081,7 +1079,7 @@ pub fn handle_stop_pathfinding_event( } if executing_path.path.is_empty() { - walk_events.send(StartWalkEvent { + walk_events.write(StartWalkEvent { entity: event.entity, direction: WalkDirection::None, }); @@ -1098,7 +1096,7 @@ pub fn stop_pathfinding_on_instance_change( if !executing_path.path.is_empty() { debug!("instance changed, clearing path"); executing_path.path.clear(); - stop_pathfinding_events.send(StopPathfindingEvent { + stop_pathfinding_events.write(StopPathfindingEvent { entity, force: true, }); diff --git a/azalea/src/pathfinder/moves/mod.rs b/azalea/src/pathfinder/moves/mod.rs index 83e6369f..150dad52 100644 --- a/azalea/src/pathfinder/moves/mod.rs +++ b/azalea/src/pathfinder/moves/mod.rs @@ -68,7 +68,7 @@ pub struct ExecuteCtx<'w1, 'w2, 'w3, 'w4, 'w5, 'w6, 'a> { impl ExecuteCtx<'_, '_, '_, '_, '_, '_, '_> { pub fn look_at(&mut self, position: Vec3) { - self.look_at_events.send(LookAtEvent { + self.look_at_events.write(LookAtEvent { entity: self.entity, position: Vec3 { x: position.x, @@ -80,28 +80,28 @@ impl ExecuteCtx<'_, '_, '_, '_, '_, '_, '_> { } pub fn look_at_exact(&mut self, position: Vec3) { - self.look_at_events.send(LookAtEvent { + self.look_at_events.write(LookAtEvent { entity: self.entity, position, }); } pub fn sprint(&mut self, direction: SprintDirection) { - self.sprint_events.send(StartSprintEvent { + self.sprint_events.write(StartSprintEvent { entity: self.entity, direction, }); } pub fn walk(&mut self, direction: WalkDirection) { - self.walk_events.send(StartWalkEvent { + self.walk_events.write(StartWalkEvent { entity: self.entity, direction, }); } pub fn jump(&mut self) { - self.jump_events.send(JumpEvent { + self.jump_events.write(JumpEvent { entity: self.entity, }); } @@ -137,7 +137,7 @@ impl ExecuteCtx<'_, '_, '_, '_, '_, '_, '_> { let best_tool_result = best_tool_in_hotbar_for_block(block_state, &self.menu); self.set_selected_hotbar_slot_events - .send(SetSelectedHotbarSlotEvent { + .write(SetSelectedHotbarSlotEvent { entity: self.entity, slot: best_tool_result.index as u8, }); @@ -146,7 +146,7 @@ impl ExecuteCtx<'_, '_, '_, '_, '_, '_, '_> { self.walk(WalkDirection::None); self.look_at_exact(block.center()); - self.start_mining_events.send(StartMiningBlockEvent { + self.start_mining_events.write(StartMiningBlockEvent { entity: self.entity, position: block, }); diff --git a/azalea/src/prelude.rs b/azalea/src/prelude.rs index 4f68f1ea..648fad6a 100644 --- a/azalea/src/prelude.rs +++ b/azalea/src/prelude.rs @@ -6,7 +6,7 @@ pub use azalea_core::tick::GameTick; // this is necessary to make the macros that reference bevy_ecs work pub use crate::ecs as bevy_ecs; -pub use crate::ecs::{component::Component, system::Resource}; +pub use crate::ecs::{component::Component, resource::Resource}; pub use crate::{ ClientBuilder, bot::BotClientExt, container::ContainerClientExt, pathfinder::PathfinderClientExt, diff --git a/azalea/src/swarm/chat.rs b/azalea/src/swarm/chat.rs index f56c1511..21db2fd8 100644 --- a/azalea/src/swarm/chat.rs +++ b/azalea/src/swarm/chat.rs @@ -20,12 +20,7 @@ use bevy_app::{App, Plugin, Update}; use bevy_ecs::prelude::Event; use super::{Swarm, SwarmEvent}; -use crate::ecs::{ - component::Component, - event::{EventReader, EventWriter}, - schedule::IntoSystemConfigs, - system::{Commands, Query, Res, ResMut, Resource}, -}; +use crate::ecs::prelude::*; #[derive(Clone)] pub struct SwarmChatPlugin; @@ -99,7 +94,7 @@ fn chat_listener( if !found { // didn't find the message, so fire the swarm event and add to the queue - new_chat_messages_events.send(NewChatMessageEvent(event.packet.clone())); + new_chat_messages_events.write(NewChatMessageEvent(event.packet.clone())); global_chat_state.chat_queue.push_back(event.packet.clone()); client_chat_index = global_chat_state.chat_queue.len() + global_chat_state.chat_min_index; diff --git a/azalea/src/swarm/events.rs b/azalea/src/swarm/events.rs index d6f69157..b8154c50 100644 --- a/azalea/src/swarm/events.rs +++ b/azalea/src/swarm/events.rs @@ -38,5 +38,5 @@ fn check_ready( // all the players are in the world, so we're ready **is_swarm_ready = true; - ready_events.send(SwarmReadyEvent); + ready_events.write(SwarmReadyEvent); } diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs index 9be5d7ea..2e33148e 100644 --- a/azalea/src/swarm/mod.rs +++ b/azalea/src/swarm/mod.rs @@ -24,7 +24,7 @@ use azalea_client::{ use azalea_protocol::{ServerAddress, resolver}; use azalea_world::InstanceContainer; use bevy_app::{App, PluginGroup, PluginGroupBuilder, Plugins}; -use bevy_ecs::{component::Component, entity::Entity, system::Resource, world::World}; +use bevy_ecs::prelude::*; use futures::future::{BoxFuture, join_all}; use parking_lot::{Mutex, RwLock}; use tokio::sync::mpsc; |
