valence_protocol/packets/play/
update_structure_block_c2s.rs
1use bitfield_struct::bitfield;
2
3use crate::{BlockPos, Bounded, Decode, Encode, Packet, VarLong};
4
5#[derive(Copy, Clone, Debug, Encode, Decode, Packet)]
6pub struct UpdateStructureBlockC2s<'a> {
7 pub position: BlockPos,
8 pub action: Action,
9 pub mode: Mode,
10 pub name: &'a str,
11 pub offset_xyz: [i8; 3],
12 pub size_xyz: [i8; 3],
13 pub mirror: Mirror,
14 pub rotation: Rotation,
15 pub metadata: Bounded<&'a str, 128>,
16 pub integrity: f32,
17 pub seed: VarLong,
18 pub flags: Flags,
19}
20
21#[derive(Copy, Clone, PartialEq, Eq, Debug, Encode, Decode)]
22pub enum Action {
23 UpdateData,
24 SaveStructure,
25 LoadStructure,
26 DetectSize,
27}
28
29#[derive(Copy, Clone, PartialEq, Eq, Debug, Encode, Decode)]
30pub enum Mode {
31 Save,
32 Load,
33 Corner,
34 Data,
35}
36
37#[derive(Copy, Clone, PartialEq, Eq, Debug, Encode, Decode)]
38pub enum Mirror {
39 None,
40 LeftRight,
41 FrontBack,
42}
43
44#[derive(Copy, Clone, PartialEq, Eq, Debug, Encode, Decode)]
45pub enum Rotation {
46 None,
47 Clockwise90,
48 Clockwise180,
49 Counterclockwise90,
50}
51
52#[bitfield(u8)]
53#[derive(PartialEq, Eq, Encode, Decode)]
54pub struct Flags {
55 pub ignore_entities: bool,
56 pub show_air: bool,
57 pub show_bounding_box: bool,
58 #[bits(5)]
59 _pad: u8,
60}