pub trait BlockWithShape {
// Required methods
fn collision_shape(&self, pos: BlockPos) -> Cow<'static, VoxelShape>;
fn outline_shape(&self, pos: BlockPos) -> Cow<'static, VoxelShape>;
fn base_collision_shape(&self) -> &'static VoxelShape;
fn base_outline_shape(&self) -> &'static VoxelShape;
fn is_collision_shape_empty(&self) -> bool;
fn is_collision_shape_full(&self) -> bool;
}Required Methods§
Sourcefn collision_shape(&self, pos: BlockPos) -> Cow<'static, VoxelShape>
fn collision_shape(&self, pos: BlockPos) -> Cow<'static, VoxelShape>
The hitbox for blocks that’s used when simulating physics.
Sourcefn outline_shape(&self, pos: BlockPos) -> Cow<'static, VoxelShape>
fn outline_shape(&self, pos: BlockPos) -> Cow<'static, VoxelShape>
The hitbox for blocks that’s used for determining whether we’re looking at it.
This is often but not always the same as the collision shape. For example, tall grass has a normal outline shape but an empty collision shape.
Sourcefn base_collision_shape(&self) -> &'static VoxelShape
fn base_collision_shape(&self) -> &'static VoxelShape
The collision shape of the block, before applying random coordinate offsets.
This is almost always the same as Self::collision_shape, except for
a few blocks like bamboo.
Sourcefn base_outline_shape(&self) -> &'static VoxelShape
fn base_outline_shape(&self) -> &'static VoxelShape
The outline shape of the block, before applying random coordinate offsets.
This is almost always the same as Self::outline_shape, except for
a few blocks like bamboo.
Sourcefn is_collision_shape_empty(&self) -> bool
fn is_collision_shape_empty(&self) -> bool
Tells you whether the block has an empty shape.
This is slightly more efficient than calling Self::collision_shape
and comparing against EMPTY_SHAPE.
Sourcefn is_collision_shape_full(&self) -> bool
fn is_collision_shape_full(&self) -> bool
Returns true if the block’s shape is exactly 1×1×1.