pub struct BlockState { /* private fields */ }
Expand description
Represent a particular state of a block, this block state also know all its neighbors by their properties and values.
To build states, use BlockStateContainerBuilder
and add all wanted
properties.
Implementations§
Source§impl BlockState
impl BlockState
pub fn get_index(&self) -> u16
pub fn get_key(&'static self) -> BlockStateKey
pub fn get_block(&self) -> &'static Block
pub fn is_block(&self, block: &'static Block) -> bool
Sourcepub fn get<T, P>(&self, property: &P) -> Option<T>where
T: PropertySerializable,
P: Property<T>,
pub fn get<T, P>(&self, property: &P) -> Option<T>where
T: PropertySerializable,
P: Property<T>,
Get a block state property value if the property exists.
pub fn expect<T, P>(&self, property: &P) -> Twhere
T: PropertySerializable,
P: Property<T>,
Sourcepub fn with<T, P>(&self, property: &P, value: T) -> Option<&BlockState>where
T: PropertySerializable,
P: Property<T>,
pub fn with<T, P>(&self, property: &P, value: T) -> Option<&BlockState>where
T: PropertySerializable,
P: Property<T>,
Try to get a neighbor with all the same properties excepts the given one with the given value, if the property or its value is not valid for the block, None is returned.
Sourcepub fn with_raw(&self, prop_name: &str, prop_value: &str) -> Option<&BlockState>
pub fn with_raw(&self, prop_name: &str, prop_value: &str) -> Option<&BlockState>
Try to get a neighbor with all the same properties excepts the given one with the given value, if the property or its value is not valid for the block, None is returned.
This version of with
method take raw property name and value as strings.
Trait Implementations§
Source§impl Debug for BlockState
impl Debug for BlockState
Source§impl PartialEq for &'static BlockState
impl PartialEq for &'static BlockState
impl Eq for &'static BlockState
impl Send for BlockState
impl Sync for BlockState
Auto Trait Implementations§
impl Freeze for BlockState
impl !RefUnwindSafe for BlockState
impl Unpin for BlockState
impl !UnwindSafe for BlockState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more