diff options
| author | mat <github@matdoes.dev> | 2022-06-25 16:23:40 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-06-25 16:23:40 -0500 |
| commit | 460bdfb8bbaf0969df6451a00fc3de214728aec0 (patch) | |
| tree | bc88105b401bcfc27922e70227a89a8f1ac0259a /bot | |
| parent | 77980f0018eca3a192994021b76ad5d05bff88ea (diff) | |
| download | azalea-drasl-460bdfb8bbaf0969df6451a00fc3de214728aec0.tar.xz | |
merge ClientState and Client
Diffstat (limited to 'bot')
| -rw-r--r-- | bot/src/main.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/bot/src/main.rs b/bot/src/main.rs index 2976920b..825025d4 100644 --- a/bot/src/main.rs +++ b/bot/src/main.rs @@ -6,17 +6,17 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { println!("Hello, world!"); // let address = "95.111.249.143:10000"; - let address = "localhost:65399"; + let address = "localhost:56150"; // let response = azalea_client::ping::ping_server(&address.try_into().unwrap()) // .await // .unwrap(); // println!("{}", response.description.to_ansi(None)); let account = Account::offline("bot"); - let mut client = 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) = &client.next().await { + while let Some(e) = &rx.recv().await { match e { // TODO: have a "loaded" or "ready" event that fires when all chunks are loaded Event::Login => {} @@ -40,11 +40,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { // } Event::Chat(msg) => { let new_pos = { - let state_lock = client.state.lock().unwrap(); - let world = state_lock.world.as_ref().unwrap(); - let player = &state_lock.player; + let dimension_lock = client.dimension.lock().unwrap(); + let dimension = dimension_lock.as_ref().unwrap(); + let player = client.player.lock().unwrap(); let entity = player - .entity(&world) + .entity(&dimension) .expect("Player entity is not in world"); entity.pos().add_y(0.5) }; |
