pub trait BlockStateExt {
Show 20 methods
// Required methods
fn get_block(&self) -> BlockRef;
fn is_air(&self) -> bool;
fn has_block_entity(&self) -> bool;
fn get_value<T, P: Property<T>>(&self, property: &P) -> T;
fn try_get_value<T, P: Property<T>>(&self, property: &P) -> Option<T>;
fn set_value<T, P: Property<T>>(
&self,
property: &P,
value: T,
) -> BlockStateId;
fn get_property_str(&self, name: &str) -> Option<String>;
fn get_collision_shape(&self) -> VoxelShape;
fn get_support_shape(&self) -> VoxelShape;
fn get_outline_shape(&self) -> VoxelShape;
fn get_occlusion_shape(&self) -> VoxelShape;
fn get_interaction_shape(&self) -> VoxelShape;
fn get_visual_shape(&self) -> VoxelShape;
fn is_face_sturdy(&self, direction: Direction) -> bool;
fn is_face_sturdy_for(
&self,
direction: Direction,
support_type: SupportType,
) -> bool;
fn is_solid(&self) -> bool;
fn blocks_motion(&self) -> bool;
fn is_solid_render(&self) -> bool;
fn is_replaceable(&self) -> bool;
fn has_fluid(&self) -> bool;
}Required Methods§
fn get_block(&self) -> BlockRef
fn is_air(&self) -> bool
fn has_block_entity(&self) -> bool
fn get_value<T, P: Property<T>>(&self, property: &P) -> T
Sourcefn try_get_value<T, P: Property<T>>(&self, property: &P) -> Option<T>
fn try_get_value<T, P: Property<T>>(&self, property: &P) -> Option<T>
Gets the value of a property, returning None if the block doesn’t have this property.
fn set_value<T, P: Property<T>>(&self, property: &P, value: T) -> BlockStateId
fn get_property_str(&self, name: &str) -> Option<String>
fn get_collision_shape(&self) -> VoxelShape
fn get_support_shape(&self) -> VoxelShape
fn get_outline_shape(&self) -> VoxelShape
fn get_occlusion_shape(&self) -> VoxelShape
fn get_interaction_shape(&self) -> VoxelShape
fn get_visual_shape(&self) -> VoxelShape
Sourcefn is_face_sturdy(&self, direction: Direction) -> bool
fn is_face_sturdy(&self, direction: Direction) -> bool
Checks if this block face is sturdy enough to support other blocks.
Uses SupportType::Full by default.
Sourcefn is_face_sturdy_for(
&self,
direction: Direction,
support_type: SupportType,
) -> bool
fn is_face_sturdy_for( &self, direction: Direction, support_type: SupportType, ) -> bool
Checks if this block face is sturdy for the given support type.
Sourcefn is_solid(&self) -> bool
fn is_solid(&self) -> bool
Checks if this block state is solid (has a full cube collision shape).
This matches vanilla’s BlockState.isSolid() which is used by standing signs
to check if they can be placed on a block.
Sourcefn blocks_motion(&self) -> bool
fn blocks_motion(&self) -> bool
Checks if this block state blocks motion.
This matches vanilla’s BlockState.blocksMotion().
Sourcefn is_solid_render(&self) -> bool
fn is_solid_render(&self) -> bool
Checks if this block state renders as a full solid cube.
This matches vanilla’s cached BlockState.isSolidRender(), based on the
occlusion shape rather than collision shape.
Sourcefn is_replaceable(&self) -> bool
fn is_replaceable(&self) -> bool
Returns if a block can be replaced extracted from the minecraft data
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".