Skip to main content

BlockStateExt

Trait BlockStateExt 

Source
pub trait BlockStateExt {
Show 36 methods // Required methods fn get_block(&self) -> BlockRef; fn is_air(&self) -> bool; fn get_ticking_metadata(&self) -> BlockStateTickingMetadata; fn get_fluid_state(&self) -> FluidState; fn has_fluid(&self) -> bool; fn is_randomly_ticking(&self) -> bool; fn has_block_entity(&self) -> bool; fn get_value<P: Property>(&self, property: &P) -> P::Value; fn try_get_value<P: Property>(&self, property: &P) -> Option<P::Value>; fn set_value<P: Property>( &self, property: &P, value: P::Value, ) -> BlockStateId; fn copy_value<P: Property, O: BlockStateExt>( &self, property: &P, other: &O, ) -> BlockStateId; fn get_property_str(&self, name: &str) -> Option<String>; fn with_properties_of(&self, source: BlockStateId) -> BlockStateId; fn get_static_collision_shape(&self) -> VoxelShape; fn get_collision_shape_at(&self, pos: BlockPos) -> OffsetVoxelShape; fn get_static_support_shape(&self) -> VoxelShape; fn get_support_shape_at(&self, pos: BlockPos) -> OffsetVoxelShape; fn get_static_outline_shape(&self) -> VoxelShape; fn get_outline_shape_at(&self, pos: BlockPos) -> OffsetVoxelShape; fn get_occlusion_shape(&self) -> VoxelShape; fn get_static_interaction_shape(&self) -> VoxelShape; fn get_interaction_shape_at(&self, pos: BlockPos) -> OffsetVoxelShape; fn get_static_visual_shape(&self) -> VoxelShape; fn get_visual_shape_at(&self, pos: BlockPos) -> OffsetVoxelShape; fn get_light_emission(&self) -> u8; fn get_light_dampening(&self) -> u8; fn use_shape_for_light_occlusion(&self) -> bool; fn get_offset(&self, pos: BlockPos) -> DVec3; fn is_face_sturdy_at(&self, pos: BlockPos, direction: Direction) -> bool; fn is_face_sturdy_for_at( &self, pos: BlockPos, direction: Direction, support_type: SupportType, ) -> bool; fn is_solid(&self) -> bool; fn blocks_motion(&self) -> bool; fn is_solid_render(&self) -> bool; fn is_suffocating(&self) -> bool; fn is_static_redstone_conductor(&self) -> bool; fn is_replaceable(&self) -> bool;
}

Required Methods§

Source

fn get_block(&self) -> BlockRef

Source

fn is_air(&self) -> bool

Source

fn get_ticking_metadata(&self) -> BlockStateTickingMetadata

Returns Vanilla’s immutable cached fluid/random-tick metadata for this state.

Source

fn get_fluid_state(&self) -> FluidState

Mirrors Vanilla’s cached BlockState.getFluidState().

Source

fn has_fluid(&self) -> bool

Returns whether the cached fluid state is non-empty.

Source

fn is_randomly_ticking(&self) -> bool

Mirrors Vanilla’s cached BlockState.isRandomlyTicking() for the block callback.

Source

fn has_block_entity(&self) -> bool

Returns whether this block structurally supports a block entity.

Extracted Vanilla type memberships match EntityBlock exactly. Steel extends that into a registration contract: plugin blocks must be accepted by at least one registered block entity type, while the owning block behavior remains responsible for instance creation.

Source

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

Source

fn try_get_value<P: Property>(&self, property: &P) -> Option<P::Value>

Gets the value of a property, returning None if the block doesn’t have this property.

Source

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

Source

fn copy_value<P: Property, O: BlockStateExt>( &self, property: &P, other: &O, ) -> BlockStateId

Source

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

Source

fn with_properties_of(&self, source: BlockStateId) -> BlockStateId

Source

fn get_static_collision_shape(&self) -> VoxelShape

Source

fn get_collision_shape_at(&self, pos: BlockPos) -> OffsetVoxelShape

Source

fn get_static_support_shape(&self) -> VoxelShape

Source

fn get_support_shape_at(&self, pos: BlockPos) -> OffsetVoxelShape

Source

fn get_static_outline_shape(&self) -> VoxelShape

Source

fn get_outline_shape_at(&self, pos: BlockPos) -> OffsetVoxelShape

Source

fn get_occlusion_shape(&self) -> VoxelShape

Source

fn get_static_interaction_shape(&self) -> VoxelShape

Source

fn get_interaction_shape_at(&self, pos: BlockPos) -> OffsetVoxelShape

Source

fn get_static_visual_shape(&self) -> VoxelShape

Source

fn get_visual_shape_at(&self, pos: BlockPos) -> OffsetVoxelShape

Source

fn get_light_emission(&self) -> u8

Returns this block state’s block light emission, in vanilla’s 0-15 range.

Source

fn get_light_dampening(&self) -> u8

Returns this block state’s light dampening, in vanilla’s 0-15 range.

Source

fn use_shape_for_light_occlusion(&self) -> bool

Returns true if vanilla uses face shapes for light occlusion on this state.

Source

fn get_offset(&self, pos: BlockPos) -> DVec3

Mirrors vanilla BlockState.getOffset(BlockPos).

Source

fn is_face_sturdy_at(&self, pos: BlockPos, 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_at( &self, pos: BlockPos, 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_suffocating(&self) -> bool

Returns vanilla BlockState.isSuffocating.

Source

fn is_static_redstone_conductor(&self) -> bool

Returns the extracted static BlockState.isRedstoneConductor value. Dynamic behavior queries must also receive the live level and position.

Source

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".

Implementations on Foreign Types§

Source§

impl BlockStateExt for BlockStateId

Source§

fn get_block(&self) -> BlockRef

Source§

fn with_properties_of(&self, source: BlockStateId) -> BlockStateId

Source§

fn is_air(&self) -> bool

Source§

fn get_ticking_metadata(&self) -> BlockStateTickingMetadata

Source§

fn get_fluid_state(&self) -> FluidState

Source§

fn has_fluid(&self) -> bool

Source§

fn is_randomly_ticking(&self) -> bool

Source§

fn has_block_entity(&self) -> bool

Source§

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

Source§

fn try_get_value<P: Property>(&self, property: &P) -> Option<P::Value>

Source§

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

Source§

fn copy_value<P: Property, O: BlockStateExt>( &self, property: &P, other: &O, ) -> BlockStateId

Source§

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

Source§

fn get_static_collision_shape(&self) -> VoxelShape

Source§

fn get_collision_shape_at(&self, pos: BlockPos) -> OffsetVoxelShape

Source§

fn get_static_support_shape(&self) -> VoxelShape

Source§

fn get_support_shape_at(&self, pos: BlockPos) -> OffsetVoxelShape

Source§

fn get_static_outline_shape(&self) -> VoxelShape

Source§

fn get_outline_shape_at(&self, pos: BlockPos) -> OffsetVoxelShape

Source§

fn get_occlusion_shape(&self) -> VoxelShape

Source§

fn get_static_interaction_shape(&self) -> VoxelShape

Source§

fn get_interaction_shape_at(&self, pos: BlockPos) -> OffsetVoxelShape

Source§

fn get_static_visual_shape(&self) -> VoxelShape

Source§

fn get_visual_shape_at(&self, pos: BlockPos) -> OffsetVoxelShape

Source§

fn get_light_emission(&self) -> u8

Source§

fn get_light_dampening(&self) -> u8

Source§

fn use_shape_for_light_occlusion(&self) -> bool

Source§

fn get_offset(&self, pos: BlockPos) -> DVec3

Source§

fn is_face_sturdy_at(&self, pos: BlockPos, direction: Direction) -> bool

Source§

fn is_face_sturdy_for_at( &self, pos: BlockPos, direction: Direction, support_type: SupportType, ) -> bool

Source§

fn is_solid(&self) -> bool

Source§

fn blocks_motion(&self) -> bool

Source§

fn is_solid_render(&self) -> bool

Source§

fn is_suffocating(&self) -> bool

Source§

fn is_static_redstone_conductor(&self) -> bool

Source§

fn is_replaceable(&self) -> bool

Implementors§