diff options
| author | mat <github@matdoes.dev> | 2022-07-29 16:29:06 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-07-29 16:29:06 -0500 |
| commit | 0c2ce00bae1d0a4711ad45f5558286dccb04b0ae (patch) | |
| tree | 10caad360580b31997d949915e0ba1dadc1a1638 /azalea-client/src | |
| parent | 0f380f1a129fbba936605990959f0cf4878c36a8 (diff) | |
| download | azalea-drasl-0c2ce00bae1d0a4711ad45f5558286dccb04b0ae.tar.xz | |
make Connection a single struct with generics
This isn't that good of a solution but I couldn't come up with a better one and this was pretty simple to implement
Diffstat (limited to 'azalea-client/src')
| -rw-r--r-- | azalea-client/src/client.rs | 8 | ||||
| -rwxr-xr-x | azalea-client/src/ping.rs | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs index f5dfdf98..28154bce 100644 --- a/azalea-client/src/client.rs +++ b/azalea-client/src/client.rs @@ -3,7 +3,7 @@ use azalea_auth::game_profile::GameProfile; use azalea_core::{ChunkPos, EntityPos, PositionDelta, PositionDeltaTrait, ResourceLocation}; use azalea_entity::Entity; use azalea_protocol::{ - connect::{GameConnection, HandshakeConnection}, + connect::Connection, packets::{ game::{ clientbound_player_chat_packet::ClientboundPlayerChatPacket, @@ -12,7 +12,7 @@ use azalea_protocol::{ serverbound_custom_payload_packet::ServerboundCustomPayloadPacket, serverbound_keep_alive_packet::ServerboundKeepAlivePacket, serverbound_move_player_packet_pos_rot::ServerboundMovePlayerPacketPosRot, - ClientboundGamePacket, + ClientboundGamePacket, ServerboundGamePacket, }, handshake::client_intention_packet::ClientIntentionPacket, login::{ @@ -61,7 +61,7 @@ pub enum ChatPacket { #[derive(Clone)] pub struct Client { game_profile: GameProfile, - pub conn: Arc<tokio::sync::Mutex<GameConnection>>, + pub conn: Arc<tokio::sync::Mutex<Connection<ClientboundGamePacket, ServerboundGamePacket>>>, pub player: Arc<Mutex<Player>>, pub dimension: Arc<Mutex<Option<Dimension>>>, // game_loop @@ -81,7 +81,7 @@ impl Client { ) -> Result<(Self, UnboundedReceiver<Event>), String> { let resolved_address = resolver::resolve_address(address).await?; - let mut conn = HandshakeConnection::new(&resolved_address).await?; + let mut conn = Connection::new(&resolved_address).await?; // handshake conn.write( diff --git a/azalea-client/src/ping.rs b/azalea-client/src/ping.rs index c4ef2915..e4acfc34 100755 --- a/azalea-client/src/ping.rs +++ b/azalea-client/src/ping.rs @@ -1,6 +1,6 @@ ///! Ping Minecraft servers. use azalea_protocol::{ - connect::HandshakeConnection, + connect::Connection, packets::{ handshake::client_intention_packet::ClientIntentionPacket, status::{ @@ -18,7 +18,7 @@ pub async fn ping_server( ) -> Result<ClientboundStatusResponsePacket, String> { let resolved_address = resolver::resolve_address(address).await?; - let mut conn = HandshakeConnection::new(&resolved_address).await?; + let mut conn = Connection::new(&resolved_address).await?; // send the client intention packet and switch to the status state conn.write( |
