diff options
Diffstat (limited to 'azalea-protocol')
4 files changed, 12 insertions, 13 deletions
diff --git a/azalea-protocol/src/mc_buf/mod.rs b/azalea-protocol/src/mc_buf/mod.rs index b69e94c4..4048bae7 100755 --- a/azalea-protocol/src/mc_buf/mod.rs +++ b/azalea-protocol/src/mc_buf/mod.rs @@ -3,6 +3,7 @@ mod read; mod write; +use packet_macros::{McBufReadable, McBufWritable}; pub use read::{McBufReadable, McBufVarintReadable, Readable}; use std::ops::{Deref, Index}; pub use write::{McBufVarintWritable, McBufWritable, Writable}; @@ -31,17 +32,16 @@ impl From<Vec<u8>> for UnsizedByteArray { } } -/** Represents Java's BitSet, a list of bits. */ +/// Represents Java's BitSet, a list of bits. +#[derive(Debug, Clone, PartialEq, Eq, Hash, McBufReadable, McBufWritable)] pub struct BitSet { data: Vec<u64>, } -impl Index<usize> for BitSet { - type Output = bool; - - fn index(&self, index: usize) -> &Self::Output { - let result = (self.data[index / 64] & (1u64 << (index % 64))) != 0; - &result +// the Index trait requires us to return a reference, but we can't do that +impl BitSet { + pub fn index(&self, index: usize) -> bool { + (self.data[index / 64] & (1u64 << (index % 64))) != 0 } } diff --git a/azalea-protocol/src/mc_buf/read.rs b/azalea-protocol/src/mc_buf/read.rs index e90b4b10..3d1aa0b3 100755 --- a/azalea-protocol/src/mc_buf/read.rs +++ b/azalea-protocol/src/mc_buf/read.rs @@ -8,7 +8,7 @@ use serde::Deserialize; use tokio::io::{AsyncRead, AsyncReadExt}; use uuid::Uuid; -use super::{UnsizedByteArray, MAX_STRING_LENGTH}; +use super::{BitSet, UnsizedByteArray, MAX_STRING_LENGTH}; #[async_trait] pub trait Readable { diff --git a/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs b/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs index 0dcb0ff2..6882d255 100644 --- a/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_level_chunk_with_light_packet.rs @@ -14,7 +14,7 @@ pub struct ClientboundLevelChunkWithLightPacket { pub struct ClientboundLevelChunkPacketData { heightmaps: azalea_nbt::Tag, data: Vec<u8>, - block_entities: BlockEntity, + block_entities: Vec<BlockEntity>, } #[derive(Clone, Debug, McBufReadable, McBufWritable)] diff --git a/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs b/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs index 8e53e12e..c97eacff 100644 --- a/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_light_update_packet.rs @@ -1,6 +1,6 @@ use crate::mc_buf::BitSet; use azalea_core::{game_type::GameType, resource_location::ResourceLocation}; -use packet_macros::GamePacket; +use packet_macros::{GamePacket, McBufReadable, McBufWritable}; #[derive(Clone, Debug, GamePacket)] pub struct ClientboundLightUpdatePacket { @@ -16,7 +16,6 @@ pub struct ClientboundLightUpdatePacketData { block_y_mask: BitSet, empty_sky_y_mask: BitSet, empty_block_y_mask: BitSet, - sky_updates: Vec<>, - block_updates: BitSet, - + sky_updates: Vec<Vec<u8>>, + block_updates: Vec<Vec<u8>>, } |
