#[non_exhaustive]pub struct BlockQuery {
pub air: bool,
pub water: bool,
pub block: u16,
pub hardness: f32,
pub dig_material: Option<DigMaterial>,
pub harvest_tools: &'static [u16],
pub selection: Option<[f64; 6]>,
pub stairs: Option<[Option<[f64; 6]>; 8]>,
pub activates: bool,
}Expand description
What the hands need to know about one block state.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.air: boolThe block is air (Material.AIR).
water: boolThe block is water (eyes in it slow digging).
block: u16Version block id (1.8 id, 1.16 registry id).
hardness: f32Hardness; negative = unbreakable.
dig_material: Option<DigMaterial>Tool group for the speed multiplier.
harvest_tools: &'static [u16]Item ids that harvest the block (empty = any).
selection: Option<[f64; 6]>Selection (ray) box relative to the block, None when rays pass through.
stairs: Option<[Option<[f64; 6]>; 8]>Stairs (1.8): vanilla’s eight-pass half-cube ray test; the passes’ block-local boxes
(None = skipped pass). When set, selection is ignored for rays.
activates: boolRight-clicking the block activates it (containers, doors, levers, …).
Implementations§
Source§impl BlockQuery
impl BlockQuery
Sourcepub const AIR: BlockQuery
pub const AIR: BlockQuery
Air (id 0, no ray box).
Sourcepub const fn new(block: u16) -> Self
pub const fn new(block: u16) -> Self
A solid, instantly breakable block with no tool group, no ray box and no activation;
set the rest with the with_* methods.
Sourcepub const fn with_water(self, on: bool) -> Self
pub const fn with_water(self, on: bool) -> Self
The block is water.
Sourcepub const fn with_hardness(self, hardness: f32) -> Self
pub const fn with_hardness(self, hardness: f32) -> Self
Hardness (negative: unbreakable).
Sourcepub const fn with_dig_material(self, m: Option<DigMaterial>) -> Self
pub const fn with_dig_material(self, m: Option<DigMaterial>) -> Self
Tool group.
Sourcepub const fn with_harvest_tools(self, tools: &'static [u16]) -> Self
pub const fn with_harvest_tools(self, tools: &'static [u16]) -> Self
Item ids that harvest the block (empty: any).
Sourcepub const fn with_selection(self, b: Option<[f64; 6]>) -> Self
pub const fn with_selection(self, b: Option<[f64; 6]>) -> Self
Selection (ray) box relative to the block.
Sourcepub const fn with_stairs(self, passes: Option<[Option<[f64; 6]>; 8]>) -> Self
pub const fn with_stairs(self, passes: Option<[Option<[f64; 6]>; 8]>) -> Self
1.8 stairs ray passes.
Sourcepub const fn with_activates(self, on: bool) -> Self
pub const fn with_activates(self, on: bool) -> Self
Right-clicking activates it.