aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2022-06-25 05:08:22 +0000
committerGitHub <noreply@github.com>2022-06-25 05:08:22 +0000
commitca7067e173129f3044ebc8c77634f06da29a086e (patch)
tree2dcfe72bf09a42f6614f9dc988dc0254162ea0bf /azalea-protocol
parenta0b3b793f9f631a85f243271531640f07490c4ca (diff)
parent69c47eda4c496b13dadd80976bffd2fab7ea5894 (diff)
downloadazalea-drasl-ca7067e173129f3044ebc8c77634f06da29a086e.tar.xz
Merge branch 'main' into azalea-entity
Diffstat (limited to 'azalea-protocol')
-rwxr-xr-xazalea-protocol/Cargo.toml6
-rwxr-xr-xazalea-protocol/src/packets/mod.rs14
2 files changed, 15 insertions, 5 deletions
diff --git a/azalea-protocol/Cargo.toml b/azalea-protocol/Cargo.toml
index 280879dd..17884a51 100755
--- a/azalea-protocol/Cargo.toml
+++ b/azalea-protocol/Cargo.toml
@@ -7,7 +7,7 @@ version = "0.1.0"
[dependencies]
async-compression = {version = "^0.3.8", features = ["tokio", "zlib"], optional = true}
-async-recursion = "^0.3.2"
+async-recursion = "1.0.0"
azalea-auth = {path = "../azalea-auth"}
azalea-brigadier = {path = "../azalea-brigadier"}
azalea-buf = {path = "../azalea-buf"}
@@ -19,8 +19,6 @@ 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"
@@ -28,7 +26,7 @@ thiserror = "^1.0.30"
tokio = {version = "^1.19.2", features = ["io-util", "net", "macros"]}
tokio-util = "^0.6.9"
trust-dns-resolver = "^0.20.3"
-uuid = "^1.1.2"
+uuid = "1.1.2"
[features]
connecting = []
diff --git a/azalea-protocol/src/packets/mod.rs b/azalea-protocol/src/packets/mod.rs
index 738baa09..b9116228 100755
--- a/azalea-protocol/src/packets/mod.rs
+++ b/azalea-protocol/src/packets/mod.rs
@@ -11,7 +11,7 @@ use std::io::{Read, Write};
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,
@@ -19,6 +19,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),