diff options
| author | mat <github@matdoes.dev> | 2022-06-21 23:19:31 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-06-21 23:19:31 -0500 |
| commit | c7b0c51274b5d8548c8a2f829b75dfbec4038be2 (patch) | |
| tree | 0388b5e4eb54b355b1738b85e7ca13139078f9be /azalea-client/src/movement.rs | |
| parent | 0280fb58e1c2ae4194543f318c9b88584a20039c (diff) | |
| download | azalea-drasl-c7b0c51274b5d8548c8a2f829b75dfbec4038be2.tar.xz | |
Add move_to
Diffstat (limited to 'azalea-client/src/movement.rs')
| -rw-r--r-- | azalea-client/src/movement.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/azalea-client/src/movement.rs b/azalea-client/src/movement.rs new file mode 100644 index 00000000..9f5cd27c --- /dev/null +++ b/azalea-client/src/movement.rs @@ -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; + } +} |
