From cf3fcc2bbf176011df0b147a3b8e91cb32beb300 Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 29 Jun 2022 03:02:30 -0500 Subject: [PATCH] impl VoxelShape for ArrayVoxelShape --- azalea-physics/src/discrete_voxel_shape.rs | 9 ++++++++- azalea-physics/src/shape.rs | 10 +++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/azalea-physics/src/discrete_voxel_shape.rs b/azalea-physics/src/discrete_voxel_shape.rs index 1750612f..13c22de2 100644 --- a/azalea-physics/src/discrete_voxel_shape.rs +++ b/azalea-physics/src/discrete_voxel_shape.rs @@ -43,9 +43,12 @@ pub trait DiscreteVoxelShape { } false } + + // i don't know how to do this properly + fn clone(&self) -> Box; } -#[derive(Default)] +#[derive(Default, Clone)] pub struct BitSetDiscreteVoxelShape { x_size: u32, y_size: u32, @@ -152,4 +155,8 @@ impl DiscreteVoxelShape for BitSetDiscreteVoxelShape { fn last_full_z(&self) -> u32 { self.z_max } + + fn clone(&self) -> Box { + Box::new(Clone::clone(self)) + } } diff --git a/azalea-physics/src/shape.rs b/azalea-physics/src/shape.rs index 4616af9a..52f29d32 100644 --- a/azalea-physics/src/shape.rs +++ b/azalea-physics/src/shape.rs @@ -87,25 +87,25 @@ impl CubeVoxelShape { impl VoxelShape for ArrayVoxelShape { fn shape(&self) -> Box { - todo!() + self.shape.clone() } fn get_x_coords(&self) -> Vec { - todo!() + self.xs.clone() } fn get_y_coords(&self) -> Vec { - todo!() + self.ys.clone() } fn get_z_coords(&self) -> Vec { - todo!() + self.zs.clone() } } impl VoxelShape for CubeVoxelShape { fn shape(&self) -> Box { - todo!() + self.shape.clone() } fn get_x_coords(&self) -> Vec {