diff options
| author | mat <github@matdoes.dev> | 2022-09-04 23:01:15 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-09-04 23:01:15 -0500 |
| commit | 4f00ddace08bd5ad17500a405f55554dff343be7 (patch) | |
| tree | 8a8503fe4b9d0055b73952d2fb7f38941000f9d0 /azalea-core/src | |
| parent | 99fcad7bc4133c32627fe2e4751faad05b9b4ef1 (diff) | |
| download | azalea-drasl-4f00ddace08bd5ad17500a405f55554dff343be7.tar.xz | |
remove some debug stuff and fix recipe packet
Diffstat (limited to 'azalea-core/src')
| -rw-r--r-- | azalea-core/src/cursor3d.rs | 4 | ||||
| -rw-r--r-- | azalea-core/src/position.rs | 13 |
2 files changed, 12 insertions, 5 deletions
diff --git a/azalea-core/src/cursor3d.rs b/azalea-core/src/cursor3d.rs index fa265c8a..180301e3 100644 --- a/azalea-core/src/cursor3d.rs +++ b/azalea-core/src/cursor3d.rs @@ -72,10 +72,6 @@ impl Cursor3d { end_y: i32, end_z: i32, ) -> Self { - println!( - "making cursor3d with origin: {}, {}, {} and end: {}, {}, {}", - origin_x, origin_y, origin_z, end_x, end_y, end_z - ); let width = (end_x - origin_x + 1) .try_into() .expect("Impossible width."); diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs index 7451bc14..8c71676c 100644 --- a/azalea-core/src/position.rs +++ b/azalea-core/src/position.rs @@ -302,7 +302,7 @@ const X_OFFSET: u64 = PACKED_Y_LENGTH + PACKED_Z_LENGTH; impl McBufReadable for BlockPos { fn read_from(buf: &mut impl Read) -> Result<Self, BufReadError> { - let val = u64::read_from(buf)?; + let val = i64::read_from(buf)?; println!("reading blockpos from {}", val); let x = (val << (64 - X_OFFSET - PACKED_X_LENGTH) >> (64 - PACKED_X_LENGTH)) as i32; let y = (val << (64 - PACKED_Y_LENGTH) >> (64 - PACKED_Y_LENGTH)) as i32; @@ -362,6 +362,8 @@ impl McBufWritable for ChunkSectionPos { #[cfg(test)] mod tests { + use std::io::Cursor; + use super::*; #[test] @@ -399,4 +401,13 @@ mod tests { let chunk_pos = ChunkPos::from(&entity_pos); assert_eq!(chunk_pos, ChunkPos::new(1, -2)); } + + #[test] + fn test_read_blockpos_from() { + let mut buf = Cursor::new(Vec::new()); + 13743895338965u64.write_into(&mut buf).unwrap(); + buf.set_position(0); + let block_pos = BlockPos::read_from(&mut buf).unwrap(); + assert_eq!(block_pos, BlockPos::new(49, -43, -3)); + } } |
