pub struct BlockState(/* private fields */);Expand description
A 1.16.5 block state (global palette id).
Implementations§
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 collision(self) -> Collision
pub fn collision(self) -> Collision
Collision boxes and what else they depend on. Hot path: three table lookups.
Sourcepub fn full_cube(self) -> bool
pub fn full_cube(self) -> bool
true when the collision shape is exactly a full cube (oracle full_cube).
Sourcepub fn solid_block(self) -> bool
pub fn solid_block(self) -> bool
AbstractBlockState.isSolidBlock (oracle solid_block).
Sourcepub fn should_suffocate(self) -> bool
pub fn should_suffocate(self) -> bool
AbstractBlockState.shouldSuffocate (oracle suffocates).
Sourcepub fn voxel_shape(self) -> &'static VoxelShapeRef
pub fn voxel_shape(self) -> &'static VoxelShapeRef
The collision VoxelShape (context-free; see BlockState::scaffolding_shapes).
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 raycast_shape(self) -> &'static SelectionShape
pub fn raycast_shape(self) -> &'static SelectionShape
The raycast shape (getRaycastShape): when the ray hits it nearer than the outline, the
hit keeps the outline’s position but takes this shape’s side (cauldrons, composters,
hoppers, scaffolding).
Sourcepub fn full_cube_identity(self) -> bool
pub fn full_cube_identity(self) -> bool
The collision shape is VoxelShapes.fullCube() (identity, as vanilla’s fast paths test).
Sourcepub fn empty_identity(self) -> bool
pub fn empty_identity(self) -> bool
The collision shape is VoxelShapes.empty() (identity).
Sourcepub fn material_liquid(self) -> bool
pub fn material_liquid(self) -> bool
Material.isLiquid() of the state’s material.
Sourcepub fn material_solid(self) -> bool
pub fn material_solid(self) -> bool
Material.isSolid() of the state’s material.
Sourcepub fn material_replaceable(self) -> bool
pub fn material_replaceable(self) -> bool
Material.isReplaceable() of the state’s material.
Sourcepub fn exceeds_cube(self) -> bool
pub fn exceeds_cube(self) -> bool
AbstractBlockState.exceedsCube().
Sourcepub fn has_dynamic_bounds(self) -> bool
pub fn has_dynamic_bounds(self) -> bool
AbstractBlock.dynamicBounds (no shape cache; shapes recomputed per query).
Sourcepub fn material_blocks_movement(self) -> bool
pub fn material_blocks_movement(self) -> bool
Material.blocksMovement() of the state’s material.
Sourcepub fn side_solid_full_square(self, side: Side) -> bool
pub fn side_solid_full_square(self, side: Side) -> bool
isSideSolidFullSquare(world, pos, side) in an otherwise empty world.
Sourcepub fn scaffolding_shapes(self) -> Option<ScaffoldingShapes>
pub fn scaffolding_shapes(self) -> Option<ScaffoldingShapes>
Scaffolding context shapes; None for other blocks.
Sourcepub fn fluid(self) -> Option<Fluid>
pub fn fluid(self) -> Option<Fluid>
Fluid in this state: water / lava blocks with their level, waterlogged states and
always-wet blocks (kelp, seagrass, bubble column) as water level 0.
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.
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.