From 34a40270108e51014e0884c3b6b6619ba42c17dc Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 2 Dec 2023 15:49:54 -0600 Subject: [PATCH] change protocol_version to an i32 --- .../src/packets/handshaking/client_intention_packet.rs | 2 +- azalea-protocol/src/packets/mod.rs | 2 +- codegen/lib/code/version.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/azalea-protocol/src/packets/handshaking/client_intention_packet.rs b/azalea-protocol/src/packets/handshaking/client_intention_packet.rs index 1900d4762..cac64a01e 100755 --- a/azalea-protocol/src/packets/handshaking/client_intention_packet.rs +++ b/azalea-protocol/src/packets/handshaking/client_intention_packet.rs @@ -6,7 +6,7 @@ use std::hash::Hash; #[derive(Hash, Clone, Debug, McBuf, ServerboundHandshakePacket)] pub struct ClientIntentionPacket { #[var] - pub protocol_version: u32, + pub protocol_version: i32, pub hostname: String, pub port: u16, pub intention: ConnectionProtocol, diff --git a/azalea-protocol/src/packets/mod.rs b/azalea-protocol/src/packets/mod.rs index eb902da2f..df3a2bf0e 100755 --- a/azalea-protocol/src/packets/mod.rs +++ b/azalea-protocol/src/packets/mod.rs @@ -12,7 +12,7 @@ use std::io::{Cursor, Write}; // TODO: rename the packet files to just like clientbound_add_entity instead of // clientbound_add_entity_packet -pub const PROTOCOL_VERSION: u32 = 764; +pub const PROTOCOL_VERSION: i32 = 764; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum ConnectionProtocol { diff --git a/codegen/lib/code/version.py b/codegen/lib/code/version.py index 35779af6c..6365d6cf9 100755 --- a/codegen/lib/code/version.py +++ b/codegen/lib/code/version.py @@ -35,7 +35,7 @@ def set_version_id(version_id: str) -> None: def get_protocol_version() -> str: # azalea-protocol/src/packets/mod.rs - # pub const PROTOCOL_VERSION: u32 = 758; + # pub const PROTOCOL_VERSION: i32 = 758; with open(get_dir_location('../azalea-protocol/src/packets/mod.rs'), 'r') as f: mod_rs = f.read().splitlines() for line in mod_rs: @@ -50,7 +50,7 @@ def set_protocol_version(protocol_version: str) -> None: mod_rs = f.read().splitlines() for i, line in enumerate(mod_rs): if line.strip().startswith('pub const PROTOCOL_VERSION'): - mod_rs[i] = f'pub const PROTOCOL_VERSION: u32 = {protocol_version};' + mod_rs[i] = f'pub const PROTOCOL_VERSION: i32 = {protocol_version};' break else: raise Exception(