From 2cdbdcaa27c812e569c7c1a13d83182446e7f18b Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 23 Jun 2022 21:31:19 -0500 Subject: move_entity_with_delta --- azalea-core/src/delta.rs | 10 ++++++---- azalea-core/src/resource_location.rs | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'azalea-core/src') diff --git a/azalea-core/src/delta.rs b/azalea-core/src/delta.rs index 339e52cd..41923ffb 100644 --- a/azalea-core/src/delta.rs +++ b/azalea-core/src/delta.rs @@ -20,10 +20,12 @@ impl PositionDelta { } impl EntityPos { - pub fn apply_delta(&mut self, delta: &PositionDelta) { + pub fn with_delta(&self, delta: &PositionDelta) -> EntityPos { let (x, y, z) = delta.float(); - self.x += x; - self.y += y; - self.z += z; + EntityPos { + x: self.x + x, + y: self.y + y, + z: self.z + z, + } } } diff --git a/azalea-core/src/resource_location.rs b/azalea-core/src/resource_location.rs index 61ae8a20..acca0c58 100755 --- a/azalea-core/src/resource_location.rs +++ b/azalea-core/src/resource_location.rs @@ -93,7 +93,8 @@ mod tests { let mut buf = Vec::new(); ResourceLocation::new("minecraft:dirt") .unwrap() - .write_into(&mut buf)?; + .write_into(&mut buf) + .unwrap(); let mut buf = Cursor::new(buf); -- cgit v1.2.3