mc173/block_entity/
piston.rs

1//! Moving piston block entity.
2
3use glam::IVec3;
4
5use crate::world::World;
6use crate::geom::Face;
7
8
9#[derive(Debug, Clone)]
10pub struct PistonBlockEntity {
11    /// The block id of the moving piston block.
12    pub block: u8,
13    /// The block metadata of the moving piston block.
14    pub metadata: u8,
15    /// Face toward the block is moving.
16    pub face: Face,
17    /// Progress of the move animation.
18    pub progress: f32,
19    /// True when the piston is extending, false when retracting.
20    pub extending: bool,
21}
22
23impl Default for PistonBlockEntity {
24    fn default() -> Self {
25        Self { 
26            block: 0, 
27            metadata: 0, 
28            face: Face::PosY,
29            progress: 0.0,
30            extending: false,
31        }
32    }
33}
34
35impl PistonBlockEntity {
36
37    pub fn tick(&mut self, world: &mut World, pos: IVec3) {
38        let _ = (world, pos);
39        // TODO:
40    }
41
42}