1 /*
2  * This file has been automatically generated by Soupply and released under the MIT license.
3  * Generated from data/java338.xml
4  */
5 module soupply.java338.types;
6 
7 static import std.conv;
8 import xpacket;
9 
10 import xserial.serial : EndianType, serializeLength, deserializeLength;
11 
12 import xbuffer.memory : xalloc, xfree;
13 
14 import soupply.util;
15 import soupply.java338.metadata;
16 
17 struct Statistic
18 {
19 
20     enum string[] __fields = ["name", "value"];
21 
22     string name;
23     @Var uint value;
24 
25     mixin Make!(Endian.bigEndian, varuint);
26 
27     string toString()
28     {
29         return "Statistic(name: " ~ std.conv.to!string(this.name) ~ ", value: " ~ std.conv.to!string(this.value) ~ ")";
30     }
31 
32 }
33 
34 struct BlockChange
35 {
36 
37     enum string[] __fields = ["xz", "y", "block"];
38 
39     ubyte xz;
40     ubyte y;
41     @Var uint block;
42 
43     mixin Make!(Endian.bigEndian, varuint);
44 
45     string toString()
46     {
47         return "BlockChange(xz: " ~ std.conv.to!string(this.xz) ~ ", y: " ~ std.conv.to!string(this.y) ~ ", block: " ~ std.conv.to!string(this.block) ~ ")";
48     }
49 
50 }
51 
52 struct Slot
53 {
54 
55     enum string[] __fields = ["id", "count", "damage", "nbt"];
56 
57     short id;
58     @Condition("id>0") ubyte count;
59     @Condition("id>0") ushort damage;
60     @Condition("id>0") @NoLength ubyte[] nbt;
61 
62     mixin Make!(Endian.bigEndian, varuint);
63 
64     string toString()
65     {
66         return "Slot(id: " ~ std.conv.to!string(this.id) ~ ", count: " ~ std.conv.to!string(this.count) ~ ", damage: " ~ std.conv.to!string(this.damage) ~ ", nbt: " ~ std.conv.to!string(this.nbt) ~ ")";
67     }
68 
69 }
70 
71 struct Icon
72 {
73 
74     // direction and type
75     enum ubyte WHITE_ARROW = 0;
76     enum ubyte GREEN_ARROW = 1;
77     enum ubyte RED_ARROW = 2;
78     enum ubyte BLUE_ARROW = 3;
79     enum ubyte WHITE_CROSS = 4;
80     enum ubyte RED_POINTER = 5;
81     enum ubyte WHITE_CIRCLE = 6;
82     enum ubyte SMALL_WHITE_CIRCLE = 7;
83     enum ubyte MANSION = 8;
84     enum ubyte TEMPLE = 9;
85 
86     enum string[] __fields = ["directionAndType", "position"];
87 
88     ubyte directionAndType;
89     Vector!(ubyte, "xz") position;
90 
91     mixin Make!(Endian.bigEndian, varuint);
92 
93     string toString()
94     {
95         return "Icon(directionAndType: " ~ std.conv.to!string(this.directionAndType) ~ ", position: " ~ std.conv.to!string(this.position) ~ ")";
96     }
97 
98 }
99 
100 struct Property
101 {
102 
103     enum string[] __fields = ["name", "value", "signed", "signature"];
104 
105     string name;
106     string value;
107     bool signed;
108     @Condition("signed==true") string signature;
109 
110     mixin Make!(Endian.bigEndian, varuint);
111 
112     string toString()
113     {
114         return "Property(name: " ~ std.conv.to!string(this.name) ~ ", value: " ~ std.conv.to!string(this.value) ~ ", signed: " ~ std.conv.to!string(this.signed) ~ ", signature: " ~ std.conv.to!string(this.signature) ~ ")";
115     }
116 
117 }
118 
119 struct ListAddPlayer
120 {
121 
122     // gamemode
123     enum uint SURVIVAL = 0;
124     enum uint CREATIVE = 1;
125     enum uint ADVENTURE = 2;
126     enum uint SPECTATOR = 3;
127 
128     enum string[] __fields = ["uuid", "name", "properties", "gamemode", "latency", "hasDisplayName", "displayName"];
129 
130     UUID uuid;
131     string name;
132     soupply.java338.types.Property[] properties;
133     @Var uint gamemode;
134     @Var uint latency;
135     bool hasDisplayName;
136     @Condition("hasDisplayName==true") string displayName;
137 
138     mixin Make!(Endian.bigEndian, varuint);
139 
140     string toString()
141     {
142         return "ListAddPlayer(uuid: " ~ std.conv.to!string(this.uuid) ~ ", name: " ~ std.conv.to!string(this.name) ~ ", properties: " ~ std.conv.to!string(this.properties) ~ ", gamemode: " ~ std.conv.to!string(this.gamemode) ~ ", latency: " ~ std.conv.to!string(this.latency) ~ ", hasDisplayName: " ~ std.conv.to!string(this.hasDisplayName) ~ ", displayName: " ~ std.conv.to!string(this.displayName) ~ ")";
143     }
144 
145 }
146 
147 struct ListUpdateGamemode
148 {
149 
150     // gamemode
151     enum uint SURVIVAL = 0;
152     enum uint CREATIVE = 1;
153     enum uint ADVENTURE = 2;
154     enum uint SPECTATOR = 3;
155 
156     enum string[] __fields = ["uuid", "gamemode"];
157 
158     UUID uuid;
159     @Var uint gamemode;
160 
161     mixin Make!(Endian.bigEndian, varuint);
162 
163     string toString()
164     {
165         return "ListUpdateGamemode(uuid: " ~ std.conv.to!string(this.uuid) ~ ", gamemode: " ~ std.conv.to!string(this.gamemode) ~ ")";
166     }
167 
168 }
169 
170 struct ListUpdateLatency
171 {
172 
173     enum string[] __fields = ["uuid", "latency"];
174 
175     UUID uuid;
176     @Var uint latency;
177 
178     mixin Make!(Endian.bigEndian, varuint);
179 
180     string toString()
181     {
182         return "ListUpdateLatency(uuid: " ~ std.conv.to!string(this.uuid) ~ ", latency: " ~ std.conv.to!string(this.latency) ~ ")";
183     }
184 
185 }
186 
187 struct ListUpdateDisplayName
188 {
189 
190     enum string[] __fields = ["uuid", "hasDisplayName", "displayName"];
191 
192     UUID uuid;
193     bool hasDisplayName;
194     @Condition("hasDisplayName==true") string displayName;
195 
196     mixin Make!(Endian.bigEndian, varuint);
197 
198     string toString()
199     {
200         return "ListUpdateDisplayName(uuid: " ~ std.conv.to!string(this.uuid) ~ ", hasDisplayName: " ~ std.conv.to!string(this.hasDisplayName) ~ ", displayName: " ~ std.conv.to!string(this.displayName) ~ ")";
201     }
202 
203 }
204 
205 struct Modifier
206 {
207 
208     // operation
209     enum ubyte ADD_SUBSTRACT_AMOUNT = 0;
210     enum ubyte ADD_SUBSTRACT_AMOUNT_PERCENTAGE = 1;
211     enum ubyte MULTIPLY_AMOUNT_PERCENTAGE = 2;
212 
213     enum string[] __fields = ["uuid", "amount", "operation"];
214 
215     UUID uuid;
216     double amount;
217     ubyte operation;
218 
219     mixin Make!(Endian.bigEndian, varuint);
220 
221     string toString()
222     {
223         return "Modifier(uuid: " ~ std.conv.to!string(this.uuid) ~ ", amount: " ~ std.conv.to!string(this.amount) ~ ", operation: " ~ std.conv.to!string(this.operation) ~ ")";
224     }
225 
226 }
227 
228 struct Attribute
229 {
230 
231     enum string[] __fields = ["key", "value", "modifiers"];
232 
233     string key;
234     double value;
235     soupply.java338.types.Modifier[] modifiers;
236 
237     mixin Make!(Endian.bigEndian, varuint);
238 
239     string toString()
240     {
241         return "Attribute(key: " ~ std.conv.to!string(this.key) ~ ", value: " ~ std.conv.to!string(this.value) ~ ", modifiers: " ~ std.conv.to!string(this.modifiers) ~ ")";
242     }
243 
244 }
245 
246 struct Entry
247 {
248 
249     enum string[] __fields = ["item", "craftingSlot", "playerSlot"];
250 
251     soupply.java338.types.Slot item;
252     ubyte craftingSlot;
253     ubyte playerSlot;
254 
255     mixin Make!(Endian.bigEndian, varuint);
256 
257     string toString()
258     {
259         return "Entry(item: " ~ std.conv.to!string(this.item) ~ ", craftingSlot: " ~ std.conv.to!string(this.craftingSlot) ~ ", playerSlot: " ~ std.conv.to!string(this.playerSlot) ~ ")";
260     }
261 
262 }
263 
264 struct OptionalPosition
265 {
266 
267     enum string[] __fields = ["hasPosition", "position"];
268 
269     bool hasPosition;
270     @Condition("hasPosition==true") ulong position;
271 
272     mixin Make!(Endian.bigEndian, varuint);
273 
274     string toString()
275     {
276         return "OptionalPosition(hasPosition: " ~ std.conv.to!string(this.hasPosition) ~ ", position: " ~ std.conv.to!string(this.position) ~ ")";
277     }
278 
279 }
280 
281 struct OptionalUuid
282 {
283 
284     enum string[] __fields = ["hasUuid", "uuid"];
285 
286     bool hasUuid;
287     UUID uuid;
288 
289     mixin Make!(Endian.bigEndian, varuint);
290 
291     string toString()
292     {
293         return "OptionalUuid(hasUuid: " ~ std.conv.to!string(this.hasUuid) ~ ", uuid: " ~ std.conv.to!string(this.uuid) ~ ")";
294     }
295 
296 }