Skip to main content

BlockStates

Struct BlockStates 

pub struct BlockStates<'a> { /* private fields */ }
Expand description

The block-state facts service: host.block_states().

Implementations§

§

impl BlockStates<'_>

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>

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>

state’s sounds (BlockState.getSoundType()). None as for replaceable.

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>

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

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

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>

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.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for BlockStates<'a>

§

impl<'a> !Send for BlockStates<'a>

§

impl<'a> !Sync for BlockStates<'a>

§

impl<'a> !UnwindSafe for BlockStates<'a>

§

impl<'a> Freeze for BlockStates<'a>

§

impl<'a> Unpin for BlockStates<'a>

§

impl<'a> UnsafeUnpin for BlockStates<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.