pub struct VoxelShape {
boxes: &'static [BlockLocalAabb],
}Expand description
A block-local voxel shape.
This currently stores the optimized AABB list extracted from vanilla data. It is intentionally a domain type rather than a raw slice so the full vanilla shape implementation can grow behind the same API.
Fields§
§boxes: &'static [BlockLocalAabb]Implementations§
Source§impl VoxelShape
impl VoxelShape
Sourcepub const FULL_BLOCK: Self
pub const FULL_BLOCK: Self
Full block shape.
Sourcepub const fn from_boxes(boxes: &'static [BlockLocalAabb]) -> Self
pub const fn from_boxes(boxes: &'static [BlockLocalAabb]) -> Self
Creates a shape from static block-local boxes.
Sourcepub const fn boxes(self) -> &'static [BlockLocalAabb]
pub const fn boxes(self) -> &'static [BlockLocalAabb]
Returns the block-local boxes backing this shape.
Sourcepub fn iter(self) -> Iter<'static, BlockLocalAabb>
pub fn iter(self) -> Iter<'static, BlockLocalAabb>
Returns an iterator over the block-local boxes.
Sourcepub fn min(self, axis: Axis) -> f64
pub fn min(self, axis: Axis) -> f64
Returns the minimum coordinate on axis, or positive infinity for an empty shape.
Sourcepub fn max(self, axis: Axis) -> f64
pub fn max(self, axis: Axis) -> f64
Returns the maximum coordinate on axis, or negative infinity for an empty shape.
Sourcepub fn bounds(self) -> Option<BlockLocalAabb>
pub fn bounds(self) -> Option<BlockLocalAabb>
Returns the union bounds of this shape, or None for empty shapes.
Sourcepub fn has_large_collision_shape(self) -> bool
pub fn has_large_collision_shape(self) -> bool
Returns true when this shape extends outside its owning block.
Mirrors vanilla BlockState.hasLargeCollisionShape() for collision
iterator filtering.
Trait Implementations§
Source§impl Clone for VoxelShape
impl Clone for VoxelShape
Source§fn clone(&self) -> VoxelShape
fn clone(&self) -> VoxelShape
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for VoxelShape
Source§impl Debug for VoxelShape
impl Debug for VoxelShape
Source§impl IntoIterator for VoxelShape
impl IntoIterator for VoxelShape
Source§impl PartialEq for VoxelShape
impl PartialEq for VoxelShape
Source§fn eq(&self, other: &VoxelShape) -> bool
fn eq(&self, other: &VoxelShape) -> bool
self and other values to be equal, and is used by ==.