aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/client.rs
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-07-29 16:29:06 -0500
committermat <github@matdoes.dev>2022-07-29 16:29:06 -0500
commit0c2ce00bae1d0a4711ad45f5558286dccb04b0ae (patch)
tree10caad360580b31997d949915e0ba1dadc1a1638 /azalea-client/src/client.rs
parent0f380f1a129fbba936605990959f0cf4878c36a8 (diff)
downloadazalea-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/client.rs')
-rw-r--r--azalea-client/src/client.rs8
1 files changed, 4 insertions, 4 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(