From f364ad6b210f93f53b6ee8f73c259622e9f37421 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 28 Nov 2024 20:33:39 +0000 Subject: [PATCH] switch some packet structs to unit structs --- azalea-protocol/src/connect.rs | 9 ++++++++- .../src/packets/config/c_finish_configuration.rs | 2 +- .../src/packets/config/s_finish_configuration.rs | 2 +- .../src/packets/game/c_chunk_batch_start.rs | 2 +- azalea-protocol/src/packets/game/c_player_chat.rs | 10 ---------- .../src/packets/game/c_player_combat_enter.rs | 2 +- .../src/packets/game/c_start_configuration.rs | 2 +- azalea-protocol/src/packets/game/s_client_tick_end.rs | 2 +- .../src/packets/game/s_configuration_acknowledged.rs | 2 +- .../src/packets/login/s_login_acknowledged.rs | 2 +- azalea-protocol/src/packets/status/s_status_request.rs | 2 +- azalea/src/auto_tool.rs | 2 +- 12 files changed, 18 insertions(+), 21 deletions(-) diff --git a/azalea-protocol/src/connect.rs b/azalea-protocol/src/connect.rs index f64d9eb8..f33ce2a5 100755 --- a/azalea-protocol/src/connect.rs +++ b/azalea-protocol/src/connect.rs @@ -61,6 +61,7 @@ pub struct WriteConnection { /// resolver, /// connect::Connection, /// packets::{ +/// self, /// ClientIntention, PROTOCOL_VERSION, /// login::{ /// ClientboundLoginPacket, @@ -115,7 +116,13 @@ pub struct WriteConnection { /// return Err("login disconnect".into()); /// } /// ClientboundLoginPacket::CustomQuery(p) => {} -/// ClientboundLoginPacket::CookieRequest(_) => {} +/// ClientboundLoginPacket::CookieRequest(p) => { +/// conn.write(packets::login::ServerboundCookieResponse { +/// key: p.key, +/// payload: None, +/// }) +/// .await?; +/// } /// } /// }; /// diff --git a/azalea-protocol/src/packets/config/c_finish_configuration.rs b/azalea-protocol/src/packets/config/c_finish_configuration.rs index e3f3e5a5..ea6e6d27 100644 --- a/azalea-protocol/src/packets/config/c_finish_configuration.rs +++ b/azalea-protocol/src/packets/config/c_finish_configuration.rs @@ -2,4 +2,4 @@ use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundConfigPacket; #[derive(Clone, Debug, AzBuf, ClientboundConfigPacket)] -pub struct ClientboundFinishConfiguration {} +pub struct ClientboundFinishConfiguration; diff --git a/azalea-protocol/src/packets/config/s_finish_configuration.rs b/azalea-protocol/src/packets/config/s_finish_configuration.rs index a4d94fb1..dc7d4316 100644 --- a/azalea-protocol/src/packets/config/s_finish_configuration.rs +++ b/azalea-protocol/src/packets/config/s_finish_configuration.rs @@ -2,4 +2,4 @@ use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundConfigPacket; #[derive(Clone, Debug, AzBuf, ServerboundConfigPacket)] -pub struct ServerboundFinishConfiguration {} +pub struct ServerboundFinishConfiguration; diff --git a/azalea-protocol/src/packets/game/c_chunk_batch_start.rs b/azalea-protocol/src/packets/game/c_chunk_batch_start.rs index 8b0555dc..b5cd1ba2 100644 --- a/azalea-protocol/src/packets/game/c_chunk_batch_start.rs +++ b/azalea-protocol/src/packets/game/c_chunk_batch_start.rs @@ -2,4 +2,4 @@ use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] -pub struct ClientboundChunkBatchStart {} +pub struct ClientboundChunkBatchStart; diff --git a/azalea-protocol/src/packets/game/c_player_chat.rs b/azalea-protocol/src/packets/game/c_player_chat.rs index 0e9960f2..3628fa95 100644 --- a/azalea-protocol/src/packets/game/c_player_chat.rs +++ b/azalea-protocol/src/packets/game/c_player_chat.rs @@ -88,16 +88,6 @@ pub struct MessageSignatureCache { pub entries: Vec>, } -// impl MessageSignatureCache { -// pub fn unpacker(&self) -> impl Fn(u32) -> Option { - -// } -// } - -// impl PackedSignedMessageBody { -// pub fn unpack(&self, unpacker: impl Fn(u32) -> Option) -// {} } - impl ClientboundPlayerChat { /// Returns the content of the message. If you want to get the FormattedText /// for the whole message including the sender part, use diff --git a/azalea-protocol/src/packets/game/c_player_combat_enter.rs b/azalea-protocol/src/packets/game/c_player_combat_enter.rs index 8c344b49..ee58e277 100755 --- a/azalea-protocol/src/packets/game/c_player_combat_enter.rs +++ b/azalea-protocol/src/packets/game/c_player_combat_enter.rs @@ -3,4 +3,4 @@ use azalea_protocol_macros::ClientboundGamePacket; /// Unused in vanilla. #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] -pub struct ClientboundPlayerCombatEnter {} +pub struct ClientboundPlayerCombatEnter; diff --git a/azalea-protocol/src/packets/game/c_start_configuration.rs b/azalea-protocol/src/packets/game/c_start_configuration.rs index 6955b70d..d1c60d5e 100644 --- a/azalea-protocol/src/packets/game/c_start_configuration.rs +++ b/azalea-protocol/src/packets/game/c_start_configuration.rs @@ -2,4 +2,4 @@ use azalea_buf::AzBuf; use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] -pub struct ClientboundStartConfiguration {} +pub struct ClientboundStartConfiguration; diff --git a/azalea-protocol/src/packets/game/s_client_tick_end.rs b/azalea-protocol/src/packets/game/s_client_tick_end.rs index d8d93049..221525ec 100644 --- a/azalea-protocol/src/packets/game/s_client_tick_end.rs +++ b/azalea-protocol/src/packets/game/s_client_tick_end.rs @@ -2,4 +2,4 @@ use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundGamePacket; #[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] -pub struct ServerboundClientTickEnd {} +pub struct ServerboundClientTickEnd; diff --git a/azalea-protocol/src/packets/game/s_configuration_acknowledged.rs b/azalea-protocol/src/packets/game/s_configuration_acknowledged.rs index 58e27abb..3e137494 100644 --- a/azalea-protocol/src/packets/game/s_configuration_acknowledged.rs +++ b/azalea-protocol/src/packets/game/s_configuration_acknowledged.rs @@ -2,4 +2,4 @@ use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundGamePacket; #[derive(Clone, Debug, AzBuf, ServerboundGamePacket)] -pub struct ServerboundConfigurationAcknowledged {} +pub struct ServerboundConfigurationAcknowledged; diff --git a/azalea-protocol/src/packets/login/s_login_acknowledged.rs b/azalea-protocol/src/packets/login/s_login_acknowledged.rs index e36648b6..263d58c6 100644 --- a/azalea-protocol/src/packets/login/s_login_acknowledged.rs +++ b/azalea-protocol/src/packets/login/s_login_acknowledged.rs @@ -2,4 +2,4 @@ use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundLoginPacket; #[derive(Clone, Debug, AzBuf, ServerboundLoginPacket)] -pub struct ServerboundLoginAcknowledged {} +pub struct ServerboundLoginAcknowledged; diff --git a/azalea-protocol/src/packets/status/s_status_request.rs b/azalea-protocol/src/packets/status/s_status_request.rs index 662d74bf..53fdbcaa 100755 --- a/azalea-protocol/src/packets/status/s_status_request.rs +++ b/azalea-protocol/src/packets/status/s_status_request.rs @@ -2,4 +2,4 @@ use azalea_buf::AzBuf; use azalea_protocol_macros::ServerboundStatusPacket; #[derive(Clone, Debug, AzBuf, ServerboundStatusPacket)] -pub struct ServerboundStatusRequest {} +pub struct ServerboundStatusRequest; diff --git a/azalea/src/auto_tool.rs b/azalea/src/auto_tool.rs index 1824e13c..5fcb8037 100644 --- a/azalea/src/auto_tool.rs +++ b/azalea/src/auto_tool.rs @@ -2,7 +2,7 @@ use azalea_block::{Block, BlockState}; use azalea_client::{inventory::Inventory, Client}; use azalea_entity::{FluidOnEyes, Physics}; use azalea_inventory::{components, ItemStack, Menu}; -use azalea_registry::{DataComponentKind, Fluid}; +use azalea_registry::Fluid; #[derive(Debug)] pub struct BestToolResult {