From 51fbbaaf6fc8afb5ac8e13c14ad1df31b95ab64b Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 26 May 2022 17:59:43 -0500 Subject: [PATCH] Compiles --- azalea-protocol/packet-macros/src/lib.rs | 2 +- .../game/clientbound_declare_commands_packet.rs | 16 ++++++++-------- .../src/packets/login/serverbound_key_packet.rs | 5 +---- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/azalea-protocol/packet-macros/src/lib.rs b/azalea-protocol/packet-macros/src/lib.rs index ae0fea0c..927e783b 100755 --- a/azalea-protocol/packet-macros/src/lib.rs +++ b/azalea-protocol/packet-macros/src/lib.rs @@ -56,7 +56,7 @@ fn create_impl_mcbufreadable(ident: &Ident, data: &Data) -> proc_macro2::TokenSt } syn::Data::Enum(syn::DataEnum { variants, .. }) => { let mut match_contents = quote!(); - let mut variant_discrim: usize = 0; + let mut variant_discrim: u32 = 0; for variant in variants { let variant_name = &variant.ident; match &variant.discriminant.as_ref() { diff --git a/azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs b/azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs index 01f633f4..5617b0c4 100755 --- a/azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs @@ -111,7 +111,7 @@ impl McBufWritable for BrigadierString { } } -#[derive(Debug, Clone, McBuf)] +#[derive(Debug, Clone, Copy, McBuf)] pub enum BrigadierParserType { Bool = 0, Double, @@ -236,13 +236,13 @@ impl McBufReadable for BrigadierParser { BrigadierParserType::String => { Ok(BrigadierParser::String(BrigadierString::read_into(buf)?)) } - BrigadierParserType::Entity { - single, - players_only, - } => Ok(BrigadierParser::Entity { - single, - players_only, - }), + BrigadierParserType::Entity => { + let flags = buf.read_byte()?; + Ok(BrigadierParser::Entity { + single: flags & 0x01 != 0, + players_only: flags & 0x02 != 0, + }) + } BrigadierParserType::GameProfile => Ok(BrigadierParser::GameProfile), BrigadierParserType::BlockPos => Ok(BrigadierParser::BlockPos), BrigadierParserType::ColumnPos => Ok(BrigadierParser::ColumnPos), diff --git a/azalea-protocol/src/packets/login/serverbound_key_packet.rs b/azalea-protocol/src/packets/login/serverbound_key_packet.rs index 2c970036..d57b122a 100644 --- a/azalea-protocol/src/packets/login/serverbound_key_packet.rs +++ b/azalea-protocol/src/packets/login/serverbound_key_packet.rs @@ -1,9 +1,6 @@ use azalea_crypto::SaltSignaturePair; use packet_macros::{LoginPacket, McBuf}; -use std::{ - hash::Hash, - io::{Read, Write}, -}; +use std::io::{Read, Write}; use crate::mc_buf::{McBufReadable, McBufWritable};