aboutsummaryrefslogtreecommitdiff
path: root/azalea-core/src
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-09-20 20:35:16 -1200
committermat <git@matdoes.dev>2025-09-20 20:35:16 -1200
commit585b51e91a5335eae37bc5af7c0111bb2092b156 (patch)
treec1559014df9db20dd625d9fe972d4e9f88317008 /azalea-core/src
parentdb793448ff8e656ad80859835edc3b89cb547dd2 (diff)
downloadazalea-drasl-585b51e91a5335eae37bc5af7c0111bb2092b156.tar.xz
more accurate mining and impl PartialEq for packets
Diffstat (limited to 'azalea-core/src')
-rw-r--r--azalea-core/src/bitset.rs9
-rw-r--r--azalea-core/src/delta.rs2
-rw-r--r--azalea-core/src/game_type.rs2
-rw-r--r--azalea-core/src/objectives.rs2
4 files changed, 11 insertions, 4 deletions
diff --git a/azalea-core/src/bitset.rs b/azalea-core/src/bitset.rs
index 2c42b4c2..7324501a 100644
--- a/azalea-core/src/bitset.rs
+++ b/azalea-core/src/bitset.rs
@@ -134,7 +134,7 @@ impl BitSet {
/// Returns the indices of all bits that are set to `true`.
pub fn iter_ones(&self) -> impl Iterator<Item = usize> {
- (0..self.len()).filter_map(|i| if self.index(i) { Some(i) } else { None })
+ (0..self.len()).filter(|i| self.index(*i))
}
/// Returns the maximum number of items that could be in this `BitSet`.
@@ -144,6 +144,13 @@ impl BitSet {
pub fn len(&self) -> usize {
self.data.len() * 64
}
+
+ /// Returns true if the `BitSet` was created with a size of 0.
+ ///
+ /// Equivalent to `self.len() == 0`.
+ pub fn is_empty(&self) -> bool {
+ self.len() == 0
+ }
}
impl From<Vec<u64>> for BitSet {
diff --git a/azalea-core/src/delta.rs b/azalea-core/src/delta.rs
index dd598f77..d6a99b11 100644
--- a/azalea-core/src/delta.rs
+++ b/azalea-core/src/delta.rs
@@ -9,7 +9,7 @@ pub trait PositionDeltaTrait {
}
/// Only works for up to 8 blocks
-#[derive(Clone, Debug, AzBuf, Default)]
+#[derive(Clone, Debug, AzBuf, Default, PartialEq)]
pub struct PositionDelta8 {
pub xa: i16,
pub ya: i16,
diff --git a/azalea-core/src/game_type.rs b/azalea-core/src/game_type.rs
index 7328902a..0b249246 100644
--- a/azalea-core/src/game_type.rs
+++ b/azalea-core/src/game_type.rs
@@ -115,7 +115,7 @@ impl AzaleaWrite for GameMode {
/// Rust doesn't let us `impl AzaleaRead for Option<GameType>` so we have to
/// make a new type :(
-#[derive(Hash, Copy, Clone, Debug)]
+#[derive(Hash, Copy, Clone, Debug, PartialEq)]
pub struct OptionalGameType(pub Option<GameMode>);
impl From<Option<GameMode>> for OptionalGameType {
diff --git a/azalea-core/src/objectives.rs b/azalea-core/src/objectives.rs
index be5ea252..0975a3fd 100644
--- a/azalea-core/src/objectives.rs
+++ b/azalea-core/src/objectives.rs
@@ -5,7 +5,7 @@ use std::{
use azalea_buf::AzBuf;
-#[derive(Clone, Copy, Debug, AzBuf)]
+#[derive(Clone, Copy, Debug, AzBuf, PartialEq)]
pub enum ObjectiveCriteria {
Integer,
Hearts,