From b6fb96429c4530530f46e5deb5998f2249e5124e Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 28 Apr 2022 19:51:31 -0500 Subject: chunk packets work --- azalea-protocol/src/mc_buf/mod.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'azalea-protocol/src/mc_buf/mod.rs') 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> 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, } -impl Index 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 } } -- cgit v1.2.3