Skip to main content

BlockStateExt

Trait BlockStateExt 

Source
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§

Source

fn get_block(&self) -> BlockRef

Source

fn is_air(&self) -> bool

Source

fn has_block_entity(&self) -> bool

Source

fn get_value<T, P: Property<T>>(&self, property: &P) -> T

Source

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.

Source

fn set_value<T, P: Property<T>>(&self, property: &P, value: T) -> BlockStateId

Source

fn get_property_str(&self, name: &str) -> Option<String>

Source

fn get_collision_shape(&self) -> VoxelShape

Source

fn get_support_shape(&self) -> VoxelShape

Source

fn get_outline_shape(&self) -> VoxelShape

Source

fn get_occlusion_shape(&self) -> VoxelShape

Source

fn get_interaction_shape(&self) -> VoxelShape

Source

fn get_visual_shape(&self) -> VoxelShape

Source

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.

Source

fn is_face_sturdy_for( &self, direction: Direction, support_type: SupportType, ) -> bool

Checks if this block face is sturdy for the given support type.

Source

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.

Source

fn blocks_motion(&self) -> bool

Checks if this block state blocks motion.

This matches vanilla’s BlockState.blocksMotion().

Source

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.

Source

fn is_replaceable(&self) -> bool

Returns if a block can be replaced extracted from the minecraft data

Source

fn has_fluid(&self) -> bool

Returns true if this block state contains fluid — either a liquid block or a waterlogged block. Mirrors vanilla’s !blockState.getFluidState().isEmpty().

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl BlockStateExt for BlockStateId

Implementors§