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