diff options
| author | mat <git@matdoes.dev> | 2023-08-25 23:28:19 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-08-25 23:28:19 -0500 |
| commit | 472496b7b808b4c6ac6f8e161a5bc1d08f5b0524 (patch) | |
| tree | b839d9c63829c3e215940f05cdcf0b17cd226300 /azalea/src | |
| parent | 2773146fbfd9b61c0ea09210b6d7b9760be5e7dc (diff) | |
| download | azalea-drasl-472496b7b808b4c6ac6f8e161a5bc1d08f5b0524.tar.xz | |
fix all bevy ambiguities
Diffstat (limited to 'azalea/src')
| -rw-r--r-- | azalea/src/auto_respawn.rs | 9 | ||||
| -rw-r--r-- | azalea/src/bot.rs | 11 | ||||
| -rw-r--r-- | azalea/src/pathfinder/mod.rs | 13 |
3 files changed, 23 insertions, 10 deletions
diff --git a/azalea/src/auto_respawn.rs b/azalea/src/auto_respawn.rs index 77a75b4b..7034c86b 100644 --- a/azalea/src/auto_respawn.rs +++ b/azalea/src/auto_respawn.rs @@ -1,5 +1,5 @@ use crate::app::{App, Plugin}; -use azalea_client::packet_handling::DeathEvent; +use azalea_client::packet_handling::{death_event_on_0_health, DeathEvent}; use azalea_client::respawn::{perform_respawn, PerformRespawnEvent}; use bevy_app::Update; use bevy_ecs::prelude::*; @@ -9,7 +9,12 @@ use bevy_ecs::prelude::*; pub struct AutoRespawnPlugin; impl Plugin for AutoRespawnPlugin { fn build(&self, app: &mut App) { - app.add_systems(Update, auto_respawn.before(perform_respawn)); + app.add_systems( + Update, + auto_respawn + .before(perform_respawn) + .after(death_event_on_0_health), + ); } } diff --git a/azalea/src/bot.rs b/azalea/src/bot.rs index 40ab4124..10bf1161 100644 --- a/azalea/src/bot.rs +++ b/azalea/src/bot.rs @@ -15,7 +15,7 @@ use azalea_core::{BlockPos, Vec3}; use azalea_entity::{ clamp_look_direction, metadata::Player, EyeHeight, Jumping, Local, LookDirection, Position, }; -use azalea_physics::{force_jump_listener, PhysicsSet}; +use azalea_physics::{handle_force_jump, PhysicsSet}; use bevy_app::{FixedUpdate, Update}; use bevy_ecs::prelude::Event; use bevy_ecs::schedule::IntoSystemConfigs; @@ -35,9 +35,9 @@ impl Plugin for BotPlugin { ( insert_bot, look_at_listener - .before(force_jump_listener) + .before(handle_force_jump) .before(clamp_look_direction), - jump_listener, + jump_listener.before(handle_force_jump), ), ) .add_systems(FixedUpdate, stop_jumping.after(PhysicsSet)); @@ -138,7 +138,10 @@ impl BotClientExt for azalea_client::Client { #[derive(Event)] pub struct JumpEvent(pub Entity); -fn jump_listener(mut query: Query<(&mut Jumping, &mut Bot)>, mut events: EventReader<JumpEvent>) { +pub fn jump_listener( + mut query: Query<(&mut Jumping, &mut Bot)>, + mut events: EventReader<JumpEvent>, +) { for event in events.iter() { if let Ok((mut jumping, mut bot)) = query.get_mut(event.0) { **jumping = true; diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs index ae88b0cc..03a75599 100644 --- a/azalea/src/pathfinder/mod.rs +++ b/azalea/src/pathfinder/mod.rs @@ -16,6 +16,7 @@ use crate::ecs::{ system::{Commands, Query, Res}, }; use astar::Edge; +use azalea_client::movement::walk_listener; use azalea_client::{StartSprintEvent, StartWalkEvent}; use azalea_core::{BlockPos, CardinalDirection}; use azalea_entity::metadata::Player; @@ -43,16 +44,20 @@ impl Plugin for PathfinderPlugin { FixedUpdate, // putting systems in the FixedUpdate schedule makes them run every Minecraft tick // (every 50 milliseconds). - tick_execute_path.after(PhysicsSet), + tick_execute_path + .after(PhysicsSet) + .after(azalea_client::movement::send_position), ) .add_systems(PreUpdate, add_default_pathfinder) .add_systems( Update, ( goto_listener, - (handle_tasks, path_found_listener).chain(), - stop_pathfinding_on_instance_change, - ), + handle_tasks, + path_found_listener, + stop_pathfinding_on_instance_change.before(walk_listener), + ) + .chain(), ); } } |
