diff options
| author | mat <github@matdoes.dev> | 2022-09-05 01:04:16 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-09-05 01:04:16 -0500 |
| commit | 9ca95194696f8e9ef3ca84420f5d3b5082ff70ca (patch) | |
| tree | 4f65aec60b121bbd7ed4fa4b1436b98e301d43ba /bot | |
| parent | 4f00ddace08bd5ad17500a405f55554dff343be7 (diff) | |
| download | azalea-drasl-9ca95194696f8e9ef3ca84420f5d3b5082ff70ca.tar.xz | |
.walk :)
Diffstat (limited to 'bot')
| -rw-r--r-- | bot/src/main.rs | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/bot/src/main.rs b/bot/src/main.rs index 0b49f30b..f9977d99 100644 --- a/bot/src/main.rs +++ b/bot/src/main.rs @@ -1,5 +1,5 @@ #![allow(unused_variables, unused_imports)] -use azalea_client::{Account, Event}; +use azalea_client::{Account, Event, MoveDirection}; use azalea_core::{PositionXYZ, Vec3}; use azalea_physics::collision::{HasCollision, MoverType}; @@ -15,7 +15,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { // println!("{}", response.description.to_ansi(None)); let account = Account::offline("bot"); - let (client, mut rx) = account.join(&address.try_into().unwrap()).await.unwrap(); + let (mut client, mut rx) = account.join(&address.try_into().unwrap()).await.unwrap(); println!("connected"); while let Some(e) = &rx.recv().await { @@ -41,6 +41,33 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { // // } // } Event::Chat(m) => { + let message = m.message().to_string(); + println!("{}", message); + + match &message[..] { + "stop" => { + println!("stopping"); + client.walk(MoveDirection::None); + } + "forward" => { + println!("moving forward"); + client.walk(MoveDirection::Forward); + } + "backward" => { + println!("moving backward"); + client.walk(MoveDirection::Backward); + } + "left" => { + println!("moving left"); + client.walk(MoveDirection::Left); + } + "right" => { + println!("moving right"); + client.walk(MoveDirection::Right); + } + _ => {} + } + // let new_pos = { // let dimension_lock = client.dimension.lock().unwrap(); // let player = client.player.lock().unwrap(); |
