1 /*
2  * This file was automatically generated by sel-utils and
3  * released under the MIT License.
4  * 
5  * License: https://github.com/sel-project/sel-utils/blob/master/LICENSE
6  * Repository: https://github.com/sel-project/sel-utils
7  * Generated from https://github.com/sel-project/sel-utils/blob/master/xml/protocol/minecraft109.xml
8  */
9 module sul.protocol.minecraft109.serverbound;
10 
11 import std.bitmanip : write, peek;
12 static import std.conv;
13 import std.system : Endian;
14 import std.typetuple : TypeTuple;
15 import std.typecons : Tuple;
16 import std.uuid : UUID;
17 
18 import sul.utils.buffer;
19 import sul.utils.var;
20 
21 static import sul.protocol.minecraft109.types;
22 
23 static if(__traits(compiles, { import sul.metadata.minecraft109; })) import sul.metadata.minecraft109;
24 
25 alias Packets = TypeTuple!(TeleportConfirm, TabComplete, ChatMessage, ClientStatus, ClientSettings, ConfirmTransaction, EnchantItem, ClickWindow, CloseWindow, PluginMessage, UseEntity, KeepAlive, PlayerPosition, PlayerPositionAndLook, PlayerLook, Player, VehicleMove, SteerBoat, PlayerAbilities, PlayerDigging, EntityAction, SteerVehicle, ResourcePackStatus, HeldItemChange, CreativeInventoryAction, UpdateSign, Animation, Spectate, PlayerBlockPlacement, UseItem);
26 
27 class TeleportConfirm : Buffer {
28 
29 	public enum uint ID = 0;
30 
31 	public enum bool CLIENTBOUND = false;
32 	public enum bool SERVERBOUND = true;
33 
34 	public enum string[] FIELDS = ["teleportId"];
35 
36 	public uint teleportId;
37 
38 	public pure nothrow @safe @nogc this() {}
39 
40 	public pure nothrow @safe @nogc this(uint teleportId) {
41 		this.teleportId = teleportId;
42 	}
43 
44 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
45 		_buffer.length = 0;
46 		static if(writeId){ writeBytes(varuint.encode(ID)); }
47 		writeBytes(varuint.encode(teleportId));
48 		return _buffer;
49 	}
50 
51 	public pure nothrow @safe void decode(bool readId=true)() {
52 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
53 		teleportId=varuint.decode(_buffer, &_index);
54 	}
55 
56 	public static pure nothrow @safe TeleportConfirm fromBuffer(bool readId=true)(ubyte[] buffer) {
57 		TeleportConfirm ret = new TeleportConfirm();
58 		ret._buffer = buffer;
59 		ret.decode!readId();
60 		return ret;
61 	}
62 
63 	public override string toString() {
64 		return "TeleportConfirm(teleportId: " ~ std.conv.to!string(this.teleportId) ~ ")";
65 	}
66 
67 }
68 
69 class TabComplete : Buffer {
70 
71 	public enum uint ID = 1;
72 
73 	public enum bool CLIENTBOUND = false;
74 	public enum bool SERVERBOUND = true;
75 
76 	public enum string[] FIELDS = ["text", "command", "hasPosition", "block"];
77 
78 	public string text;
79 	public bool command;
80 	public bool hasPosition;
81 	public ulong block;
82 
83 	public pure nothrow @safe @nogc this() {}
84 
85 	public pure nothrow @safe @nogc this(string text, bool command=bool.init, bool hasPosition=bool.init, ulong block=ulong.init) {
86 		this.text = text;
87 		this.command = command;
88 		this.hasPosition = hasPosition;
89 		this.block = block;
90 	}
91 
92 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
93 		_buffer.length = 0;
94 		static if(writeId){ writeBytes(varuint.encode(ID)); }
95 		writeBytes(varuint.encode(cast(uint)text.length)); writeString(text);
96 		writeBigEndianBool(command);
97 		writeBigEndianBool(hasPosition);
98 		if(hasPosition==true){ writeBigEndianUlong(block); }
99 		return _buffer;
100 	}
101 
102 	public pure nothrow @safe void decode(bool readId=true)() {
103 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
104 		uint dvd=varuint.decode(_buffer, &_index); text=readString(dvd);
105 		command=readBigEndianBool();
106 		hasPosition=readBigEndianBool();
107 		if(hasPosition==true){ block=readBigEndianUlong(); }
108 	}
109 
110 	public static pure nothrow @safe TabComplete fromBuffer(bool readId=true)(ubyte[] buffer) {
111 		TabComplete ret = new TabComplete();
112 		ret._buffer = buffer;
113 		ret.decode!readId();
114 		return ret;
115 	}
116 
117 	public override string toString() {
118 		return "TabComplete(text: " ~ std.conv.to!string(this.text) ~ ", command: " ~ std.conv.to!string(this.command) ~ ", hasPosition: " ~ std.conv.to!string(this.hasPosition) ~ ", block: " ~ std.conv.to!string(this.block) ~ ")";
119 	}
120 
121 }
122 
123 class ChatMessage : Buffer {
124 
125 	public enum uint ID = 2;
126 
127 	public enum bool CLIENTBOUND = false;
128 	public enum bool SERVERBOUND = true;
129 
130 	public enum string[] FIELDS = ["text"];
131 
132 	public string text;
133 
134 	public pure nothrow @safe @nogc this() {}
135 
136 	public pure nothrow @safe @nogc this(string text) {
137 		this.text = text;
138 	}
139 
140 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
141 		_buffer.length = 0;
142 		static if(writeId){ writeBytes(varuint.encode(ID)); }
143 		writeBytes(varuint.encode(cast(uint)text.length)); writeString(text);
144 		return _buffer;
145 	}
146 
147 	public pure nothrow @safe void decode(bool readId=true)() {
148 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
149 		uint dvd=varuint.decode(_buffer, &_index); text=readString(dvd);
150 	}
151 
152 	public static pure nothrow @safe ChatMessage fromBuffer(bool readId=true)(ubyte[] buffer) {
153 		ChatMessage ret = new ChatMessage();
154 		ret._buffer = buffer;
155 		ret.decode!readId();
156 		return ret;
157 	}
158 
159 	public override string toString() {
160 		return "ChatMessage(text: " ~ std.conv.to!string(this.text) ~ ")";
161 	}
162 
163 }
164 
165 class ClientStatus : Buffer {
166 
167 	public enum uint ID = 3;
168 
169 	public enum bool CLIENTBOUND = false;
170 	public enum bool SERVERBOUND = true;
171 
172 	// action
173 	public enum uint RESPAWN = 0;
174 	public enum uint REQUEST_STATS = 1;
175 	public enum uint OPEN_INVENTORY = 2;
176 
177 	public enum string[] FIELDS = ["action"];
178 
179 	public uint action;
180 
181 	public pure nothrow @safe @nogc this() {}
182 
183 	public pure nothrow @safe @nogc this(uint action) {
184 		this.action = action;
185 	}
186 
187 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
188 		_buffer.length = 0;
189 		static if(writeId){ writeBytes(varuint.encode(ID)); }
190 		writeBytes(varuint.encode(action));
191 		return _buffer;
192 	}
193 
194 	public pure nothrow @safe void decode(bool readId=true)() {
195 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
196 		action=varuint.decode(_buffer, &_index);
197 	}
198 
199 	public static pure nothrow @safe ClientStatus fromBuffer(bool readId=true)(ubyte[] buffer) {
200 		ClientStatus ret = new ClientStatus();
201 		ret._buffer = buffer;
202 		ret.decode!readId();
203 		return ret;
204 	}
205 
206 	public override string toString() {
207 		return "ClientStatus(action: " ~ std.conv.to!string(this.action) ~ ")";
208 	}
209 
210 }
211 
212 class ClientSettings : Buffer {
213 
214 	public enum uint ID = 4;
215 
216 	public enum bool CLIENTBOUND = false;
217 	public enum bool SERVERBOUND = true;
218 
219 	// chat mode
220 	public enum uint ENABLED = 0;
221 	public enum uint COMMANDS_ONLY = 1;
222 	public enum uint DISABLED = 2;
223 
224 	// displayed skin parts
225 	public enum ubyte CAPE = 1;
226 	public enum ubyte JACKET = 2;
227 	public enum ubyte LEFT_SLEEVE = 4;
228 	public enum ubyte RIGHT_SLEEVE = 8;
229 	public enum ubyte LEFT_PANTS = 16;
230 	public enum ubyte RIGHT_PANTS = 32;
231 	public enum ubyte HAT = 64;
232 
233 	// main hand
234 	public enum ubyte RIGHT = 0;
235 	public enum ubyte LEFT = 1;
236 
237 	public enum string[] FIELDS = ["language", "viewDistance", "chatMode", "chatColors", "displayedSkinParts", "mainHand"];
238 
239 	public string language;
240 	public ubyte viewDistance;
241 	public uint chatMode;
242 	public bool chatColors;
243 	public ubyte displayedSkinParts;
244 	public ubyte mainHand;
245 
246 	public pure nothrow @safe @nogc this() {}
247 
248 	public pure nothrow @safe @nogc this(string language, ubyte viewDistance=ubyte.init, uint chatMode=uint.init, bool chatColors=bool.init, ubyte displayedSkinParts=ubyte.init, ubyte mainHand=ubyte.init) {
249 		this.language = language;
250 		this.viewDistance = viewDistance;
251 		this.chatMode = chatMode;
252 		this.chatColors = chatColors;
253 		this.displayedSkinParts = displayedSkinParts;
254 		this.mainHand = mainHand;
255 	}
256 
257 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
258 		_buffer.length = 0;
259 		static if(writeId){ writeBytes(varuint.encode(ID)); }
260 		writeBytes(varuint.encode(cast(uint)language.length)); writeString(language);
261 		writeBigEndianUbyte(viewDistance);
262 		writeBytes(varuint.encode(chatMode));
263 		writeBigEndianBool(chatColors);
264 		writeBigEndianUbyte(displayedSkinParts);
265 		writeBigEndianUbyte(mainHand);
266 		return _buffer;
267 	}
268 
269 	public pure nothrow @safe void decode(bool readId=true)() {
270 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
271 		uint bfzvzu=varuint.decode(_buffer, &_index); language=readString(bfzvzu);
272 		viewDistance=readBigEndianUbyte();
273 		chatMode=varuint.decode(_buffer, &_index);
274 		chatColors=readBigEndianBool();
275 		displayedSkinParts=readBigEndianUbyte();
276 		mainHand=readBigEndianUbyte();
277 	}
278 
279 	public static pure nothrow @safe ClientSettings fromBuffer(bool readId=true)(ubyte[] buffer) {
280 		ClientSettings ret = new ClientSettings();
281 		ret._buffer = buffer;
282 		ret.decode!readId();
283 		return ret;
284 	}
285 
286 	public override string toString() {
287 		return "ClientSettings(language: " ~ std.conv.to!string(this.language) ~ ", viewDistance: " ~ std.conv.to!string(this.viewDistance) ~ ", chatMode: " ~ std.conv.to!string(this.chatMode) ~ ", chatColors: " ~ std.conv.to!string(this.chatColors) ~ ", displayedSkinParts: " ~ std.conv.to!string(this.displayedSkinParts) ~ ", mainHand: " ~ std.conv.to!string(this.mainHand) ~ ")";
288 	}
289 
290 }
291 
292 class ConfirmTransaction : Buffer {
293 
294 	public enum uint ID = 5;
295 
296 	public enum bool CLIENTBOUND = false;
297 	public enum bool SERVERBOUND = true;
298 
299 	public enum string[] FIELDS = ["window", "action", "accepted"];
300 
301 	public ubyte window;
302 	public ushort action;
303 	public bool accepted;
304 
305 	public pure nothrow @safe @nogc this() {}
306 
307 	public pure nothrow @safe @nogc this(ubyte window, ushort action=ushort.init, bool accepted=bool.init) {
308 		this.window = window;
309 		this.action = action;
310 		this.accepted = accepted;
311 	}
312 
313 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
314 		_buffer.length = 0;
315 		static if(writeId){ writeBytes(varuint.encode(ID)); }
316 		writeBigEndianUbyte(window);
317 		writeBigEndianUshort(action);
318 		writeBigEndianBool(accepted);
319 		return _buffer;
320 	}
321 
322 	public pure nothrow @safe void decode(bool readId=true)() {
323 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
324 		window=readBigEndianUbyte();
325 		action=readBigEndianUshort();
326 		accepted=readBigEndianBool();
327 	}
328 
329 	public static pure nothrow @safe ConfirmTransaction fromBuffer(bool readId=true)(ubyte[] buffer) {
330 		ConfirmTransaction ret = new ConfirmTransaction();
331 		ret._buffer = buffer;
332 		ret.decode!readId();
333 		return ret;
334 	}
335 
336 	public override string toString() {
337 		return "ConfirmTransaction(window: " ~ std.conv.to!string(this.window) ~ ", action: " ~ std.conv.to!string(this.action) ~ ", accepted: " ~ std.conv.to!string(this.accepted) ~ ")";
338 	}
339 
340 }
341 
342 class EnchantItem : Buffer {
343 
344 	public enum uint ID = 6;
345 
346 	public enum bool CLIENTBOUND = false;
347 	public enum bool SERVERBOUND = true;
348 
349 	public enum string[] FIELDS = ["window", "enchantment"];
350 
351 	public ubyte window;
352 	public ubyte enchantment;
353 
354 	public pure nothrow @safe @nogc this() {}
355 
356 	public pure nothrow @safe @nogc this(ubyte window, ubyte enchantment=ubyte.init) {
357 		this.window = window;
358 		this.enchantment = enchantment;
359 	}
360 
361 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
362 		_buffer.length = 0;
363 		static if(writeId){ writeBytes(varuint.encode(ID)); }
364 		writeBigEndianUbyte(window);
365 		writeBigEndianUbyte(enchantment);
366 		return _buffer;
367 	}
368 
369 	public pure nothrow @safe void decode(bool readId=true)() {
370 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
371 		window=readBigEndianUbyte();
372 		enchantment=readBigEndianUbyte();
373 	}
374 
375 	public static pure nothrow @safe EnchantItem fromBuffer(bool readId=true)(ubyte[] buffer) {
376 		EnchantItem ret = new EnchantItem();
377 		ret._buffer = buffer;
378 		ret.decode!readId();
379 		return ret;
380 	}
381 
382 	public override string toString() {
383 		return "EnchantItem(window: " ~ std.conv.to!string(this.window) ~ ", enchantment: " ~ std.conv.to!string(this.enchantment) ~ ")";
384 	}
385 
386 }
387 
388 class ClickWindow : Buffer {
389 
390 	public enum uint ID = 7;
391 
392 	public enum bool CLIENTBOUND = false;
393 	public enum bool SERVERBOUND = true;
394 
395 	public enum string[] FIELDS = ["window", "slot", "button", "action", "mode", "clickedItem"];
396 
397 	public ubyte window;
398 	public ushort slot;
399 	public ubyte button;
400 	public ushort action;
401 	public uint mode;
402 	public sul.protocol.minecraft109.types.Slot clickedItem;
403 
404 	public pure nothrow @safe @nogc this() {}
405 
406 	public pure nothrow @safe @nogc this(ubyte window, ushort slot=ushort.init, ubyte button=ubyte.init, ushort action=ushort.init, uint mode=uint.init, sul.protocol.minecraft109.types.Slot clickedItem=sul.protocol.minecraft109.types.Slot.init) {
407 		this.window = window;
408 		this.slot = slot;
409 		this.button = button;
410 		this.action = action;
411 		this.mode = mode;
412 		this.clickedItem = clickedItem;
413 	}
414 
415 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
416 		_buffer.length = 0;
417 		static if(writeId){ writeBytes(varuint.encode(ID)); }
418 		writeBigEndianUbyte(window);
419 		writeBigEndianUshort(slot);
420 		writeBigEndianUbyte(button);
421 		writeBigEndianUshort(action);
422 		writeBytes(varuint.encode(mode));
423 		clickedItem.encode(bufferInstance);
424 		return _buffer;
425 	}
426 
427 	public pure nothrow @safe void decode(bool readId=true)() {
428 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
429 		window=readBigEndianUbyte();
430 		slot=readBigEndianUshort();
431 		button=readBigEndianUbyte();
432 		action=readBigEndianUshort();
433 		mode=varuint.decode(_buffer, &_index);
434 		clickedItem.decode(bufferInstance);
435 	}
436 
437 	public static pure nothrow @safe ClickWindow fromBuffer(bool readId=true)(ubyte[] buffer) {
438 		ClickWindow ret = new ClickWindow();
439 		ret._buffer = buffer;
440 		ret.decode!readId();
441 		return ret;
442 	}
443 
444 	public override string toString() {
445 		return "ClickWindow(window: " ~ std.conv.to!string(this.window) ~ ", slot: " ~ std.conv.to!string(this.slot) ~ ", button: " ~ std.conv.to!string(this.button) ~ ", action: " ~ std.conv.to!string(this.action) ~ ", mode: " ~ std.conv.to!string(this.mode) ~ ", clickedItem: " ~ std.conv.to!string(this.clickedItem) ~ ")";
446 	}
447 
448 }
449 
450 class CloseWindow : Buffer {
451 
452 	public enum uint ID = 8;
453 
454 	public enum bool CLIENTBOUND = false;
455 	public enum bool SERVERBOUND = true;
456 
457 	public enum string[] FIELDS = ["window"];
458 
459 	public ubyte window;
460 
461 	public pure nothrow @safe @nogc this() {}
462 
463 	public pure nothrow @safe @nogc this(ubyte window) {
464 		this.window = window;
465 	}
466 
467 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
468 		_buffer.length = 0;
469 		static if(writeId){ writeBytes(varuint.encode(ID)); }
470 		writeBigEndianUbyte(window);
471 		return _buffer;
472 	}
473 
474 	public pure nothrow @safe void decode(bool readId=true)() {
475 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
476 		window=readBigEndianUbyte();
477 	}
478 
479 	public static pure nothrow @safe CloseWindow fromBuffer(bool readId=true)(ubyte[] buffer) {
480 		CloseWindow ret = new CloseWindow();
481 		ret._buffer = buffer;
482 		ret.decode!readId();
483 		return ret;
484 	}
485 
486 	public override string toString() {
487 		return "CloseWindow(window: " ~ std.conv.to!string(this.window) ~ ")";
488 	}
489 
490 }
491 
492 class PluginMessage : Buffer {
493 
494 	public enum uint ID = 9;
495 
496 	public enum bool CLIENTBOUND = false;
497 	public enum bool SERVERBOUND = true;
498 
499 	public enum string[] FIELDS = ["channel", "data"];
500 
501 	public string channel;
502 	public ubyte[] data;
503 
504 	public pure nothrow @safe @nogc this() {}
505 
506 	public pure nothrow @safe @nogc this(string channel, ubyte[] data=(ubyte[]).init) {
507 		this.channel = channel;
508 		this.data = data;
509 	}
510 
511 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
512 		_buffer.length = 0;
513 		static if(writeId){ writeBytes(varuint.encode(ID)); }
514 		writeBytes(varuint.encode(cast(uint)channel.length)); writeString(channel);
515 		writeBytes(data);
516 		return _buffer;
517 	}
518 
519 	public pure nothrow @safe void decode(bool readId=true)() {
520 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
521 		uint yhb5b=varuint.decode(_buffer, &_index); channel=readString(yhb5b);
522 		data=_buffer[_index..$].dup; _index=_buffer.length;
523 	}
524 
525 	public static pure nothrow @safe PluginMessage fromBuffer(bool readId=true)(ubyte[] buffer) {
526 		PluginMessage ret = new PluginMessage();
527 		ret._buffer = buffer;
528 		ret.decode!readId();
529 		return ret;
530 	}
531 
532 	public override string toString() {
533 		return "PluginMessage(channel: " ~ std.conv.to!string(this.channel) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")";
534 	}
535 
536 }
537 
538 class UseEntity : Buffer {
539 
540 	public enum uint ID = 10;
541 
542 	public enum bool CLIENTBOUND = false;
543 	public enum bool SERVERBOUND = true;
544 
545 	// type
546 	public enum uint INTERACT = 0;
547 	public enum uint ATTACK = 1;
548 	public enum uint INTERACT_AT = 2;
549 
550 	// hand
551 	public enum uint MAIN_HAND = 0;
552 	public enum uint OFF_HAND = 1;
553 
554 	public enum string[] FIELDS = ["target", "type", "targetPosition", "hand"];
555 
556 	public uint target;
557 	public uint type;
558 	public Tuple!(float, "x", float, "y", float, "z") targetPosition;
559 	public uint hand;
560 
561 	public pure nothrow @safe @nogc this() {}
562 
563 	public pure nothrow @safe @nogc this(uint target, uint type=uint.init, Tuple!(float, "x", float, "y", float, "z") targetPosition=Tuple!(float, "x", float, "y", float, "z").init, uint hand=uint.init) {
564 		this.target = target;
565 		this.type = type;
566 		this.targetPosition = targetPosition;
567 		this.hand = hand;
568 	}
569 
570 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
571 		_buffer.length = 0;
572 		static if(writeId){ writeBytes(varuint.encode(ID)); }
573 		writeBytes(varuint.encode(target));
574 		writeBytes(varuint.encode(type));
575 		if(type==2){ writeBigEndianFloat(targetPosition.x); writeBigEndianFloat(targetPosition.y); writeBigEndianFloat(targetPosition.z); }
576 		if(type==2){ writeBytes(varuint.encode(hand)); }
577 		return _buffer;
578 	}
579 
580 	public pure nothrow @safe void decode(bool readId=true)() {
581 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
582 		target=varuint.decode(_buffer, &_index);
583 		type=varuint.decode(_buffer, &_index);
584 		if(type==2){ targetPosition.x=readBigEndianFloat(); targetPosition.y=readBigEndianFloat(); targetPosition.z=readBigEndianFloat(); }
585 		if(type==2){ hand=varuint.decode(_buffer, &_index); }
586 	}
587 
588 	public static pure nothrow @safe UseEntity fromBuffer(bool readId=true)(ubyte[] buffer) {
589 		UseEntity ret = new UseEntity();
590 		ret._buffer = buffer;
591 		ret.decode!readId();
592 		return ret;
593 	}
594 
595 	public override string toString() {
596 		return "UseEntity(target: " ~ std.conv.to!string(this.target) ~ ", type: " ~ std.conv.to!string(this.type) ~ ", targetPosition: " ~ std.conv.to!string(this.targetPosition) ~ ", hand: " ~ std.conv.to!string(this.hand) ~ ")";
597 	}
598 
599 }
600 
601 class KeepAlive : Buffer {
602 
603 	public enum uint ID = 11;
604 
605 	public enum bool CLIENTBOUND = false;
606 	public enum bool SERVERBOUND = true;
607 
608 	public enum string[] FIELDS = ["id"];
609 
610 	public uint id;
611 
612 	public pure nothrow @safe @nogc this() {}
613 
614 	public pure nothrow @safe @nogc this(uint id) {
615 		this.id = id;
616 	}
617 
618 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
619 		_buffer.length = 0;
620 		static if(writeId){ writeBytes(varuint.encode(ID)); }
621 		writeBytes(varuint.encode(id));
622 		return _buffer;
623 	}
624 
625 	public pure nothrow @safe void decode(bool readId=true)() {
626 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
627 		id=varuint.decode(_buffer, &_index);
628 	}
629 
630 	public static pure nothrow @safe KeepAlive fromBuffer(bool readId=true)(ubyte[] buffer) {
631 		KeepAlive ret = new KeepAlive();
632 		ret._buffer = buffer;
633 		ret.decode!readId();
634 		return ret;
635 	}
636 
637 	public override string toString() {
638 		return "KeepAlive(id: " ~ std.conv.to!string(this.id) ~ ")";
639 	}
640 
641 }
642 
643 class PlayerPosition : Buffer {
644 
645 	public enum uint ID = 12;
646 
647 	public enum bool CLIENTBOUND = false;
648 	public enum bool SERVERBOUND = true;
649 
650 	public enum string[] FIELDS = ["position", "onGround"];
651 
652 	public Tuple!(double, "x", double, "y", double, "z") position;
653 	public bool onGround;
654 
655 	public pure nothrow @safe @nogc this() {}
656 
657 	public pure nothrow @safe @nogc this(Tuple!(double, "x", double, "y", double, "z") position, bool onGround=bool.init) {
658 		this.position = position;
659 		this.onGround = onGround;
660 	}
661 
662 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
663 		_buffer.length = 0;
664 		static if(writeId){ writeBytes(varuint.encode(ID)); }
665 		writeBigEndianDouble(position.x); writeBigEndianDouble(position.y); writeBigEndianDouble(position.z);
666 		writeBigEndianBool(onGround);
667 		return _buffer;
668 	}
669 
670 	public pure nothrow @safe void decode(bool readId=true)() {
671 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
672 		position.x=readBigEndianDouble(); position.y=readBigEndianDouble(); position.z=readBigEndianDouble();
673 		onGround=readBigEndianBool();
674 	}
675 
676 	public static pure nothrow @safe PlayerPosition fromBuffer(bool readId=true)(ubyte[] buffer) {
677 		PlayerPosition ret = new PlayerPosition();
678 		ret._buffer = buffer;
679 		ret.decode!readId();
680 		return ret;
681 	}
682 
683 	public override string toString() {
684 		return "PlayerPosition(position: " ~ std.conv.to!string(this.position) ~ ", onGround: " ~ std.conv.to!string(this.onGround) ~ ")";
685 	}
686 
687 }
688 
689 class PlayerPositionAndLook : Buffer {
690 
691 	public enum uint ID = 13;
692 
693 	public enum bool CLIENTBOUND = false;
694 	public enum bool SERVERBOUND = true;
695 
696 	public enum string[] FIELDS = ["position", "yaw", "pitch", "onGround"];
697 
698 	public Tuple!(double, "x", double, "y", double, "z") position;
699 	public float yaw;
700 	public float pitch;
701 	public bool onGround;
702 
703 	public pure nothrow @safe @nogc this() {}
704 
705 	public pure nothrow @safe @nogc this(Tuple!(double, "x", double, "y", double, "z") position, float yaw=float.init, float pitch=float.init, bool onGround=bool.init) {
706 		this.position = position;
707 		this.yaw = yaw;
708 		this.pitch = pitch;
709 		this.onGround = onGround;
710 	}
711 
712 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
713 		_buffer.length = 0;
714 		static if(writeId){ writeBytes(varuint.encode(ID)); }
715 		writeBigEndianDouble(position.x); writeBigEndianDouble(position.y); writeBigEndianDouble(position.z);
716 		writeBigEndianFloat(yaw);
717 		writeBigEndianFloat(pitch);
718 		writeBigEndianBool(onGround);
719 		return _buffer;
720 	}
721 
722 	public pure nothrow @safe void decode(bool readId=true)() {
723 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
724 		position.x=readBigEndianDouble(); position.y=readBigEndianDouble(); position.z=readBigEndianDouble();
725 		yaw=readBigEndianFloat();
726 		pitch=readBigEndianFloat();
727 		onGround=readBigEndianBool();
728 	}
729 
730 	public static pure nothrow @safe PlayerPositionAndLook fromBuffer(bool readId=true)(ubyte[] buffer) {
731 		PlayerPositionAndLook ret = new PlayerPositionAndLook();
732 		ret._buffer = buffer;
733 		ret.decode!readId();
734 		return ret;
735 	}
736 
737 	public override string toString() {
738 		return "PlayerPositionAndLook(position: " ~ std.conv.to!string(this.position) ~ ", yaw: " ~ std.conv.to!string(this.yaw) ~ ", pitch: " ~ std.conv.to!string(this.pitch) ~ ", onGround: " ~ std.conv.to!string(this.onGround) ~ ")";
739 	}
740 
741 }
742 
743 class PlayerLook : Buffer {
744 
745 	public enum uint ID = 14;
746 
747 	public enum bool CLIENTBOUND = false;
748 	public enum bool SERVERBOUND = true;
749 
750 	public enum string[] FIELDS = ["yaw", "pitch", "onGround"];
751 
752 	public float yaw;
753 	public float pitch;
754 	public bool onGround;
755 
756 	public pure nothrow @safe @nogc this() {}
757 
758 	public pure nothrow @safe @nogc this(float yaw, float pitch=float.init, bool onGround=bool.init) {
759 		this.yaw = yaw;
760 		this.pitch = pitch;
761 		this.onGround = onGround;
762 	}
763 
764 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
765 		_buffer.length = 0;
766 		static if(writeId){ writeBytes(varuint.encode(ID)); }
767 		writeBigEndianFloat(yaw);
768 		writeBigEndianFloat(pitch);
769 		writeBigEndianBool(onGround);
770 		return _buffer;
771 	}
772 
773 	public pure nothrow @safe void decode(bool readId=true)() {
774 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
775 		yaw=readBigEndianFloat();
776 		pitch=readBigEndianFloat();
777 		onGround=readBigEndianBool();
778 	}
779 
780 	public static pure nothrow @safe PlayerLook fromBuffer(bool readId=true)(ubyte[] buffer) {
781 		PlayerLook ret = new PlayerLook();
782 		ret._buffer = buffer;
783 		ret.decode!readId();
784 		return ret;
785 	}
786 
787 	public override string toString() {
788 		return "PlayerLook(yaw: " ~ std.conv.to!string(this.yaw) ~ ", pitch: " ~ std.conv.to!string(this.pitch) ~ ", onGround: " ~ std.conv.to!string(this.onGround) ~ ")";
789 	}
790 
791 }
792 
793 class Player : Buffer {
794 
795 	public enum uint ID = 15;
796 
797 	public enum bool CLIENTBOUND = false;
798 	public enum bool SERVERBOUND = true;
799 
800 	public enum string[] FIELDS = ["onGround"];
801 
802 	public bool onGround;
803 
804 	public pure nothrow @safe @nogc this() {}
805 
806 	public pure nothrow @safe @nogc this(bool onGround) {
807 		this.onGround = onGround;
808 	}
809 
810 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
811 		_buffer.length = 0;
812 		static if(writeId){ writeBytes(varuint.encode(ID)); }
813 		writeBigEndianBool(onGround);
814 		return _buffer;
815 	}
816 
817 	public pure nothrow @safe void decode(bool readId=true)() {
818 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
819 		onGround=readBigEndianBool();
820 	}
821 
822 	public static pure nothrow @safe Player fromBuffer(bool readId=true)(ubyte[] buffer) {
823 		Player ret = new Player();
824 		ret._buffer = buffer;
825 		ret.decode!readId();
826 		return ret;
827 	}
828 
829 	public override string toString() {
830 		return "Player(onGround: " ~ std.conv.to!string(this.onGround) ~ ")";
831 	}
832 
833 }
834 
835 class VehicleMove : Buffer {
836 
837 	public enum uint ID = 16;
838 
839 	public enum bool CLIENTBOUND = false;
840 	public enum bool SERVERBOUND = true;
841 
842 	public enum string[] FIELDS = ["position", "yaw", "pitch"];
843 
844 	public Tuple!(double, "x", double, "y", double, "z") position;
845 	public float yaw;
846 	public float pitch;
847 
848 	public pure nothrow @safe @nogc this() {}
849 
850 	public pure nothrow @safe @nogc this(Tuple!(double, "x", double, "y", double, "z") position, float yaw=float.init, float pitch=float.init) {
851 		this.position = position;
852 		this.yaw = yaw;
853 		this.pitch = pitch;
854 	}
855 
856 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
857 		_buffer.length = 0;
858 		static if(writeId){ writeBytes(varuint.encode(ID)); }
859 		writeBigEndianDouble(position.x); writeBigEndianDouble(position.y); writeBigEndianDouble(position.z);
860 		writeBigEndianFloat(yaw);
861 		writeBigEndianFloat(pitch);
862 		return _buffer;
863 	}
864 
865 	public pure nothrow @safe void decode(bool readId=true)() {
866 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
867 		position.x=readBigEndianDouble(); position.y=readBigEndianDouble(); position.z=readBigEndianDouble();
868 		yaw=readBigEndianFloat();
869 		pitch=readBigEndianFloat();
870 	}
871 
872 	public static pure nothrow @safe VehicleMove fromBuffer(bool readId=true)(ubyte[] buffer) {
873 		VehicleMove ret = new VehicleMove();
874 		ret._buffer = buffer;
875 		ret.decode!readId();
876 		return ret;
877 	}
878 
879 	public override string toString() {
880 		return "VehicleMove(position: " ~ std.conv.to!string(this.position) ~ ", yaw: " ~ std.conv.to!string(this.yaw) ~ ", pitch: " ~ std.conv.to!string(this.pitch) ~ ")";
881 	}
882 
883 }
884 
885 class SteerBoat : Buffer {
886 
887 	public enum uint ID = 17;
888 
889 	public enum bool CLIENTBOUND = false;
890 	public enum bool SERVERBOUND = true;
891 
892 	public enum string[] FIELDS = ["rightPaddleTurning", "leftPaddleTurning"];
893 
894 	public bool rightPaddleTurning;
895 	public bool leftPaddleTurning;
896 
897 	public pure nothrow @safe @nogc this() {}
898 
899 	public pure nothrow @safe @nogc this(bool rightPaddleTurning, bool leftPaddleTurning=bool.init) {
900 		this.rightPaddleTurning = rightPaddleTurning;
901 		this.leftPaddleTurning = leftPaddleTurning;
902 	}
903 
904 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
905 		_buffer.length = 0;
906 		static if(writeId){ writeBytes(varuint.encode(ID)); }
907 		writeBigEndianBool(rightPaddleTurning);
908 		writeBigEndianBool(leftPaddleTurning);
909 		return _buffer;
910 	}
911 
912 	public pure nothrow @safe void decode(bool readId=true)() {
913 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
914 		rightPaddleTurning=readBigEndianBool();
915 		leftPaddleTurning=readBigEndianBool();
916 	}
917 
918 	public static pure nothrow @safe SteerBoat fromBuffer(bool readId=true)(ubyte[] buffer) {
919 		SteerBoat ret = new SteerBoat();
920 		ret._buffer = buffer;
921 		ret.decode!readId();
922 		return ret;
923 	}
924 
925 	public override string toString() {
926 		return "SteerBoat(rightPaddleTurning: " ~ std.conv.to!string(this.rightPaddleTurning) ~ ", leftPaddleTurning: " ~ std.conv.to!string(this.leftPaddleTurning) ~ ")";
927 	}
928 
929 }
930 
931 class PlayerAbilities : Buffer {
932 
933 	public enum uint ID = 18;
934 
935 	public enum bool CLIENTBOUND = false;
936 	public enum bool SERVERBOUND = true;
937 
938 	// flags
939 	public enum ubyte CREATIVE_MODE = 1;
940 	public enum ubyte FLYING = 2;
941 	public enum ubyte ALLOW_FLYING = 4;
942 	public enum ubyte INVINCIBLE = 8;
943 
944 	public enum string[] FIELDS = ["flags", "flyingSpeed", "walkingSpeed"];
945 
946 	public ubyte flags;
947 	public float flyingSpeed;
948 	public float walkingSpeed;
949 
950 	public pure nothrow @safe @nogc this() {}
951 
952 	public pure nothrow @safe @nogc this(ubyte flags, float flyingSpeed=float.init, float walkingSpeed=float.init) {
953 		this.flags = flags;
954 		this.flyingSpeed = flyingSpeed;
955 		this.walkingSpeed = walkingSpeed;
956 	}
957 
958 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
959 		_buffer.length = 0;
960 		static if(writeId){ writeBytes(varuint.encode(ID)); }
961 		writeBigEndianUbyte(flags);
962 		writeBigEndianFloat(flyingSpeed);
963 		writeBigEndianFloat(walkingSpeed);
964 		return _buffer;
965 	}
966 
967 	public pure nothrow @safe void decode(bool readId=true)() {
968 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
969 		flags=readBigEndianUbyte();
970 		flyingSpeed=readBigEndianFloat();
971 		walkingSpeed=readBigEndianFloat();
972 	}
973 
974 	public static pure nothrow @safe PlayerAbilities fromBuffer(bool readId=true)(ubyte[] buffer) {
975 		PlayerAbilities ret = new PlayerAbilities();
976 		ret._buffer = buffer;
977 		ret.decode!readId();
978 		return ret;
979 	}
980 
981 	public override string toString() {
982 		return "PlayerAbilities(flags: " ~ std.conv.to!string(this.flags) ~ ", flyingSpeed: " ~ std.conv.to!string(this.flyingSpeed) ~ ", walkingSpeed: " ~ std.conv.to!string(this.walkingSpeed) ~ ")";
983 	}
984 
985 }
986 
987 class PlayerDigging : Buffer {
988 
989 	public enum uint ID = 19;
990 
991 	public enum bool CLIENTBOUND = false;
992 	public enum bool SERVERBOUND = true;
993 
994 	// status
995 	public enum uint START_DIGGING = 0;
996 	public enum uint CANCEL_DIGGING = 1;
997 	public enum uint FINISH_DIGGING = 2;
998 	public enum uint DROP_ITEM_STACK = 3;
999 	public enum uint DROP_ITEM = 4;
1000 	public enum uint SHOOT_ARROW = 5;
1001 	public enum uint FINISH_EATING = 5;
1002 	public enum uint SWAP_ITEM_IN_HAND = 6;
1003 
1004 	public enum string[] FIELDS = ["status", "position", "face"];
1005 
1006 	public uint status;
1007 	public ulong position;
1008 	public ubyte face;
1009 
1010 	public pure nothrow @safe @nogc this() {}
1011 
1012 	public pure nothrow @safe @nogc this(uint status, ulong position=ulong.init, ubyte face=ubyte.init) {
1013 		this.status = status;
1014 		this.position = position;
1015 		this.face = face;
1016 	}
1017 
1018 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
1019 		_buffer.length = 0;
1020 		static if(writeId){ writeBytes(varuint.encode(ID)); }
1021 		writeBytes(varuint.encode(status));
1022 		writeBigEndianUlong(position);
1023 		writeBigEndianUbyte(face);
1024 		return _buffer;
1025 	}
1026 
1027 	public pure nothrow @safe void decode(bool readId=true)() {
1028 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
1029 		status=varuint.decode(_buffer, &_index);
1030 		position=readBigEndianUlong();
1031 		face=readBigEndianUbyte();
1032 	}
1033 
1034 	public static pure nothrow @safe PlayerDigging fromBuffer(bool readId=true)(ubyte[] buffer) {
1035 		PlayerDigging ret = new PlayerDigging();
1036 		ret._buffer = buffer;
1037 		ret.decode!readId();
1038 		return ret;
1039 	}
1040 
1041 	public override string toString() {
1042 		return "PlayerDigging(status: " ~ std.conv.to!string(this.status) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", face: " ~ std.conv.to!string(this.face) ~ ")";
1043 	}
1044 
1045 }
1046 
1047 class EntityAction : Buffer {
1048 
1049 	public enum uint ID = 20;
1050 
1051 	public enum bool CLIENTBOUND = false;
1052 	public enum bool SERVERBOUND = true;
1053 
1054 	// action
1055 	public enum uint START_SNEAKING = 0;
1056 	public enum uint STOP_SNEAKING = 1;
1057 	public enum uint LEAVE_BED = 2;
1058 	public enum uint START_SPRINTING = 3;
1059 	public enum uint STOP_SPRINTING = 4;
1060 	public enum uint START_HORSE_JUMP = 5;
1061 	public enum uint STOP_HORSE_JUMP = 6;
1062 	public enum uint OPEN_HORSE_INVENTORY = 7;
1063 	public enum uint START_ELYTRA_FLYING = 8;
1064 
1065 	public enum string[] FIELDS = ["entityId", "action", "jumpBoost"];
1066 
1067 	public uint entityId;
1068 	public uint action;
1069 	public uint jumpBoost;
1070 
1071 	public pure nothrow @safe @nogc this() {}
1072 
1073 	public pure nothrow @safe @nogc this(uint entityId, uint action=uint.init, uint jumpBoost=uint.init) {
1074 		this.entityId = entityId;
1075 		this.action = action;
1076 		this.jumpBoost = jumpBoost;
1077 	}
1078 
1079 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
1080 		_buffer.length = 0;
1081 		static if(writeId){ writeBytes(varuint.encode(ID)); }
1082 		writeBytes(varuint.encode(entityId));
1083 		writeBytes(varuint.encode(action));
1084 		if(action==5){ writeBytes(varuint.encode(jumpBoost)); }
1085 		return _buffer;
1086 	}
1087 
1088 	public pure nothrow @safe void decode(bool readId=true)() {
1089 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
1090 		entityId=varuint.decode(_buffer, &_index);
1091 		action=varuint.decode(_buffer, &_index);
1092 		if(action==5){ jumpBoost=varuint.decode(_buffer, &_index); }
1093 	}
1094 
1095 	public static pure nothrow @safe EntityAction fromBuffer(bool readId=true)(ubyte[] buffer) {
1096 		EntityAction ret = new EntityAction();
1097 		ret._buffer = buffer;
1098 		ret.decode!readId();
1099 		return ret;
1100 	}
1101 
1102 	public override string toString() {
1103 		return "EntityAction(entityId: " ~ std.conv.to!string(this.entityId) ~ ", action: " ~ std.conv.to!string(this.action) ~ ", jumpBoost: " ~ std.conv.to!string(this.jumpBoost) ~ ")";
1104 	}
1105 
1106 }
1107 
1108 class SteerVehicle : Buffer {
1109 
1110 	public enum uint ID = 21;
1111 
1112 	public enum bool CLIENTBOUND = false;
1113 	public enum bool SERVERBOUND = true;
1114 
1115 	// flags
1116 	public enum ubyte JUMP = 1;
1117 	public enum ubyte UNMOUNT = 2;
1118 
1119 	public enum string[] FIELDS = ["sideways", "forward", "flags"];
1120 
1121 	public float sideways;
1122 	public float forward;
1123 	public ubyte flags;
1124 
1125 	public pure nothrow @safe @nogc this() {}
1126 
1127 	public pure nothrow @safe @nogc this(float sideways, float forward=float.init, ubyte flags=ubyte.init) {
1128 		this.sideways = sideways;
1129 		this.forward = forward;
1130 		this.flags = flags;
1131 	}
1132 
1133 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
1134 		_buffer.length = 0;
1135 		static if(writeId){ writeBytes(varuint.encode(ID)); }
1136 		writeBigEndianFloat(sideways);
1137 		writeBigEndianFloat(forward);
1138 		writeBigEndianUbyte(flags);
1139 		return _buffer;
1140 	}
1141 
1142 	public pure nothrow @safe void decode(bool readId=true)() {
1143 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
1144 		sideways=readBigEndianFloat();
1145 		forward=readBigEndianFloat();
1146 		flags=readBigEndianUbyte();
1147 	}
1148 
1149 	public static pure nothrow @safe SteerVehicle fromBuffer(bool readId=true)(ubyte[] buffer) {
1150 		SteerVehicle ret = new SteerVehicle();
1151 		ret._buffer = buffer;
1152 		ret.decode!readId();
1153 		return ret;
1154 	}
1155 
1156 	public override string toString() {
1157 		return "SteerVehicle(sideways: " ~ std.conv.to!string(this.sideways) ~ ", forward: " ~ std.conv.to!string(this.forward) ~ ", flags: " ~ std.conv.to!string(this.flags) ~ ")";
1158 	}
1159 
1160 }
1161 
1162 class ResourcePackStatus : Buffer {
1163 
1164 	public enum uint ID = 22;
1165 
1166 	public enum bool CLIENTBOUND = false;
1167 	public enum bool SERVERBOUND = true;
1168 
1169 	// result
1170 	public enum uint LOADED = 0;
1171 	public enum uint DECLINED = 1;
1172 	public enum uint FAILED = 2;
1173 	public enum uint ACCEPTED = 3;
1174 
1175 	public enum string[] FIELDS = ["hash", "result"];
1176 
1177 	public string hash;
1178 	public uint result;
1179 
1180 	public pure nothrow @safe @nogc this() {}
1181 
1182 	public pure nothrow @safe @nogc this(string hash, uint result=uint.init) {
1183 		this.hash = hash;
1184 		this.result = result;
1185 	}
1186 
1187 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
1188 		_buffer.length = 0;
1189 		static if(writeId){ writeBytes(varuint.encode(ID)); }
1190 		writeBytes(varuint.encode(cast(uint)hash.length)); writeString(hash);
1191 		writeBytes(varuint.encode(result));
1192 		return _buffer;
1193 	}
1194 
1195 	public pure nothrow @safe void decode(bool readId=true)() {
1196 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
1197 		uint afa=varuint.decode(_buffer, &_index); hash=readString(afa);
1198 		result=varuint.decode(_buffer, &_index);
1199 	}
1200 
1201 	public static pure nothrow @safe ResourcePackStatus fromBuffer(bool readId=true)(ubyte[] buffer) {
1202 		ResourcePackStatus ret = new ResourcePackStatus();
1203 		ret._buffer = buffer;
1204 		ret.decode!readId();
1205 		return ret;
1206 	}
1207 
1208 	public override string toString() {
1209 		return "ResourcePackStatus(hash: " ~ std.conv.to!string(this.hash) ~ ", result: " ~ std.conv.to!string(this.result) ~ ")";
1210 	}
1211 
1212 }
1213 
1214 class HeldItemChange : Buffer {
1215 
1216 	public enum uint ID = 23;
1217 
1218 	public enum bool CLIENTBOUND = false;
1219 	public enum bool SERVERBOUND = true;
1220 
1221 	public enum string[] FIELDS = ["slot"];
1222 
1223 	public ushort slot;
1224 
1225 	public pure nothrow @safe @nogc this() {}
1226 
1227 	public pure nothrow @safe @nogc this(ushort slot) {
1228 		this.slot = slot;
1229 	}
1230 
1231 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
1232 		_buffer.length = 0;
1233 		static if(writeId){ writeBytes(varuint.encode(ID)); }
1234 		writeBigEndianUshort(slot);
1235 		return _buffer;
1236 	}
1237 
1238 	public pure nothrow @safe void decode(bool readId=true)() {
1239 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
1240 		slot=readBigEndianUshort();
1241 	}
1242 
1243 	public static pure nothrow @safe HeldItemChange fromBuffer(bool readId=true)(ubyte[] buffer) {
1244 		HeldItemChange ret = new HeldItemChange();
1245 		ret._buffer = buffer;
1246 		ret.decode!readId();
1247 		return ret;
1248 	}
1249 
1250 	public override string toString() {
1251 		return "HeldItemChange(slot: " ~ std.conv.to!string(this.slot) ~ ")";
1252 	}
1253 
1254 }
1255 
1256 class CreativeInventoryAction : Buffer {
1257 
1258 	public enum uint ID = 24;
1259 
1260 	public enum bool CLIENTBOUND = false;
1261 	public enum bool SERVERBOUND = true;
1262 
1263 	public enum string[] FIELDS = ["slot", "clickedItem"];
1264 
1265 	public ushort slot;
1266 	public sul.protocol.minecraft109.types.Slot clickedItem;
1267 
1268 	public pure nothrow @safe @nogc this() {}
1269 
1270 	public pure nothrow @safe @nogc this(ushort slot, sul.protocol.minecraft109.types.Slot clickedItem=sul.protocol.minecraft109.types.Slot.init) {
1271 		this.slot = slot;
1272 		this.clickedItem = clickedItem;
1273 	}
1274 
1275 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
1276 		_buffer.length = 0;
1277 		static if(writeId){ writeBytes(varuint.encode(ID)); }
1278 		writeBigEndianUshort(slot);
1279 		clickedItem.encode(bufferInstance);
1280 		return _buffer;
1281 	}
1282 
1283 	public pure nothrow @safe void decode(bool readId=true)() {
1284 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
1285 		slot=readBigEndianUshort();
1286 		clickedItem.decode(bufferInstance);
1287 	}
1288 
1289 	public static pure nothrow @safe CreativeInventoryAction fromBuffer(bool readId=true)(ubyte[] buffer) {
1290 		CreativeInventoryAction ret = new CreativeInventoryAction();
1291 		ret._buffer = buffer;
1292 		ret.decode!readId();
1293 		return ret;
1294 	}
1295 
1296 	public override string toString() {
1297 		return "CreativeInventoryAction(slot: " ~ std.conv.to!string(this.slot) ~ ", clickedItem: " ~ std.conv.to!string(this.clickedItem) ~ ")";
1298 	}
1299 
1300 }
1301 
1302 class UpdateSign : Buffer {
1303 
1304 	public enum uint ID = 25;
1305 
1306 	public enum bool CLIENTBOUND = false;
1307 	public enum bool SERVERBOUND = true;
1308 
1309 	public enum string[] FIELDS = ["position", "lines"];
1310 
1311 	public ulong position;
1312 	public string[4] lines;
1313 
1314 	public pure nothrow @safe @nogc this() {}
1315 
1316 	public pure nothrow @safe @nogc this(ulong position, string[4] lines=(string[4]).init) {
1317 		this.position = position;
1318 		this.lines = lines;
1319 	}
1320 
1321 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
1322 		_buffer.length = 0;
1323 		static if(writeId){ writeBytes(varuint.encode(ID)); }
1324 		writeBigEndianUlong(position);
1325 		foreach(blzm;lines){ writeBytes(varuint.encode(cast(uint)blzm.length)); writeString(blzm); }
1326 		return _buffer;
1327 	}
1328 
1329 	public pure nothrow @safe void decode(bool readId=true)() {
1330 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
1331 		position=readBigEndianUlong();
1332 		foreach(ref blzm;lines){ uint yxb=varuint.decode(_buffer, &_index); blzm=readString(yxb); }
1333 	}
1334 
1335 	public static pure nothrow @safe UpdateSign fromBuffer(bool readId=true)(ubyte[] buffer) {
1336 		UpdateSign ret = new UpdateSign();
1337 		ret._buffer = buffer;
1338 		ret.decode!readId();
1339 		return ret;
1340 	}
1341 
1342 	public override string toString() {
1343 		return "UpdateSign(position: " ~ std.conv.to!string(this.position) ~ ", lines: " ~ std.conv.to!string(this.lines) ~ ")";
1344 	}
1345 
1346 }
1347 
1348 class Animation : Buffer {
1349 
1350 	public enum uint ID = 26;
1351 
1352 	public enum bool CLIENTBOUND = false;
1353 	public enum bool SERVERBOUND = true;
1354 
1355 	// hand
1356 	public enum uint MAIN_HAND = 0;
1357 	public enum uint OFF_HAND = 1;
1358 
1359 	public enum string[] FIELDS = ["hand"];
1360 
1361 	public uint hand;
1362 
1363 	public pure nothrow @safe @nogc this() {}
1364 
1365 	public pure nothrow @safe @nogc this(uint hand) {
1366 		this.hand = hand;
1367 	}
1368 
1369 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
1370 		_buffer.length = 0;
1371 		static if(writeId){ writeBytes(varuint.encode(ID)); }
1372 		writeBytes(varuint.encode(hand));
1373 		return _buffer;
1374 	}
1375 
1376 	public pure nothrow @safe void decode(bool readId=true)() {
1377 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
1378 		hand=varuint.decode(_buffer, &_index);
1379 	}
1380 
1381 	public static pure nothrow @safe Animation fromBuffer(bool readId=true)(ubyte[] buffer) {
1382 		Animation ret = new Animation();
1383 		ret._buffer = buffer;
1384 		ret.decode!readId();
1385 		return ret;
1386 	}
1387 
1388 	public override string toString() {
1389 		return "Animation(hand: " ~ std.conv.to!string(this.hand) ~ ")";
1390 	}
1391 
1392 }
1393 
1394 class Spectate : Buffer {
1395 
1396 	public enum uint ID = 27;
1397 
1398 	public enum bool CLIENTBOUND = false;
1399 	public enum bool SERVERBOUND = true;
1400 
1401 	public enum string[] FIELDS = ["player"];
1402 
1403 	public UUID player;
1404 
1405 	public pure nothrow @safe @nogc this() {}
1406 
1407 	public pure nothrow @safe @nogc this(UUID player) {
1408 		this.player = player;
1409 	}
1410 
1411 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
1412 		_buffer.length = 0;
1413 		static if(writeId){ writeBytes(varuint.encode(ID)); }
1414 		writeBytes(player.data);
1415 		return _buffer;
1416 	}
1417 
1418 	public pure nothrow @safe void decode(bool readId=true)() {
1419 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
1420 		if(_buffer.length>=_index+16){ ubyte[16] cxev=_buffer[_index.._index+16].dup; _index+=16; player=UUID(cxev); }
1421 	}
1422 
1423 	public static pure nothrow @safe Spectate fromBuffer(bool readId=true)(ubyte[] buffer) {
1424 		Spectate ret = new Spectate();
1425 		ret._buffer = buffer;
1426 		ret.decode!readId();
1427 		return ret;
1428 	}
1429 
1430 	public override string toString() {
1431 		return "Spectate(player: " ~ std.conv.to!string(this.player) ~ ")";
1432 	}
1433 
1434 }
1435 
1436 class PlayerBlockPlacement : Buffer {
1437 
1438 	public enum uint ID = 28;
1439 
1440 	public enum bool CLIENTBOUND = false;
1441 	public enum bool SERVERBOUND = true;
1442 
1443 	// hand
1444 	public enum uint MAIN_HAND = 0;
1445 	public enum uint OFF_HAND = 1;
1446 
1447 	public enum string[] FIELDS = ["position", "face", "hand", "cursorPosition"];
1448 
1449 	public ulong position;
1450 	public uint face;
1451 	public uint hand;
1452 	public Tuple!(ubyte, "x", ubyte, "y", ubyte, "z") cursorPosition;
1453 
1454 	public pure nothrow @safe @nogc this() {}
1455 
1456 	public pure nothrow @safe @nogc this(ulong position, uint face=uint.init, uint hand=uint.init, Tuple!(ubyte, "x", ubyte, "y", ubyte, "z") cursorPosition=Tuple!(ubyte, "x", ubyte, "y", ubyte, "z").init) {
1457 		this.position = position;
1458 		this.face = face;
1459 		this.hand = hand;
1460 		this.cursorPosition = cursorPosition;
1461 	}
1462 
1463 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
1464 		_buffer.length = 0;
1465 		static if(writeId){ writeBytes(varuint.encode(ID)); }
1466 		writeBigEndianUlong(position);
1467 		writeBytes(varuint.encode(face));
1468 		writeBytes(varuint.encode(hand));
1469 		writeBigEndianUbyte(cursorPosition.x); writeBigEndianUbyte(cursorPosition.y); writeBigEndianUbyte(cursorPosition.z);
1470 		return _buffer;
1471 	}
1472 
1473 	public pure nothrow @safe void decode(bool readId=true)() {
1474 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
1475 		position=readBigEndianUlong();
1476 		face=varuint.decode(_buffer, &_index);
1477 		hand=varuint.decode(_buffer, &_index);
1478 		cursorPosition.x=readBigEndianUbyte(); cursorPosition.y=readBigEndianUbyte(); cursorPosition.z=readBigEndianUbyte();
1479 	}
1480 
1481 	public static pure nothrow @safe PlayerBlockPlacement fromBuffer(bool readId=true)(ubyte[] buffer) {
1482 		PlayerBlockPlacement ret = new PlayerBlockPlacement();
1483 		ret._buffer = buffer;
1484 		ret.decode!readId();
1485 		return ret;
1486 	}
1487 
1488 	public override string toString() {
1489 		return "PlayerBlockPlacement(position: " ~ std.conv.to!string(this.position) ~ ", face: " ~ std.conv.to!string(this.face) ~ ", hand: " ~ std.conv.to!string(this.hand) ~ ", cursorPosition: " ~ std.conv.to!string(this.cursorPosition) ~ ")";
1490 	}
1491 
1492 }
1493 
1494 class UseItem : Buffer {
1495 
1496 	public enum uint ID = 29;
1497 
1498 	public enum bool CLIENTBOUND = false;
1499 	public enum bool SERVERBOUND = true;
1500 
1501 	// hand
1502 	public enum uint MAIN_HAND = 0;
1503 	public enum uint OFF_HAND = 1;
1504 
1505 	public enum string[] FIELDS = ["hand"];
1506 
1507 	public uint hand;
1508 
1509 	public pure nothrow @safe @nogc this() {}
1510 
1511 	public pure nothrow @safe @nogc this(uint hand) {
1512 		this.hand = hand;
1513 	}
1514 
1515 	public pure nothrow @safe ubyte[] encode(bool writeId=true)() {
1516 		_buffer.length = 0;
1517 		static if(writeId){ writeBytes(varuint.encode(ID)); }
1518 		writeBytes(varuint.encode(hand));
1519 		return _buffer;
1520 	}
1521 
1522 	public pure nothrow @safe void decode(bool readId=true)() {
1523 		static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); }
1524 		hand=varuint.decode(_buffer, &_index);
1525 	}
1526 
1527 	public static pure nothrow @safe UseItem fromBuffer(bool readId=true)(ubyte[] buffer) {
1528 		UseItem ret = new UseItem();
1529 		ret._buffer = buffer;
1530 		ret.decode!readId();
1531 		return ret;
1532 	}
1533 
1534 	public override string toString() {
1535 		return "UseItem(hand: " ~ std.conv.to!string(this.hand) ~ ")";
1536 	}
1537 
1538 }
1539