-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.pds
51 lines (44 loc) · 1.42 KB
/
test.pds
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
@type integer("u8")
def_native("u8");
@type integer("u64")
def_native("u64");
def_native("f64");
@type binary("utf8")
def_native("sized_string") {
argument("size", stage: "read") => integer("usize");
};
def("u8_string") => container(virtual: "true") {
virtual_field("size", value: "string/@size") => u8;
field("string") => sized_string(size: "../size");
};
def("position") => container {
field("x") => ::f64;
field("y") => ::f64;
field("z") => ::f64;
};
def("entity_data") => container {
field("entity_id") => ::u64;
field("position") => ::position;
virtual_field("entity_type_tag", value: "entity_type/@tag") => ::u8;
field("entity_type") => union("entity_type", tag: "../entity_type_tag") {
variant("player", match: "0") => container {};
variant("zombie", match: "1") => container {};
};
};
namespace("test") {
def("ping") => container {
field("nonce") => ::u64;
field("timestamp") => ::u64;
};
@export "::test::packet"
def("packet") => container(virtual: "true") {
virtual_field("tag", value: "data/@tag") => ::u8;
field("data") => union("packet_variant", tag: "../tag") {
variant("handshake", match: "0") => container {
field("nonce") => ::u64;
};
variant("ping", match: "1") => ::test::ping;
variant("spawn_entity", match: "2") => ::entity_data;
};
};
};