mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
Add move_to
This commit is contained in:
parent
0280fb58e1
commit
c7b0c51274
3 changed files with 26 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
mod account;
|
mod account;
|
||||||
mod client;
|
mod client;
|
||||||
|
mod movement;
|
||||||
pub mod ping;
|
pub mod ping;
|
||||||
mod player;
|
mod player;
|
||||||
|
|
||||||
|
|
24
azalea-client/src/movement.rs
Normal file
24
azalea-client/src/movement.rs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
println!("Hello, world!");
|
println!("Hello, world!");
|
||||||
|
|
||||||
// let address = "95.111.249.143:10000";
|
// 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())
|
// let response = azalea_client::ping::ping_server(&address.try_into().unwrap())
|
||||||
// .await
|
// .await
|
||||||
// .unwrap();
|
// .unwrap();
|
||||||
|
|
Loading…
Add table
Reference in a new issue