1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00

Upgrade crates and remove num_* deps

This commit is contained in:
mat 2022-06-24 03:50:19 -05:00
parent 1bee59651f
commit 3fcbfc794e
8 changed files with 22 additions and 18 deletions

7
Cargo.lock generated
View file

@ -167,12 +167,9 @@ dependencies = [
"byteorder", "byteorder",
"bytes", "bytes",
"flate2", "flate2",
"num-derive",
"num-traits",
"packet-macros", "packet-macros",
"serde", "serde",
"serde_json", "serde_json",
"thiserror",
"tokio", "tokio",
"tokio-util", "tokio-util",
"trust-dns-resolver", "trust-dns-resolver",
@ -1420,9 +1417,9 @@ dependencies = [
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "0.8.2" version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f"
[[package]] [[package]]
name = "version_check" name = "version_check"

View file

@ -6,4 +6,4 @@ version = "0.1.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
uuid = "^0.8.2" uuid = "^1.1.2"

View file

@ -11,4 +11,4 @@ azalea-core = {path = "../azalea-core"}
azalea-crypto = {path = "../azalea-crypto"} azalea-crypto = {path = "../azalea-crypto"}
azalea-protocol = {path = "../azalea-protocol"} azalea-protocol = {path = "../azalea-protocol"}
azalea-world = {path = "../azalea-world"} azalea-world = {path = "../azalea-world"}
tokio = {version = "1.18.0", features = ["sync"]} tokio = {version = "1.19.2", features = ["sync"]}

View file

@ -8,4 +8,4 @@ version = "0.1.0"
[dependencies] [dependencies]
azalea-chat = {path = "../azalea-chat"} azalea-chat = {path = "../azalea-chat"}
azalea-nbt = {path = "../azalea-nbt"} azalea-nbt = {path = "../azalea-nbt"}
uuid = "^0.8.2" uuid = "^1.1.2"

View file

@ -9,4 +9,4 @@ version = "0.1.0"
lazy_static = "1.4.0" lazy_static = "1.4.0"
serde = "1.0.137" serde = "1.0.137"
serde_json = "1.0.81" serde_json = "1.0.81"
# tokio = {version = "1.18.2", features = ["fs"]} # tokio = {version = "1.19.2", features = ["fs"]}

View file

@ -17,13 +17,10 @@ azalea-nbt = {path = "../azalea-nbt"}
byteorder = "^1.4.3" byteorder = "^1.4.3"
bytes = "^1.1.0" bytes = "^1.1.0"
flate2 = "1.0.23" flate2 = "1.0.23"
num-derive = "^0.3.3"
num-traits = "^0.2.14"
packet-macros = {path = "./packet-macros"} packet-macros = {path = "./packet-macros"}
serde = {version = "1.0.130", features = ["serde_derive"]} serde = {version = "1.0.130", features = ["serde_derive"]}
serde_json = "^1.0.72" serde_json = "^1.0.72"
thiserror = "^1.0.30" tokio = {version = "1.19.2", 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" uuid = "^1.1.2"

View file

@ -9,12 +9,10 @@ use crate::{
connect::PacketFlow, connect::PacketFlow,
mc_buf::{McBufReadable, McBufWritable, Readable, Writable}, mc_buf::{McBufReadable, McBufWritable, Readable, Writable},
}; };
use num_derive::FromPrimitive;
use num_traits::FromPrimitive;
pub const PROTOCOL_VERSION: u32 = 759; pub const PROTOCOL_VERSION: u32 = 759;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, FromPrimitive)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ConnectionProtocol { pub enum ConnectionProtocol {
Handshake = -1, Handshake = -1,
Game = 0, Game = 0,
@ -22,6 +20,18 @@ pub enum ConnectionProtocol {
Login = 2, Login = 2,
} }
impl ConnectionProtocol {
pub fn from_i32(i: i32) -> Option<Self> {
match i {
-1 => Some(ConnectionProtocol::Handshake),
0 => Some(ConnectionProtocol::Game),
1 => Some(ConnectionProtocol::Status),
2 => Some(ConnectionProtocol::Login),
_ => None,
}
}
}
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum Packet { pub enum Packet {
Game(game::GamePacket), Game(game::GamePacket),

View file

@ -9,4 +9,4 @@ version = "0.1.0"
azalea-client = {path = "../azalea-client"} azalea-client = {path = "../azalea-client"}
azalea-core = {path = "../azalea-core"} azalea-core = {path = "../azalea-core"}
azalea-protocol = {path = "../azalea-protocol"} azalea-protocol = {path = "../azalea-protocol"}
tokio = "^1.14.0" tokio = "1.19.2"