pub struct Collision {
pub boxes: &'static [Aabb],
pub dependency: ShapeDependency,
pub world_coords: Option<&'static [WorldCoords]>,
}Expand description
The collision of one block state.
Fields§
§boxes: &'static [Aabb]Boxes in block-local coordinates; empty means no collision.
dependency: ShapeDependencyWhether boxes is the final shape or needs more context.
world_coords: Option<&'static [WorldCoords]>Some when vanilla builds these boxes with float world coordinates (one rule set per
box, parallel to boxes); None = plain double addition, i.e. Aabb::at.
Implementations§
Source§impl Collision
impl Collision
Sourcepub fn uses_float_world_coords(&self) -> bool
pub fn uses_float_world_coords(&self) -> bool
true when at least one bound is computed in float world coordinates.
Sourcepub fn world_box(&self, i: usize, x: i32, y: i32, z: i32) -> Aabb
pub fn world_box(&self, i: usize, x: i32, y: i32, z: i32) -> Aabb
Box i placed at block position (x, y, z), bit-exact as vanilla computes it.
§Panics
If i >= self.boxes.len().
Sourcepub fn world_boxes(
&self,
x: i32,
y: i32,
z: i32,
) -> impl ExactSizeIterator<Item = Aabb> + '_
pub fn world_boxes( &self, x: i32, y: i32, z: i32, ) -> impl ExactSizeIterator<Item = Aabb> + '_
All boxes placed at block position (x, y, z), bit-exact as vanilla computes them.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
true when the block state has no collision boxes and nothing else can add one.
Sourcepub fn is_full_cube(&self) -> bool
pub fn is_full_cube(&self) -> bool
true when the shape is exactly one full unit cube and does not depend on anything else.
Trait Implementations§
impl Copy for Collision
impl StructuralPartialEq for Collision
Auto Trait Implementations§
impl Forget for Collision
impl Freeze for Collision
impl RefUnwindSafe for Collision
impl Send for Collision
impl Sync for Collision
impl Unpin for Collision
impl UnsafeUnpin for Collision
impl UnwindSafe for Collision
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more