aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-protocol')
-rwxr-xr-xazalea-protocol/Cargo.toml7
-rwxr-xr-xazalea-protocol/src/packets/mod.rs16
2 files changed, 15 insertions, 8 deletions
diff --git a/azalea-protocol/Cargo.toml b/azalea-protocol/Cargo.toml
index 899b44a8..d98705bd 100755
--- a/azalea-protocol/Cargo.toml
+++ b/azalea-protocol/Cargo.toml
@@ -17,13 +17,10 @@ azalea-nbt = {path = "../azalea-nbt"}
byteorder = "^1.4.3"
bytes = "^1.1.0"
flate2 = "1.0.23"
-num-derive = "^0.3.3"
-num-traits = "^0.2.14"
packet-macros = {path = "./packet-macros"}
serde = {version = "1.0.130", features = ["serde_derive"]}
serde_json = "^1.0.72"
-thiserror = "^1.0.30"
-tokio = {version = "^1.14.0", features = ["io-util", "net", "macros"]}
+tokio = {version = "1.19.2", features = ["io-util", "net", "macros"]}
tokio-util = "^0.6.9"
trust-dns-resolver = "^0.20.3"
-uuid = "^0.8.2"
+uuid = "^1.1.2"
diff --git a/azalea-protocol/src/packets/mod.rs b/azalea-protocol/src/packets/mod.rs
index 1cc79b79..73a3a842 100755
--- a/azalea-protocol/src/packets/mod.rs
+++ b/azalea-protocol/src/packets/mod.rs
@@ -9,12 +9,10 @@ use crate::{
connect::PacketFlow,
mc_buf::{McBufReadable, McBufWritable, Readable, Writable},
};
-use num_derive::FromPrimitive;
-use num_traits::FromPrimitive;
pub const PROTOCOL_VERSION: u32 = 759;
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, FromPrimitive)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ConnectionProtocol {
Handshake = -1,
Game = 0,
@@ -22,6 +20,18 @@ pub enum ConnectionProtocol {
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)]
pub enum Packet {
Game(game::GamePacket),