From d1afd02aa84e7b4450c1607277f078eb2a0f1bf3 Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Sun, 9 Jul 2023 19:11:29 -0500 Subject: Update to Bevy 0.11 (#94) * update to bevy 0.11 * clippy --------- Co-authored-by: mat --- azalea/src/bot.rs | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'azalea/src/bot.rs') diff --git a/azalea/src/bot.rs b/azalea/src/bot.rs index 13b33bb0..47c825ca 100644 --- a/azalea/src/bot.rs +++ b/azalea/src/bot.rs @@ -1,4 +1,4 @@ -use crate::app::{App, CoreSchedule, IntoSystemAppConfig, Plugin, PluginGroup, PluginGroupBuilder}; +use crate::app::{App, Plugin, PluginGroup, PluginGroupBuilder}; use crate::auto_respawn::AutoRespawnPlugin; use crate::container::ContainerPlugin; use crate::ecs::{ @@ -6,13 +6,15 @@ use crate::ecs::{ entity::Entity, event::EventReader, query::{With, Without}, - schedule::IntoSystemConfig, system::{Commands, Query}, }; use azalea_core::Vec3; use azalea_physics::{force_jump_listener, PhysicsSet}; use azalea_world::entity::{clamp_look_direction, EyeHeight, LookDirection}; use azalea_world::entity::{metadata::Player, Jumping, Local, Position}; +use bevy_app::{FixedUpdate, Update}; +use bevy_ecs::prelude::Event; +use bevy_ecs::schedule::IntoSystemConfigs; use std::f64::consts::PI; use crate::pathfinder::PathfinderPlugin; @@ -23,16 +25,17 @@ impl Plugin for BotPlugin { fn build(&self, app: &mut App) { app.add_event::() .add_event::() - .add_systems(( - insert_bot, - look_at_listener - .before(force_jump_listener) - .before(clamp_look_direction), - jump_listener, - stop_jumping - .in_schedule(CoreSchedule::FixedUpdate) - .after(PhysicsSet), - )); + .add_systems( + Update, + ( + insert_bot, + look_at_listener + .before(force_jump_listener) + .before(clamp_look_direction), + jump_listener, + ), + ) + .add_systems(FixedUpdate, stop_jumping.after(PhysicsSet)); } } @@ -85,6 +88,7 @@ impl BotClientExt for azalea_client::Client { } /// Event to jump once. +#[derive(Event)] pub struct JumpEvent(pub Entity); fn jump_listener(mut query: Query<(&mut Jumping, &mut Bot)>, mut events: EventReader) { @@ -97,6 +101,7 @@ fn jump_listener(mut query: Query<(&mut Jumping, &mut Bot)>, mut events: EventRe } /// Make an entity look towards a certain position in the world. +#[derive(Event)] pub struct LookAtEvent { pub entity: Entity, /// The position we want the entity to be looking at. -- cgit v1.2.3