diff options
Diffstat (limited to 'bot')
| -rw-r--r-- | bot/src/main.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/bot/src/main.rs b/bot/src/main.rs index bfcba7f5..6b318157 100644 --- a/bot/src/main.rs +++ b/bot/src/main.rs @@ -1,7 +1,7 @@ use azalea_client::{Account, Event}; #[tokio::main] -async fn main() { +async fn main() -> Result<(), Box<dyn std::error::Error>> { println!("Hello, world!"); // let address = "95.111.249.143:10000"; @@ -15,18 +15,18 @@ async fn main() { let mut client = account.join(&address.try_into().unwrap()).await.unwrap(); println!("connected"); - while let Some(e) = client.next().await { + while let Some(e) = &client.next().await { match e { // TODO: have a "loaded" or "ready" event that fires when all chunks are loaded Event::Login => {} Event::Chat(_p) => { - let state = client.state.lock().await; + let state = &client.state.lock()?; let world = state.world.as_ref().unwrap(); - println!("{:?}", world.entities); + println!("{:?}", world); // world.get_block_state(state.player.entity.pos); // println!("{}", p.message.to_ansi(None)); // if p.message.to_ansi(None) == "<py5> ok" { - // let state = client.state.lock().await; + // let state = client.state.lock(); // let world = state.world.as_ref().unwrap(); // let c = world.get_block_state(&BlockPos::new(5, 78, -2)).unwrap(); // println!("block state: {:?}", c); @@ -36,4 +36,6 @@ async fn main() { } println!("done"); + + Ok(()) } |
