mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
fix errors
This commit is contained in:
parent
227ba5511d
commit
1dc56b6f51
5 changed files with 17 additions and 14 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -77,6 +77,7 @@ dependencies = [
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
"trust-dns-resolver",
|
"trust-dns-resolver",
|
||||||
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -2,7 +2,7 @@ use std::collections::HashMap;
|
||||||
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Hash, Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct GameProfile {
|
pub struct GameProfile {
|
||||||
pub uuid: Uuid,
|
pub uuid: Uuid,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
|
|
@ -19,3 +19,4 @@ thiserror = "^1.0.30"
|
||||||
tokio = {version = "^1.14.0", features = ["io-util", "net", "macros"]}
|
tokio = {version = "^1.14.0", features = ["io-util", "net", "macros"]}
|
||||||
tokio-util = "^0.6.9"
|
tokio-util = "^0.6.9"
|
||||||
trust-dns-resolver = "^0.20.3"
|
trust-dns-resolver = "^0.20.3"
|
||||||
|
uuid = "^0.8.2"
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
use super::LoginPacket;
|
use super::LoginPacket;
|
||||||
use crate::mc_buf::{Readable, Writable};
|
use crate::mc_buf::{Readable, Writable};
|
||||||
use azalea_auth::game_profile::GameProfile;
|
use azalea_auth::game_profile::GameProfile;
|
||||||
use azalea_core::{resource_location::ResourceLocation, serializable_uuid::SerializableUuid};
|
use azalea_core::serializable_uuid::SerializableUuid;
|
||||||
use std::hash::Hash;
|
|
||||||
use tokio::io::BufReader;
|
use tokio::io::BufReader;
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Hash, Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct ClientboundGameProfilePacket {
|
pub struct ClientboundGameProfilePacket {
|
||||||
pub game_profile: GameProfile,
|
pub game_profile: GameProfile,
|
||||||
}
|
}
|
||||||
|
@ -25,15 +25,16 @@ impl ClientboundGameProfilePacket {
|
||||||
pub async fn read<T: tokio::io::AsyncRead + std::marker::Unpin + std::marker::Send>(
|
pub async fn read<T: tokio::io::AsyncRead + std::marker::Unpin + std::marker::Send>(
|
||||||
buf: &mut BufReader<T>,
|
buf: &mut BufReader<T>,
|
||||||
) -> Result<LoginPacket, String> {
|
) -> Result<LoginPacket, String> {
|
||||||
let uuid = SerializableUuid::from_int_array(
|
let uuid = Uuid::from_int_array([
|
||||||
buf.read_int().await?,
|
buf.read_int().await? as u32,
|
||||||
buf.read_int().await?,
|
buf.read_int().await? as u32,
|
||||||
buf.read_int().await?,
|
buf.read_int().await? as u32,
|
||||||
buf.read_int().await?,
|
buf.read_int().await? as u32,
|
||||||
);
|
]);
|
||||||
let name = buf.read_utf(16).await?;
|
let name = buf.read_utf_with_len(16).await?;
|
||||||
ClientboundGameProfilePacket {
|
Ok(ClientboundGameProfilePacket {
|
||||||
game_profile: GameProfile::new(uuid, name),
|
game_profile: GameProfile::new(uuid, name),
|
||||||
}
|
}
|
||||||
|
.get())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use tokio::io::BufReader;
|
use tokio::io::BufReader;
|
||||||
|
|
||||||
use crate::mc_buf::Readable;
|
use crate::mc_buf::{Readable, Writable};
|
||||||
|
|
||||||
use super::LoginPacket;
|
use super::LoginPacket;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ impl ClientboundLoginCompressionPacket {
|
||||||
let compression_threshold = buf.read_varint().await?;
|
let compression_threshold = buf.read_varint().await?;
|
||||||
|
|
||||||
Ok(ClientboundLoginCompressionPacket {
|
Ok(ClientboundLoginCompressionPacket {
|
||||||
compression_threshold
|
compression_threshold,
|
||||||
}
|
}
|
||||||
.get())
|
.get())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue