diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2022-07-07 05:58:44 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-07 05:58:44 +0000 |
| commit | 31e5629ce1c8267802bbcb9d03b60a299d474e59 (patch) | |
| tree | 5968b48af9b0c30149e908b043966c41dda0a61d /bot/src | |
| parent | 27edd4f578e7b64fdaacefa26f691e2148707a8c (diff) | |
| parent | 37d854c799236650da3deb025d8b32693531a27f (diff) | |
| download | azalea-drasl-31e5629ce1c8267802bbcb9d03b60a299d474e59.tar.xz | |
Merge branch 'main' into 1.19.1
Diffstat (limited to 'bot/src')
| -rw-r--r-- | bot/src/main.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/bot/src/main.rs b/bot/src/main.rs index 2976920b..3ff30908 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 => {} @@ -38,13 +38,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { // // println!("block state: {:?}", c); // // } // } - Event::Chat(msg) => { + Event::Chat(_m) => { 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) }; |
