diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-12-27 22:02:00 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-27 22:02:00 -0600 |
| commit | 9513f42e87f64c409cdb2a100500a50e5a713bac (patch) | |
| tree | bb6aa8b6d50fddf967bcb1f759e023754ea84e49 /azalea-client/src/plugins/client_information.rs | |
| parent | 588902ba4a3965982bdd84d92b20c6f7613f3978 (diff) | |
| download | azalea-drasl-9513f42e87f64c409cdb2a100500a50e5a713bac.tar.xz | |
Move Client struct to azalea crate (#297)
* move the Client struct out of azalea-client into azalea
* actually add client impls in azalea
Diffstat (limited to 'azalea-client/src/plugins/client_information.rs')
| -rw-r--r-- | azalea-client/src/plugins/client_information.rs | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/azalea-client/src/plugins/client_information.rs b/azalea-client/src/plugins/client_information.rs index 98f69a2d..92b4f70a 100644 --- a/azalea-client/src/plugins/client_information.rs +++ b/azalea-client/src/plugins/client_information.rs @@ -1,13 +1,13 @@ use azalea_protocol::{ common::client_information::ClientInformation, - packets::{config::s_client_information::ServerboundClientInformation, game}, + packets::config::s_client_information::ServerboundClientInformation, }; use bevy_app::prelude::*; use bevy_ecs::prelude::*; use tracing::{debug, warn}; use super::packet::config::SendConfigPacketEvent; -use crate::{Client, brand::send_brand, packet::login::InLoginState}; +use crate::{brand::send_brand, packet::login::InLoginState}; /// Send [`ServerboundClientInformation`] on join. pub struct ClientInformationPlugin; @@ -42,36 +42,3 @@ pub fn send_client_information( )); } } - -impl Client { - /// Tell the server we changed our game options (i.e. render distance, main - /// hand). - /// - /// If this is not set before the login packet, the default will be sent. - /// - /// ```rust,no_run - /// # use azalea_client::{Client, ClientInformation}; - /// # async fn example(bot: Client) -> Result<(), Box<dyn std::error::Error>> { - /// bot.set_client_information(ClientInformation { - /// view_distance: 2, - /// ..Default::default() - /// }); - /// # Ok(()) - /// # } - /// ``` - pub fn set_client_information(&self, client_information: ClientInformation) { - self.query_self::<&mut ClientInformation, _>(|mut ci| { - *ci = client_information.clone(); - }); - - if self.logged_in() { - debug!( - "Sending client information (already logged in): {:?}", - client_information - ); - self.write_packet(game::s_client_information::ServerboundClientInformation { - client_information, - }); - } - } -} |
