aboutsummaryrefslogtreecommitdiff
path: root/azalea-core/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-10-08 01:01:54 -0500
committermat <github@matdoes.dev>2022-10-08 01:01:54 -0500
commit4a0d5e7e96a795e3c30deb49723e4cc3d730e37c (patch)
tree7c13661d046ba21a5167f92f861dbb90a347b74b /azalea-core/src
parent82c04004dbf37b813e1f4223d56b399c40d68e80 (diff)
downloadazalea-drasl-4a0d5e7e96a795e3c30deb49723e4cc3d730e37c.tar.xz
handle SectionBlocksUpdate packet
Diffstat (limited to 'azalea-core/src')
-rw-r--r--azalea-core/src/position.rs16
-rwxr-xr-xazalea-core/src/resource_location.rs2
2 files changed, 15 insertions, 3 deletions
diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs
index d408d817..83472b61 100644
--- a/azalea-core/src/position.rs
+++ b/azalea-core/src/position.rs
@@ -172,6 +172,18 @@ impl ChunkSectionBlockPos {
}
}
+impl Add<ChunkSectionBlockPos> for ChunkSectionPos {
+ type Output = BlockPos;
+
+ fn add(self, rhs: ChunkSectionBlockPos) -> Self::Output {
+ BlockPos {
+ x: self.x * 16 + rhs.x as i32,
+ y: self.y * 16 + rhs.y as i32,
+ z: self.z * 16 + rhs.z as i32,
+ }
+ }
+}
+
/// A block pos with an attached dimension
#[derive(Debug, Clone)]
pub struct GlobalPos {
@@ -403,8 +415,8 @@ mod tests {
fn test_read_blockpos_from() {
let mut buf = Vec::new();
13743895338965u64.write_into(&mut buf).unwrap();
- let buf = &mut &buf[..];
- let block_pos = BlockPos::read_from(buf).unwrap();
+ let mut buf = Cursor::new(&buf[..]);
+ let block_pos = BlockPos::read_from(&mut buf).unwrap();
assert_eq!(block_pos, BlockPos::new(49, -43, -3));
}
}
diff --git a/azalea-core/src/resource_location.rs b/azalea-core/src/resource_location.rs
index 5f8dcea1..e810b96e 100755
--- a/azalea-core/src/resource_location.rs
+++ b/azalea-core/src/resource_location.rs
@@ -94,7 +94,7 @@ mod tests {
.write_into(&mut buf)
.unwrap();
- let mut buf = &mut &buf[..];
+ let mut buf = Cursor::new(&buf[..]);
assert_eq!(
ResourceLocation::read_from(&mut buf).unwrap(),