diff options
| author | mat <git@matdoes.dev> | 2023-08-26 03:08:35 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-08-26 03:08:35 -0500 |
| commit | 5d7669f72b02c749a02bf034d382028e62509540 (patch) | |
| tree | 6864b77872caaf517422fce0f1f449d32cb61166 /azalea/src/bot.rs | |
| parent | ac1522db544a8e9deb84fd9a6a3ef75576420af2 (diff) | |
| download | azalea-drasl-5d7669f72b02c749a02bf034d382028e62509540.tar.xz | |
simplify pathfinder
Diffstat (limited to 'azalea/src/bot.rs')
| -rw-r--r-- | azalea/src/bot.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/azalea/src/bot.rs b/azalea/src/bot.rs index 10bf1161..3f56555a 100644 --- a/azalea/src/bot.rs +++ b/azalea/src/bot.rs @@ -87,7 +87,9 @@ pub trait BotClientExt { impl BotClientExt for azalea_client::Client { fn jump(&mut self) { let mut ecs = self.ecs.lock(); - ecs.send_event(JumpEvent(self.entity)); + ecs.send_event(JumpEvent { + entity: self.entity, + }); } fn look_at(&mut self, position: Vec3) { @@ -136,14 +138,16 @@ impl BotClientExt for azalea_client::Client { /// Event to jump once. #[derive(Event)] -pub struct JumpEvent(pub Entity); +pub struct JumpEvent { + pub entity: Entity, +} 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) { + if let Ok((mut jumping, mut bot)) = query.get_mut(event.entity) { **jumping = true; bot.jumping_once = true; } |
