pub struct BlockPhysics {
pub slipperiness: f32,
pub speed_factor: f64,
pub jump_factor: f32,
pub stuck_multiplier: [f64; 3],
pub flags: PhysicsFlags,
}Expand description
Physics properties of a block (vanilla facts that minecraft-data does not carry; maintained in
codegen/data/src/facts.rs).
Fields§
§slipperiness: f32Ground friction (“slipperiness”), vanilla float: default 0.6, ice 0.98, slime 0.8.
speed_factor: f64Horizontal speed multiplier. The exact f64 vanilla multiplies by: 0.4 (a double
literal) for 1.8 soul sand, 0.4f32 as f64 for 1.16 speed factors. 1.0 = none.
jump_factor: f32Jump velocity multiplier (vanilla float; 1.16 honey block 0.5). 1.0 = none.
stuck_multiplier: [f64; 3]Motion multiplier [x, y, z] while inside the block (when PhysicsFlags::STUCK).
flags: PhysicsFlagsFlag bits.
Implementations§
Source§impl BlockPhysics
impl BlockPhysics
Sourcepub const DEFAULT: BlockPhysics
pub const DEFAULT: BlockPhysics
Properties of an ordinary block.
Sourcepub const fn velocity_multiplier(&self) -> f32
pub const fn velocity_multiplier(&self) -> f32
The speed factor as the float 1.16 Block.getVelocityMultiplier() returns (exact: the
1.16 tables store f64::from(f32)). For 1.8 use BlockPhysics::speed_factor directly.
Sourcepub const fn has(&self, flag: PhysicsFlags) -> bool
pub const fn has(&self, flag: PhysicsFlags) -> bool
Shorthand for self.flags.contains(flag).