1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

Add move_to

This commit is contained in:
mat 2022-06-21 23:19:31 -05:00
parent 0280fb58e1
commit c7b0c51274
3 changed files with 26 additions and 1 deletions

View file

@ -2,6 +2,7 @@
mod account;
mod client;
mod movement;
pub mod ping;
mod player;

View file

@ -0,0 +1,24 @@
use azalea_core::EntityPos;
use crate::Client;
use azalea_protocol::packets::game::serverbound_move_player_packet_pos_rot::ServerboundMovePlayerPacketPosRot;
impl Client {
/// Set the client's position to the given coordinates.
pub async fn move_to(&mut self, pos: &EntityPos) {
self.conn
.lock()
.await
.write(
ServerboundMovePlayerPacketPosRot {
x: pos.x,
y: pos.y,
z: pos.z,
x_rot: 0.0,
y_rot: 0.0,
on_ground: false,
}
.get(),
)
.await;
}
}

View file

@ -6,7 +6,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Hello, world!");
// let address = "95.111.249.143:10000";
let address = "localhost:59021";
let address = "localhost:57172";
// let response = azalea_client::ping::ping_server(&address.try_into().unwrap())
// .await
// .unwrap();