Struct BlockStates
pub struct BlockStates<'a> { /* private fields */ }Expand description
The block-state facts service: host.block_states().
Implementations§
§impl BlockStates<'_>
impl BlockStates<'_>
pub fn replaceable(&self, state: BlockState) -> Option<bool>
pub fn replaceable(&self, state: BlockState) -> Option<bool>
BlockState.canBeReplaced(): whether placing a block where state stands replaces it
(air, grass, water, snow layers). None for an unknown state, or a host without a game.
pub fn destroy_speed(&self, state: BlockState) -> Option<f32>
pub fn destroy_speed(&self, state: BlockState) -> Option<f32>
How hard state is to break (BlockBehaviour.Properties.destroyTime, as
BlockState.getDestroySpeed reads it): stone 1.5, obsidian 50, -1 for a block that
can’t be broken. None as for replaceable.
pub fn sound(&self, state: BlockState) -> Option<BlockSoundType>
pub fn sound(&self, state: BlockState) -> Option<BlockSoundType>
state’s sounds (BlockState.getSoundType()). None as for replaceable.
pub fn has_block_entity(&self, state: BlockState) -> Option<bool>
pub fn has_block_entity(&self, state: BlockState) -> Option<bool>
BlockState.hasBlockEntity(). None as for replaceable.
pub fn map_color(&self, state: BlockState) -> Option<u8>
pub fn map_color(&self, state: BlockState) -> Option<u8>
BlockState.getMapColor: the state’s MapColor.id, 0 for none (MapColor.NONE).
None as for replaceable.
pub fn definition(&self, block: BlockKey) -> Option<Vec<StateProperty>>
pub fn definition(&self, block: BlockKey) -> Option<Vec<StateProperty>>
The block’s property names and legal serialized values. None without resolved tables.
pub fn matches(
&self,
state: BlockState,
block: BlockKey,
constraints: &[StateConstraint],
) -> Option<Result<bool, StateMatchError>>
pub fn matches( &self, state: BlockState, block: BlockKey, constraints: &[StateConstraint], ) -> Option<Result<bool, StateMatchError>>
Match a state against a block and partial property constraints. Unknown properties and values are errors even when the state belongs to a different block. None means the owning thread has no resolved tables or the state is unknown.
pub fn states_of(&self, block: BlockKey) -> Option<BlockStateRange>
pub fn states_of(&self, block: BlockKey) -> Option<BlockStateRange>
The states of block (minecraft:oak_stairs), StateDefinition.getPossibleStates.
Local ordinals retain their meaning if world numeric IDs reorder on reload.
None before metadata is published, for an unknown block or for a host without a game.