pub struct BlockState(/* private fields */);Expand description
A 26.1 block state (global palette id).
Implementations§
Source§impl BlockState
impl BlockState
Sourcepub fn destroy_time(self) -> f32
pub fn destroy_time(self) -> f32
Block::destroy_time (the same for every state in 26.1, checked by the generator).
Source§impl BlockState
impl BlockState
Sourcepub const AIR: BlockState
pub const AIR: BlockState
minecraft:air (id 0).
Sourcepub const fn from_id(id: u16) -> Option<BlockState>
pub const fn from_id(id: u16) -> Option<BlockState>
Wraps a palette id; None if out of range.
Sourcepub fn voxel_shape(self) -> &'static VoxelShapeRef
pub fn voxel_shape(self) -> &'static VoxelShapeRef
The context-free collision voxel shape (unshifted for offset blocks).
Sourcepub fn outline_shape(self) -> &'static SelectionShape
pub fn outline_shape(self) -> &'static SelectionShape
The crosshair outline shape (getShape / getOutlineShape with the player’s context,
empty hand). For states with BlockState::outline_offset this is the unshifted shape: the
block moves it by its per-position model offset.
Sourcepub fn outline_shape_holding_own_item(self) -> &'static SelectionShape
pub fn outline_shape_holding_own_item(self) -> &'static SelectionShape
The outline while the player holds this block’s own item (scaffolding and, where it
exists, the light block show a full cube then); otherwise BlockState::outline_shape.
Sourcepub fn outline_offset(self) -> bool
pub fn outline_offset(self) -> bool
true when the outline is moved by the block’s model offset (flowers, bamboo, …).
Sourcepub fn interaction_shape(self) -> &'static SelectionShape
pub fn interaction_shape(self) -> &'static SelectionShape
The interaction shape (getInteractionShape): when the ray hits it nearer than the outline,
the hit keeps the outline’s position but takes this shape’s face (cauldrons, composters,
hoppers, scaffolding).
Sourcepub fn get_index(self, prop: Property) -> Option<usize>
pub fn get_index(self, prop: Property) -> Option<usize>
Index of prop’s value in PropertyDef::values, if the block has that property.
Sourcepub fn get(self, prop: Property) -> Option<&'static str>
pub fn get(self, prop: Property) -> Option<&'static str>
The value of prop ("north", "true", "3"), if the block has that property.
Sourcepub fn with(self, prop: Property, value: &str) -> Option<BlockState>
pub fn with(self, prop: Property, value: &str) -> Option<BlockState>
This state with prop set to value; None if the block lacks the property or value.
Sourcepub fn properties(self) -> impl Iterator<Item = (Property, &'static str)>
pub fn properties(self) -> impl Iterator<Item = (Property, &'static str)>
(property, value) pairs of this state, most significant property first.
Sourcepub fn parse(s: &str) -> Option<BlockState>
pub fn parse(s: &str) -> Option<BlockState>
Parses minecraft:name[prop=value,...] (the namespace is optional).
Trait Implementations§
Source§impl Clone for BlockState
impl Clone for BlockState
impl Copy for BlockState
Source§impl Debug for BlockState
impl Debug for BlockState
Source§impl Display for BlockState
minecraft:oak_stairs[facing=north,half=bottom,...], the vanilla block-state string form.
impl Display for BlockState
minecraft:oak_stairs[facing=north,half=bottom,...], the vanilla block-state string form.