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/pocket100.xml 8 */ 9 module sul.protocol.pocket100.play; 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.pocket100.types; 22 23 static if(__traits(compiles, { import sul.metadata.pocket100; })) import sul.metadata.pocket100; 24 25 alias Packets = TypeTuple!(Login, PlayStatus, ServerToClientHandshake, ClientToServerHandshake, Disconnect, Batch, ResourcePacksInfo, ResourcePacksStackPacket, ResourcePackClientResponse, Text, SetTime, StartGame, AddPlayer, AddEntity, RemoveEntity, AddItemEntity, AddHangingEntity, TakeItemEntity, MoveEntity, MovePlayer, RiderJump, RemoveBlock, UpdateBlock, AddPainting, Explode, LevelSoundEvent, LevelEvent, BlockEvent, EntityEvent, MobEffect, UpdateAttributes, MobEquipment, MobArmorEquipment, Interact, UseItem, PlayerAction, PlayerFall, HurtArmor, SetEntityData, SetEntityMotion, SetEntityLink, SetHealth, SetSpawnPosition, Animate, Respawn, DropItem, InventoryAction, ContainerOpen, ContainerClose, ContainerSetSlot, ContainerSetData, ContainerSetContent, CraftingData, CraftingEvent, AdventureSettings, BlockEntityData, PlayerInput, FullChunkData, SetCommandsEnabled, SetDifficulty, ChangeDimension, SetPlayerGameType, PlayerList, TelemetryEvent, SpawnExperienceOrb, ClientboundMapItemData, MapInfoRequest, RequestChunkRadius, ChunkRadiusUpdated, ItemFrameDropItem, ReplaceSelectedItem, GameRulesChanged, Camera, AddItem, BossEvent, ShowCredits, AvailableCommands, CommandStep, ResourcePackDataInfo, ResourcePackChunkData, ResourcePackChunkRequest); 26 27 class Login : Buffer { 28 29 public enum ubyte ID = 1; 30 31 public enum bool CLIENTBOUND = false; 32 public enum bool SERVERBOUND = true; 33 34 // edition 35 public enum ubyte CLASSIC = 0; 36 public enum ubyte EDUCATION = 1; 37 38 public enum string[] FIELDS = ["protocol", "edition", "body_"]; 39 40 public uint protocol; 41 public ubyte edition; 42 public ubyte[] body_; 43 44 public pure nothrow @safe @nogc this() {} 45 46 public pure nothrow @safe @nogc this(uint protocol, ubyte edition=ubyte.init, ubyte[] body_=(ubyte[]).init) { 47 this.protocol = protocol; 48 this.edition = edition; 49 this.body_ = body_; 50 } 51 52 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 53 _buffer.length = 0; 54 static if(writeId){ writeBigEndianUbyte(ID); } 55 writeBigEndianUint(protocol); 56 writeBigEndianUbyte(edition); 57 writeBytes(varuint.encode(cast(uint)body_.length)); writeBytes(body_); 58 return _buffer; 59 } 60 61 public pure nothrow @safe void decode(bool readId=true)() { 62 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 63 protocol=readBigEndianUint(); 64 edition=readBigEndianUbyte(); 65 body_.length=varuint.decode(_buffer, &_index); if(_buffer.length>=_index+body_.length){ body_=_buffer[_index.._index+body_.length].dup; _index+=body_.length; } 66 } 67 68 public static pure nothrow @safe Login fromBuffer(bool readId=true)(ubyte[] buffer) { 69 Login ret = new Login(); 70 ret._buffer = buffer; 71 ret.decode!readId(); 72 return ret; 73 } 74 75 public override string toString() { 76 return "Login(protocol: " ~ std.conv.to!string(this.protocol) ~ ", edition: " ~ std.conv.to!string(this.edition) ~ ", body_: " ~ std.conv.to!string(this.body_) ~ ")"; 77 } 78 79 } 80 81 class PlayStatus : Buffer { 82 83 public enum ubyte ID = 2; 84 85 public enum bool CLIENTBOUND = true; 86 public enum bool SERVERBOUND = false; 87 88 // status 89 public enum uint OK = 0; 90 public enum uint OUTDATED_CLIENT = 1; 91 public enum uint OUTDATED_SERVER = 2; 92 public enum uint SPAWNED = 3; 93 public enum uint INVALID_TENANT = 4; 94 public enum uint EDITION_MISMATCH = 5; 95 96 public enum string[] FIELDS = ["status"]; 97 98 public uint status; 99 100 public pure nothrow @safe @nogc this() {} 101 102 public pure nothrow @safe @nogc this(uint status) { 103 this.status = status; 104 } 105 106 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 107 _buffer.length = 0; 108 static if(writeId){ writeBigEndianUbyte(ID); } 109 writeBigEndianUint(status); 110 return _buffer; 111 } 112 113 public pure nothrow @safe void decode(bool readId=true)() { 114 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 115 status=readBigEndianUint(); 116 } 117 118 public static pure nothrow @safe PlayStatus fromBuffer(bool readId=true)(ubyte[] buffer) { 119 PlayStatus ret = new PlayStatus(); 120 ret._buffer = buffer; 121 ret.decode!readId(); 122 return ret; 123 } 124 125 public override string toString() { 126 return "PlayStatus(status: " ~ std.conv.to!string(this.status) ~ ")"; 127 } 128 129 } 130 131 class ServerToClientHandshake : Buffer { 132 133 public enum ubyte ID = 3; 134 135 public enum bool CLIENTBOUND = true; 136 public enum bool SERVERBOUND = false; 137 138 public enum string[] FIELDS = ["serverPublicKey", "token"]; 139 140 public string serverPublicKey; 141 public ubyte[] token; 142 143 public pure nothrow @safe @nogc this() {} 144 145 public pure nothrow @safe @nogc this(string serverPublicKey, ubyte[] token=(ubyte[]).init) { 146 this.serverPublicKey = serverPublicKey; 147 this.token = token; 148 } 149 150 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 151 _buffer.length = 0; 152 static if(writeId){ writeBigEndianUbyte(ID); } 153 writeBytes(varuint.encode(cast(uint)serverPublicKey.length)); writeString(serverPublicKey); 154 writeBytes(varuint.encode(cast(uint)token.length)); writeBytes(token); 155 return _buffer; 156 } 157 158 public pure nothrow @safe void decode(bool readId=true)() { 159 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 160 uint cvdvuvbl=varuint.decode(_buffer, &_index); serverPublicKey=readString(cvdvuvbl); 161 token.length=varuint.decode(_buffer, &_index); if(_buffer.length>=_index+token.length){ token=_buffer[_index.._index+token.length].dup; _index+=token.length; } 162 } 163 164 public static pure nothrow @safe ServerToClientHandshake fromBuffer(bool readId=true)(ubyte[] buffer) { 165 ServerToClientHandshake ret = new ServerToClientHandshake(); 166 ret._buffer = buffer; 167 ret.decode!readId(); 168 return ret; 169 } 170 171 public override string toString() { 172 return "ServerToClientHandshake(serverPublicKey: " ~ std.conv.to!string(this.serverPublicKey) ~ ", token: " ~ std.conv.to!string(this.token) ~ ")"; 173 } 174 175 } 176 177 class ClientToServerHandshake : Buffer { 178 179 public enum ubyte ID = 4; 180 181 public enum bool CLIENTBOUND = false; 182 public enum bool SERVERBOUND = true; 183 184 public enum string[] FIELDS = []; 185 186 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 187 _buffer.length = 0; 188 static if(writeId){ writeBigEndianUbyte(ID); } 189 return _buffer; 190 } 191 192 public pure nothrow @safe void decode(bool readId=true)() { 193 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 194 } 195 196 public static pure nothrow @safe ClientToServerHandshake fromBuffer(bool readId=true)(ubyte[] buffer) { 197 ClientToServerHandshake ret = new ClientToServerHandshake(); 198 ret._buffer = buffer; 199 ret.decode!readId(); 200 return ret; 201 } 202 203 public override string toString() { 204 return "ClientToServerHandshake()"; 205 } 206 207 } 208 209 class Disconnect : Buffer { 210 211 public enum ubyte ID = 5; 212 213 public enum bool CLIENTBOUND = true; 214 public enum bool SERVERBOUND = false; 215 216 public enum string[] FIELDS = ["hideDisconnectionScreen", "message"]; 217 218 public bool hideDisconnectionScreen; 219 public string message; 220 221 public pure nothrow @safe @nogc this() {} 222 223 public pure nothrow @safe @nogc this(bool hideDisconnectionScreen, string message=string.init) { 224 this.hideDisconnectionScreen = hideDisconnectionScreen; 225 this.message = message; 226 } 227 228 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 229 _buffer.length = 0; 230 static if(writeId){ writeBigEndianUbyte(ID); } 231 writeBigEndianBool(hideDisconnectionScreen); 232 if(hideDisconnectionScreen==false){ writeBytes(varuint.encode(cast(uint)message.length)); writeString(message); } 233 return _buffer; 234 } 235 236 public pure nothrow @safe void decode(bool readId=true)() { 237 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 238 hideDisconnectionScreen=readBigEndianBool(); 239 if(hideDisconnectionScreen==false){ uint bvcfz=varuint.decode(_buffer, &_index); message=readString(bvcfz); } 240 } 241 242 public static pure nothrow @safe Disconnect fromBuffer(bool readId=true)(ubyte[] buffer) { 243 Disconnect ret = new Disconnect(); 244 ret._buffer = buffer; 245 ret.decode!readId(); 246 return ret; 247 } 248 249 public override string toString() { 250 return "Disconnect(hideDisconnectionScreen: " ~ std.conv.to!string(this.hideDisconnectionScreen) ~ ", message: " ~ std.conv.to!string(this.message) ~ ")"; 251 } 252 253 } 254 255 class Batch : Buffer { 256 257 public enum ubyte ID = 6; 258 259 public enum bool CLIENTBOUND = true; 260 public enum bool SERVERBOUND = true; 261 262 public enum string[] FIELDS = ["data"]; 263 264 public ubyte[] data; 265 266 public pure nothrow @safe @nogc this() {} 267 268 public pure nothrow @safe @nogc this(ubyte[] data) { 269 this.data = data; 270 } 271 272 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 273 _buffer.length = 0; 274 static if(writeId){ writeBigEndianUbyte(ID); } 275 writeBytes(varuint.encode(cast(uint)data.length)); writeBytes(data); 276 return _buffer; 277 } 278 279 public pure nothrow @safe void decode(bool readId=true)() { 280 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 281 data.length=varuint.decode(_buffer, &_index); if(_buffer.length>=_index+data.length){ data=_buffer[_index.._index+data.length].dup; _index+=data.length; } 282 } 283 284 public static pure nothrow @safe Batch fromBuffer(bool readId=true)(ubyte[] buffer) { 285 Batch ret = new Batch(); 286 ret._buffer = buffer; 287 ret.decode!readId(); 288 return ret; 289 } 290 291 public override string toString() { 292 return "Batch(data: " ~ std.conv.to!string(this.data) ~ ")"; 293 } 294 295 } 296 297 class ResourcePacksInfo : Buffer { 298 299 public enum ubyte ID = 7; 300 301 public enum bool CLIENTBOUND = true; 302 public enum bool SERVERBOUND = false; 303 304 public enum string[] FIELDS = ["mustAccept", "behaviourPacks", "resourcePacks"]; 305 306 public bool mustAccept; 307 public sul.protocol.pocket100.types.PackWithSize[] behaviourPacks; 308 public sul.protocol.pocket100.types.PackWithSize[] resourcePacks; 309 310 public pure nothrow @safe @nogc this() {} 311 312 public pure nothrow @safe @nogc this(bool mustAccept, sul.protocol.pocket100.types.PackWithSize[] behaviourPacks=(sul.protocol.pocket100.types.PackWithSize[]).init, sul.protocol.pocket100.types.PackWithSize[] resourcePacks=(sul.protocol.pocket100.types.PackWithSize[]).init) { 313 this.mustAccept = mustAccept; 314 this.behaviourPacks = behaviourPacks; 315 this.resourcePacks = resourcePacks; 316 } 317 318 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 319 _buffer.length = 0; 320 static if(writeId){ writeBigEndianUbyte(ID); } 321 writeBigEndianBool(mustAccept); 322 writeLittleEndianUshort(cast(ushort)behaviourPacks.length); foreach(yvyzbvuf;behaviourPacks){ yvyzbvuf.encode(bufferInstance); } 323 writeLittleEndianUshort(cast(ushort)resourcePacks.length); foreach(cvbvyvyn;resourcePacks){ cvbvyvyn.encode(bufferInstance); } 324 return _buffer; 325 } 326 327 public pure nothrow @safe void decode(bool readId=true)() { 328 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 329 mustAccept=readBigEndianBool(); 330 behaviourPacks.length=readLittleEndianUshort(); foreach(ref yvyzbvuf;behaviourPacks){ yvyzbvuf.decode(bufferInstance); } 331 resourcePacks.length=readLittleEndianUshort(); foreach(ref cvbvyvyn;resourcePacks){ cvbvyvyn.decode(bufferInstance); } 332 } 333 334 public static pure nothrow @safe ResourcePacksInfo fromBuffer(bool readId=true)(ubyte[] buffer) { 335 ResourcePacksInfo ret = new ResourcePacksInfo(); 336 ret._buffer = buffer; 337 ret.decode!readId(); 338 return ret; 339 } 340 341 public override string toString() { 342 return "ResourcePacksInfo(mustAccept: " ~ std.conv.to!string(this.mustAccept) ~ ", behaviourPacks: " ~ std.conv.to!string(this.behaviourPacks) ~ ", resourcePacks: " ~ std.conv.to!string(this.resourcePacks) ~ ")"; 343 } 344 345 } 346 347 class ResourcePacksStackPacket : Buffer { 348 349 public enum ubyte ID = 8; 350 351 public enum bool CLIENTBOUND = true; 352 public enum bool SERVERBOUND = false; 353 354 public enum string[] FIELDS = ["mustAccept", "behaviourPacks", "resourcePacks"]; 355 356 public bool mustAccept; 357 public sul.protocol.pocket100.types.Pack[] behaviourPacks; 358 public sul.protocol.pocket100.types.Pack[] resourcePacks; 359 360 public pure nothrow @safe @nogc this() {} 361 362 public pure nothrow @safe @nogc this(bool mustAccept, sul.protocol.pocket100.types.Pack[] behaviourPacks=(sul.protocol.pocket100.types.Pack[]).init, sul.protocol.pocket100.types.Pack[] resourcePacks=(sul.protocol.pocket100.types.Pack[]).init) { 363 this.mustAccept = mustAccept; 364 this.behaviourPacks = behaviourPacks; 365 this.resourcePacks = resourcePacks; 366 } 367 368 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 369 _buffer.length = 0; 370 static if(writeId){ writeBigEndianUbyte(ID); } 371 writeBigEndianBool(mustAccept); 372 writeLittleEndianUshort(cast(ushort)behaviourPacks.length); foreach(yvyzbvuf;behaviourPacks){ yvyzbvuf.encode(bufferInstance); } 373 writeLittleEndianUshort(cast(ushort)resourcePacks.length); foreach(cvbvyvyn;resourcePacks){ cvbvyvyn.encode(bufferInstance); } 374 return _buffer; 375 } 376 377 public pure nothrow @safe void decode(bool readId=true)() { 378 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 379 mustAccept=readBigEndianBool(); 380 behaviourPacks.length=readLittleEndianUshort(); foreach(ref yvyzbvuf;behaviourPacks){ yvyzbvuf.decode(bufferInstance); } 381 resourcePacks.length=readLittleEndianUshort(); foreach(ref cvbvyvyn;resourcePacks){ cvbvyvyn.decode(bufferInstance); } 382 } 383 384 public static pure nothrow @safe ResourcePacksStackPacket fromBuffer(bool readId=true)(ubyte[] buffer) { 385 ResourcePacksStackPacket ret = new ResourcePacksStackPacket(); 386 ret._buffer = buffer; 387 ret.decode!readId(); 388 return ret; 389 } 390 391 public override string toString() { 392 return "ResourcePacksStackPacket(mustAccept: " ~ std.conv.to!string(this.mustAccept) ~ ", behaviourPacks: " ~ std.conv.to!string(this.behaviourPacks) ~ ", resourcePacks: " ~ std.conv.to!string(this.resourcePacks) ~ ")"; 393 } 394 395 } 396 397 class ResourcePackClientResponse : Buffer { 398 399 public enum ubyte ID = 9; 400 401 public enum bool CLIENTBOUND = false; 402 public enum bool SERVERBOUND = true; 403 404 // status 405 public enum ubyte REFUSED = 1; 406 public enum ubyte SEND_PACKS = 2; 407 public enum ubyte HAVE_ALL_PACKS = 3; 408 public enum ubyte COMPLETED = 4; 409 410 public enum string[] FIELDS = ["status", "packIds"]; 411 412 public ubyte status; 413 public string[] packIds; 414 415 public pure nothrow @safe @nogc this() {} 416 417 public pure nothrow @safe @nogc this(ubyte status, string[] packIds=(string[]).init) { 418 this.status = status; 419 this.packIds = packIds; 420 } 421 422 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 423 _buffer.length = 0; 424 static if(writeId){ writeBigEndianUbyte(ID); } 425 writeBigEndianUbyte(status); 426 writeLittleEndianUshort(cast(ushort)packIds.length); foreach(cfalc;packIds){ writeBytes(varuint.encode(cast(uint)cfalc.length)); writeString(cfalc); } 427 return _buffer; 428 } 429 430 public pure nothrow @safe void decode(bool readId=true)() { 431 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 432 status=readBigEndianUbyte(); 433 packIds.length=readLittleEndianUshort(); foreach(ref cfalc;packIds){ uint yzbm=varuint.decode(_buffer, &_index); cfalc=readString(yzbm); } 434 } 435 436 public static pure nothrow @safe ResourcePackClientResponse fromBuffer(bool readId=true)(ubyte[] buffer) { 437 ResourcePackClientResponse ret = new ResourcePackClientResponse(); 438 ret._buffer = buffer; 439 ret.decode!readId(); 440 return ret; 441 } 442 443 public override string toString() { 444 return "ResourcePackClientResponse(status: " ~ std.conv.to!string(this.status) ~ ", packIds: " ~ std.conv.to!string(this.packIds) ~ ")"; 445 } 446 447 } 448 449 class Text : Buffer { 450 451 public enum ubyte ID = 10; 452 453 public enum bool CLIENTBOUND = true; 454 public enum bool SERVERBOUND = true; 455 456 public enum string[] FIELDS = ["type"]; 457 458 public ubyte type; 459 460 public pure nothrow @safe @nogc this() {} 461 462 public pure nothrow @safe @nogc this(ubyte type) { 463 this.type = type; 464 } 465 466 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 467 _buffer.length = 0; 468 static if(writeId){ writeBigEndianUbyte(ID); } 469 writeBigEndianUbyte(type); 470 return _buffer; 471 } 472 473 public pure nothrow @safe void decode(bool readId=true)() { 474 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 475 type=readBigEndianUbyte(); 476 } 477 478 public static pure nothrow @safe Text fromBuffer(bool readId=true)(ubyte[] buffer) { 479 Text ret = new Text(); 480 ret._buffer = buffer; 481 ret.decode!readId(); 482 return ret; 483 } 484 485 public override string toString() { 486 return "Text(type: " ~ std.conv.to!string(this.type) ~ ")"; 487 } 488 489 alias _encode = encode; 490 491 enum string variantField = "type"; 492 493 alias Variants = TypeTuple!(Raw, Chat, Translation, Popup, Tip, System, Whisper); 494 495 public class Raw { 496 497 public enum typeof(type) TYPE = 0; 498 499 public enum string[] FIELDS = ["message"]; 500 501 public string message; 502 503 public pure nothrow @safe @nogc this() {} 504 505 public pure nothrow @safe @nogc this(string message) { 506 this.message = message; 507 } 508 509 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 510 type = 0; 511 _encode!writeId(); 512 writeBytes(varuint.encode(cast(uint)message.length)); writeString(message); 513 return _buffer; 514 } 515 516 public pure nothrow @safe void decode() { 517 uint bvcfz=varuint.decode(_buffer, &_index); message=readString(bvcfz); 518 } 519 520 public override string toString() { 521 return "Text.Raw(message: " ~ std.conv.to!string(this.message) ~ ")"; 522 } 523 524 } 525 526 public class Chat { 527 528 public enum typeof(type) TYPE = 1; 529 530 public enum string[] FIELDS = ["sender", "message"]; 531 532 public string sender; 533 public string message; 534 535 public pure nothrow @safe @nogc this() {} 536 537 public pure nothrow @safe @nogc this(string sender, string message=string.init) { 538 this.sender = sender; 539 this.message = message; 540 } 541 542 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 543 type = 1; 544 _encode!writeId(); 545 writeBytes(varuint.encode(cast(uint)sender.length)); writeString(sender); 546 writeBytes(varuint.encode(cast(uint)message.length)); writeString(message); 547 return _buffer; 548 } 549 550 public pure nothrow @safe void decode() { 551 uint cvzv=varuint.decode(_buffer, &_index); sender=readString(cvzv); 552 uint bvcfz=varuint.decode(_buffer, &_index); message=readString(bvcfz); 553 } 554 555 public override string toString() { 556 return "Text.Chat(sender: " ~ std.conv.to!string(this.sender) ~ ", message: " ~ std.conv.to!string(this.message) ~ ")"; 557 } 558 559 } 560 561 public class Translation { 562 563 public enum typeof(type) TYPE = 2; 564 565 public enum string[] FIELDS = ["message", "parameters"]; 566 567 public string message; 568 public string[] parameters; 569 570 public pure nothrow @safe @nogc this() {} 571 572 public pure nothrow @safe @nogc this(string message, string[] parameters=(string[]).init) { 573 this.message = message; 574 this.parameters = parameters; 575 } 576 577 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 578 type = 2; 579 _encode!writeId(); 580 writeBytes(varuint.encode(cast(uint)message.length)); writeString(message); 581 writeBytes(varuint.encode(cast(uint)parameters.length)); foreach(cfy1dvc;parameters){ writeBytes(varuint.encode(cast(uint)cfy1dvc.length)); writeString(cfy1dvc); } 582 return _buffer; 583 } 584 585 public pure nothrow @safe void decode() { 586 uint bvcfz=varuint.decode(_buffer, &_index); message=readString(bvcfz); 587 parameters.length=varuint.decode(_buffer, &_index); foreach(ref cfy1dvc;parameters){ uint yzmry=varuint.decode(_buffer, &_index); cfy1dvc=readString(yzmry); } 588 } 589 590 public override string toString() { 591 return "Text.Translation(message: " ~ std.conv.to!string(this.message) ~ ", parameters: " ~ std.conv.to!string(this.parameters) ~ ")"; 592 } 593 594 } 595 596 public class Popup { 597 598 public enum typeof(type) TYPE = 3; 599 600 public enum string[] FIELDS = ["title", "subtitle"]; 601 602 public string title; 603 public string subtitle; 604 605 public pure nothrow @safe @nogc this() {} 606 607 public pure nothrow @safe @nogc this(string title, string subtitle=string.init) { 608 this.title = title; 609 this.subtitle = subtitle; 610 } 611 612 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 613 type = 3; 614 _encode!writeId(); 615 writeBytes(varuint.encode(cast(uint)title.length)); writeString(title); 616 writeBytes(varuint.encode(cast(uint)subtitle.length)); writeString(subtitle); 617 return _buffer; 618 } 619 620 public pure nothrow @safe void decode() { 621 uint dlbu=varuint.decode(_buffer, &_index); title=readString(dlbu); 622 uint cvdlbu=varuint.decode(_buffer, &_index); subtitle=readString(cvdlbu); 623 } 624 625 public override string toString() { 626 return "Text.Popup(title: " ~ std.conv.to!string(this.title) ~ ", subtitle: " ~ std.conv.to!string(this.subtitle) ~ ")"; 627 } 628 629 } 630 631 public class Tip { 632 633 public enum typeof(type) TYPE = 4; 634 635 public enum string[] FIELDS = ["message"]; 636 637 public string message; 638 639 public pure nothrow @safe @nogc this() {} 640 641 public pure nothrow @safe @nogc this(string message) { 642 this.message = message; 643 } 644 645 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 646 type = 4; 647 _encode!writeId(); 648 writeBytes(varuint.encode(cast(uint)message.length)); writeString(message); 649 return _buffer; 650 } 651 652 public pure nothrow @safe void decode() { 653 uint bvcfz=varuint.decode(_buffer, &_index); message=readString(bvcfz); 654 } 655 656 public override string toString() { 657 return "Text.Tip(message: " ~ std.conv.to!string(this.message) ~ ")"; 658 } 659 660 } 661 662 public class System { 663 664 public enum typeof(type) TYPE = 5; 665 666 public enum string[] FIELDS = ["message"]; 667 668 public string message; 669 670 public pure nothrow @safe @nogc this() {} 671 672 public pure nothrow @safe @nogc this(string message) { 673 this.message = message; 674 } 675 676 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 677 type = 5; 678 _encode!writeId(); 679 writeBytes(varuint.encode(cast(uint)message.length)); writeString(message); 680 return _buffer; 681 } 682 683 public pure nothrow @safe void decode() { 684 uint bvcfz=varuint.decode(_buffer, &_index); message=readString(bvcfz); 685 } 686 687 public override string toString() { 688 return "Text.System(message: " ~ std.conv.to!string(this.message) ~ ")"; 689 } 690 691 } 692 693 public class Whisper { 694 695 public enum typeof(type) TYPE = 6; 696 697 public enum string[] FIELDS = ["sender", "message"]; 698 699 public string sender; 700 public string message; 701 702 public pure nothrow @safe @nogc this() {} 703 704 public pure nothrow @safe @nogc this(string sender, string message=string.init) { 705 this.sender = sender; 706 this.message = message; 707 } 708 709 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 710 type = 6; 711 _encode!writeId(); 712 writeBytes(varuint.encode(cast(uint)sender.length)); writeString(sender); 713 writeBytes(varuint.encode(cast(uint)message.length)); writeString(message); 714 return _buffer; 715 } 716 717 public pure nothrow @safe void decode() { 718 uint cvzv=varuint.decode(_buffer, &_index); sender=readString(cvzv); 719 uint bvcfz=varuint.decode(_buffer, &_index); message=readString(bvcfz); 720 } 721 722 public override string toString() { 723 return "Text.Whisper(sender: " ~ std.conv.to!string(this.sender) ~ ", message: " ~ std.conv.to!string(this.message) ~ ")"; 724 } 725 726 } 727 728 } 729 730 class SetTime : Buffer { 731 732 public enum ubyte ID = 11; 733 734 public enum bool CLIENTBOUND = true; 735 public enum bool SERVERBOUND = false; 736 737 public enum string[] FIELDS = ["time", "daylightCycle"]; 738 739 public int time; 740 public bool daylightCycle; 741 742 public pure nothrow @safe @nogc this() {} 743 744 public pure nothrow @safe @nogc this(int time, bool daylightCycle=bool.init) { 745 this.time = time; 746 this.daylightCycle = daylightCycle; 747 } 748 749 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 750 _buffer.length = 0; 751 static if(writeId){ writeBigEndianUbyte(ID); } 752 writeBytes(varint.encode(time)); 753 writeBigEndianBool(daylightCycle); 754 return _buffer; 755 } 756 757 public pure nothrow @safe void decode(bool readId=true)() { 758 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 759 time=varint.decode(_buffer, &_index); 760 daylightCycle=readBigEndianBool(); 761 } 762 763 public static pure nothrow @safe SetTime fromBuffer(bool readId=true)(ubyte[] buffer) { 764 SetTime ret = new SetTime(); 765 ret._buffer = buffer; 766 ret.decode!readId(); 767 return ret; 768 } 769 770 public override string toString() { 771 return "SetTime(time: " ~ std.conv.to!string(this.time) ~ ", daylightCycle: " ~ std.conv.to!string(this.daylightCycle) ~ ")"; 772 } 773 774 } 775 776 class StartGame : Buffer { 777 778 public enum ubyte ID = 12; 779 780 public enum bool CLIENTBOUND = true; 781 public enum bool SERVERBOUND = false; 782 783 // dimension 784 public enum int OVERWORLD = 0; 785 public enum int NETHER = 1; 786 public enum int END = 2; 787 788 // generator 789 public enum int OLD = 0; 790 public enum int INFINITE = 1; 791 public enum int FLAT = 2; 792 793 // world gamemode 794 public enum int SURVIVAL = 0; 795 public enum int CREATIVE = 1; 796 797 // difficulty 798 public enum int PEACEFUL = 0; 799 public enum int EASY = 1; 800 public enum int NORMAL = 2; 801 public enum int HARD = 3; 802 803 // edition 804 public enum ubyte CLASSIC = 0; 805 public enum ubyte EDUCATION = 1; 806 807 public enum string[] FIELDS = ["entityId", "runtimeId", "position", "yaw", "pitch", "seed", "dimension", "generator", "worldGamemode", "difficulty", "spawnPosition", "loadedInCreative", "time", "edition", "rainLevel", "lightningLevel", "commandsEnabled", "textureRequired", "levelId", "worldName"]; 808 809 public long entityId; 810 public long runtimeId; 811 public Tuple!(float, "x", float, "y", float, "z") position; 812 public float yaw; 813 public float pitch; 814 public int seed; 815 public int dimension; 816 public int generator; 817 public int worldGamemode; 818 public int difficulty; 819 public Tuple!(int, "x", int, "y", int, "z") spawnPosition; 820 public bool loadedInCreative; 821 public int time; 822 public ubyte edition; 823 public float rainLevel; 824 public float lightningLevel; 825 public bool commandsEnabled; 826 public bool textureRequired; 827 public string levelId; 828 public string worldName; 829 830 public pure nothrow @safe @nogc this() {} 831 832 public pure nothrow @safe @nogc this(long entityId, long runtimeId=long.init, Tuple!(float, "x", float, "y", float, "z") position=Tuple!(float, "x", float, "y", float, "z").init, float yaw=float.init, float pitch=float.init, int seed=int.init, int dimension=int.init, int generator=int.init, int worldGamemode=int.init, int difficulty=int.init, Tuple!(int, "x", int, "y", int, "z") spawnPosition=Tuple!(int, "x", int, "y", int, "z").init, bool loadedInCreative=bool.init, int time=int.init, ubyte edition=ubyte.init, float rainLevel=float.init, float lightningLevel=float.init, bool commandsEnabled=bool.init, bool textureRequired=bool.init, string levelId=string.init, string worldName=string.init) { 833 this.entityId = entityId; 834 this.runtimeId = runtimeId; 835 this.position = position; 836 this.yaw = yaw; 837 this.pitch = pitch; 838 this.seed = seed; 839 this.dimension = dimension; 840 this.generator = generator; 841 this.worldGamemode = worldGamemode; 842 this.difficulty = difficulty; 843 this.spawnPosition = spawnPosition; 844 this.loadedInCreative = loadedInCreative; 845 this.time = time; 846 this.edition = edition; 847 this.rainLevel = rainLevel; 848 this.lightningLevel = lightningLevel; 849 this.commandsEnabled = commandsEnabled; 850 this.textureRequired = textureRequired; 851 this.levelId = levelId; 852 this.worldName = worldName; 853 } 854 855 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 856 _buffer.length = 0; 857 static if(writeId){ writeBigEndianUbyte(ID); } 858 writeBytes(varlong.encode(entityId)); 859 writeBytes(varlong.encode(runtimeId)); 860 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 861 writeLittleEndianFloat(yaw); 862 writeLittleEndianFloat(pitch); 863 writeBytes(varint.encode(seed)); 864 writeBytes(varint.encode(dimension)); 865 writeBytes(varint.encode(generator)); 866 writeBytes(varint.encode(worldGamemode)); 867 writeBytes(varint.encode(difficulty)); 868 writeBytes(varint.encode(spawnPosition.x)); writeBytes(varint.encode(spawnPosition.y)); writeBytes(varint.encode(spawnPosition.z)); 869 writeBigEndianBool(loadedInCreative); 870 writeBytes(varint.encode(time)); 871 writeBigEndianUbyte(edition); 872 writeLittleEndianFloat(rainLevel); 873 writeLittleEndianFloat(lightningLevel); 874 writeBigEndianBool(commandsEnabled); 875 writeBigEndianBool(textureRequired); 876 writeBytes(varuint.encode(cast(uint)levelId.length)); writeString(levelId); 877 writeBytes(varuint.encode(cast(uint)worldName.length)); writeString(worldName); 878 return _buffer; 879 } 880 881 public pure nothrow @safe void decode(bool readId=true)() { 882 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 883 entityId=varlong.decode(_buffer, &_index); 884 runtimeId=varlong.decode(_buffer, &_index); 885 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 886 yaw=readLittleEndianFloat(); 887 pitch=readLittleEndianFloat(); 888 seed=varint.decode(_buffer, &_index); 889 dimension=varint.decode(_buffer, &_index); 890 generator=varint.decode(_buffer, &_index); 891 worldGamemode=varint.decode(_buffer, &_index); 892 difficulty=varint.decode(_buffer, &_index); 893 spawnPosition.x=varint.decode(_buffer, &_index); spawnPosition.y=varint.decode(_buffer, &_index); spawnPosition.z=varint.decode(_buffer, &_index); 894 loadedInCreative=readBigEndianBool(); 895 time=varint.decode(_buffer, &_index); 896 edition=readBigEndianUbyte(); 897 rainLevel=readLittleEndianFloat(); 898 lightningLevel=readLittleEndianFloat(); 899 commandsEnabled=readBigEndianBool(); 900 textureRequired=readBigEndianBool(); 901 uint bvzxz=varuint.decode(_buffer, &_index); levelId=readString(bvzxz); 902 uint d9bry1=varuint.decode(_buffer, &_index); worldName=readString(d9bry1); 903 } 904 905 public static pure nothrow @safe StartGame fromBuffer(bool readId=true)(ubyte[] buffer) { 906 StartGame ret = new StartGame(); 907 ret._buffer = buffer; 908 ret.decode!readId(); 909 return ret; 910 } 911 912 public override string toString() { 913 return "StartGame(entityId: " ~ std.conv.to!string(this.entityId) ~ ", runtimeId: " ~ std.conv.to!string(this.runtimeId) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", yaw: " ~ std.conv.to!string(this.yaw) ~ ", pitch: " ~ std.conv.to!string(this.pitch) ~ ", seed: " ~ std.conv.to!string(this.seed) ~ ", dimension: " ~ std.conv.to!string(this.dimension) ~ ", generator: " ~ std.conv.to!string(this.generator) ~ ", worldGamemode: " ~ std.conv.to!string(this.worldGamemode) ~ ", difficulty: " ~ std.conv.to!string(this.difficulty) ~ ", spawnPosition: " ~ std.conv.to!string(this.spawnPosition) ~ ", loadedInCreative: " ~ std.conv.to!string(this.loadedInCreative) ~ ", time: " ~ std.conv.to!string(this.time) ~ ", edition: " ~ std.conv.to!string(this.edition) ~ ", rainLevel: " ~ std.conv.to!string(this.rainLevel) ~ ", lightningLevel: " ~ std.conv.to!string(this.lightningLevel) ~ ", commandsEnabled: " ~ std.conv.to!string(this.commandsEnabled) ~ ", textureRequired: " ~ std.conv.to!string(this.textureRequired) ~ ", levelId: " ~ std.conv.to!string(this.levelId) ~ ", worldName: " ~ std.conv.to!string(this.worldName) ~ ")"; 914 } 915 916 } 917 918 class AddPlayer : Buffer { 919 920 public enum ubyte ID = 13; 921 922 public enum bool CLIENTBOUND = true; 923 public enum bool SERVERBOUND = false; 924 925 public enum string[] FIELDS = ["uuid", "username", "entityId", "runtimeId", "position", "motion", "pitch", "headYaw", "yaw", "heldItem", "metadata"]; 926 927 public UUID uuid; 928 public string username; 929 public long entityId; 930 public long runtimeId; 931 public Tuple!(float, "x", float, "y", float, "z") position; 932 public Tuple!(float, "x", float, "y", float, "z") motion; 933 public float pitch; 934 public float headYaw; 935 public float yaw; 936 public sul.protocol.pocket100.types.Slot heldItem; 937 public Metadata metadata; 938 939 public pure nothrow @safe @nogc this() {} 940 941 public pure nothrow @safe @nogc this(UUID uuid, string username=string.init, long entityId=long.init, long runtimeId=long.init, Tuple!(float, "x", float, "y", float, "z") position=Tuple!(float, "x", float, "y", float, "z").init, Tuple!(float, "x", float, "y", float, "z") motion=Tuple!(float, "x", float, "y", float, "z").init, float pitch=float.init, float headYaw=float.init, float yaw=float.init, sul.protocol.pocket100.types.Slot heldItem=sul.protocol.pocket100.types.Slot.init, Metadata metadata=Metadata.init) { 942 this.uuid = uuid; 943 this.username = username; 944 this.entityId = entityId; 945 this.runtimeId = runtimeId; 946 this.position = position; 947 this.motion = motion; 948 this.pitch = pitch; 949 this.headYaw = headYaw; 950 this.yaw = yaw; 951 this.heldItem = heldItem; 952 this.metadata = metadata; 953 } 954 955 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 956 _buffer.length = 0; 957 static if(writeId){ writeBigEndianUbyte(ID); } 958 writeBytes(uuid.data); 959 writeBytes(varuint.encode(cast(uint)username.length)); writeString(username); 960 writeBytes(varlong.encode(entityId)); 961 writeBytes(varlong.encode(runtimeId)); 962 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 963 writeLittleEndianFloat(motion.x); writeLittleEndianFloat(motion.y); writeLittleEndianFloat(motion.z); 964 writeLittleEndianFloat(pitch); 965 writeLittleEndianFloat(headYaw); 966 writeLittleEndianFloat(yaw); 967 heldItem.encode(bufferInstance); 968 metadata.encode(bufferInstance); 969 return _buffer; 970 } 971 972 public pure nothrow @safe void decode(bool readId=true)() { 973 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 974 if(_buffer.length>=_index+16){ ubyte[16] dvz=_buffer[_index.._index+16].dup; _index+=16; uuid=UUID(dvz); } 975 uint dnc5bu=varuint.decode(_buffer, &_index); username=readString(dnc5bu); 976 entityId=varlong.decode(_buffer, &_index); 977 runtimeId=varlong.decode(_buffer, &_index); 978 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 979 motion.x=readLittleEndianFloat(); motion.y=readLittleEndianFloat(); motion.z=readLittleEndianFloat(); 980 pitch=readLittleEndianFloat(); 981 headYaw=readLittleEndianFloat(); 982 yaw=readLittleEndianFloat(); 983 heldItem.decode(bufferInstance); 984 metadata=Metadata.decode(bufferInstance); 985 } 986 987 public static pure nothrow @safe AddPlayer fromBuffer(bool readId=true)(ubyte[] buffer) { 988 AddPlayer ret = new AddPlayer(); 989 ret._buffer = buffer; 990 ret.decode!readId(); 991 return ret; 992 } 993 994 public override string toString() { 995 return "AddPlayer(uuid: " ~ std.conv.to!string(this.uuid) ~ ", username: " ~ std.conv.to!string(this.username) ~ ", entityId: " ~ std.conv.to!string(this.entityId) ~ ", runtimeId: " ~ std.conv.to!string(this.runtimeId) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", motion: " ~ std.conv.to!string(this.motion) ~ ", pitch: " ~ std.conv.to!string(this.pitch) ~ ", headYaw: " ~ std.conv.to!string(this.headYaw) ~ ", yaw: " ~ std.conv.to!string(this.yaw) ~ ", heldItem: " ~ std.conv.to!string(this.heldItem) ~ ", metadata: " ~ std.conv.to!string(this.metadata) ~ ")"; 996 } 997 998 } 999 1000 class AddEntity : Buffer { 1001 1002 public enum ubyte ID = 14; 1003 1004 public enum bool CLIENTBOUND = true; 1005 public enum bool SERVERBOUND = false; 1006 1007 public enum string[] FIELDS = ["entityId", "runtimeId", "type", "position", "motion", "pitch", "yaw", "attributes", "metadata", "links"]; 1008 1009 public long entityId; 1010 public long runtimeId; 1011 public uint type; 1012 public Tuple!(float, "x", float, "y", float, "z") position; 1013 public Tuple!(float, "x", float, "y", float, "z") motion; 1014 public float pitch; 1015 public float yaw; 1016 public sul.protocol.pocket100.types.Attribute[] attributes; 1017 public Metadata metadata; 1018 public sul.protocol.pocket100.types.Link[] links; 1019 1020 public pure nothrow @safe @nogc this() {} 1021 1022 public pure nothrow @safe @nogc this(long entityId, long runtimeId=long.init, uint type=uint.init, Tuple!(float, "x", float, "y", float, "z") position=Tuple!(float, "x", float, "y", float, "z").init, Tuple!(float, "x", float, "y", float, "z") motion=Tuple!(float, "x", float, "y", float, "z").init, float pitch=float.init, float yaw=float.init, sul.protocol.pocket100.types.Attribute[] attributes=(sul.protocol.pocket100.types.Attribute[]).init, Metadata metadata=Metadata.init, sul.protocol.pocket100.types.Link[] links=(sul.protocol.pocket100.types.Link[]).init) { 1023 this.entityId = entityId; 1024 this.runtimeId = runtimeId; 1025 this.type = type; 1026 this.position = position; 1027 this.motion = motion; 1028 this.pitch = pitch; 1029 this.yaw = yaw; 1030 this.attributes = attributes; 1031 this.metadata = metadata; 1032 this.links = links; 1033 } 1034 1035 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1036 _buffer.length = 0; 1037 static if(writeId){ writeBigEndianUbyte(ID); } 1038 writeBytes(varlong.encode(entityId)); 1039 writeBytes(varlong.encode(runtimeId)); 1040 writeBytes(varuint.encode(type)); 1041 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 1042 writeLittleEndianFloat(motion.x); writeLittleEndianFloat(motion.y); writeLittleEndianFloat(motion.z); 1043 writeLittleEndianFloat(pitch); 1044 writeLittleEndianFloat(yaw); 1045 writeBytes(varuint.encode(cast(uint)attributes.length)); foreach(yrcldrc;attributes){ yrcldrc.encode(bufferInstance); } 1046 metadata.encode(bufferInstance); 1047 writeBytes(varuint.encode(cast(uint)links.length)); foreach(blam;links){ blam.encode(bufferInstance); } 1048 return _buffer; 1049 } 1050 1051 public pure nothrow @safe void decode(bool readId=true)() { 1052 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 1053 entityId=varlong.decode(_buffer, &_index); 1054 runtimeId=varlong.decode(_buffer, &_index); 1055 type=varuint.decode(_buffer, &_index); 1056 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 1057 motion.x=readLittleEndianFloat(); motion.y=readLittleEndianFloat(); motion.z=readLittleEndianFloat(); 1058 pitch=readLittleEndianFloat(); 1059 yaw=readLittleEndianFloat(); 1060 attributes.length=varuint.decode(_buffer, &_index); foreach(ref yrcldrc;attributes){ yrcldrc.decode(bufferInstance); } 1061 metadata=Metadata.decode(bufferInstance); 1062 links.length=varuint.decode(_buffer, &_index); foreach(ref blam;links){ blam.decode(bufferInstance); } 1063 } 1064 1065 public static pure nothrow @safe AddEntity fromBuffer(bool readId=true)(ubyte[] buffer) { 1066 AddEntity ret = new AddEntity(); 1067 ret._buffer = buffer; 1068 ret.decode!readId(); 1069 return ret; 1070 } 1071 1072 public override string toString() { 1073 return "AddEntity(entityId: " ~ std.conv.to!string(this.entityId) ~ ", runtimeId: " ~ std.conv.to!string(this.runtimeId) ~ ", type: " ~ std.conv.to!string(this.type) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", motion: " ~ std.conv.to!string(this.motion) ~ ", pitch: " ~ std.conv.to!string(this.pitch) ~ ", yaw: " ~ std.conv.to!string(this.yaw) ~ ", attributes: " ~ std.conv.to!string(this.attributes) ~ ", metadata: " ~ std.conv.to!string(this.metadata) ~ ", links: " ~ std.conv.to!string(this.links) ~ ")"; 1074 } 1075 1076 } 1077 1078 class RemoveEntity : Buffer { 1079 1080 public enum ubyte ID = 15; 1081 1082 public enum bool CLIENTBOUND = true; 1083 public enum bool SERVERBOUND = false; 1084 1085 public enum string[] FIELDS = ["entityId"]; 1086 1087 public long entityId; 1088 1089 public pure nothrow @safe @nogc this() {} 1090 1091 public pure nothrow @safe @nogc this(long entityId) { 1092 this.entityId = entityId; 1093 } 1094 1095 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1096 _buffer.length = 0; 1097 static if(writeId){ writeBigEndianUbyte(ID); } 1098 writeBytes(varlong.encode(entityId)); 1099 return _buffer; 1100 } 1101 1102 public pure nothrow @safe void decode(bool readId=true)() { 1103 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 1104 entityId=varlong.decode(_buffer, &_index); 1105 } 1106 1107 public static pure nothrow @safe RemoveEntity fromBuffer(bool readId=true)(ubyte[] buffer) { 1108 RemoveEntity ret = new RemoveEntity(); 1109 ret._buffer = buffer; 1110 ret.decode!readId(); 1111 return ret; 1112 } 1113 1114 public override string toString() { 1115 return "RemoveEntity(entityId: " ~ std.conv.to!string(this.entityId) ~ ")"; 1116 } 1117 1118 } 1119 1120 class AddItemEntity : Buffer { 1121 1122 public enum ubyte ID = 16; 1123 1124 public enum bool CLIENTBOUND = true; 1125 public enum bool SERVERBOUND = false; 1126 1127 public enum string[] FIELDS = ["entityId", "runtimeId", "item", "position", "motion"]; 1128 1129 public long entityId; 1130 public long runtimeId; 1131 public sul.protocol.pocket100.types.Slot item; 1132 public Tuple!(float, "x", float, "y", float, "z") position; 1133 public Tuple!(float, "x", float, "y", float, "z") motion; 1134 1135 public pure nothrow @safe @nogc this() {} 1136 1137 public pure nothrow @safe @nogc this(long entityId, long runtimeId=long.init, sul.protocol.pocket100.types.Slot item=sul.protocol.pocket100.types.Slot.init, Tuple!(float, "x", float, "y", float, "z") position=Tuple!(float, "x", float, "y", float, "z").init, Tuple!(float, "x", float, "y", float, "z") motion=Tuple!(float, "x", float, "y", float, "z").init) { 1138 this.entityId = entityId; 1139 this.runtimeId = runtimeId; 1140 this.item = item; 1141 this.position = position; 1142 this.motion = motion; 1143 } 1144 1145 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1146 _buffer.length = 0; 1147 static if(writeId){ writeBigEndianUbyte(ID); } 1148 writeBytes(varlong.encode(entityId)); 1149 writeBytes(varlong.encode(runtimeId)); 1150 item.encode(bufferInstance); 1151 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 1152 writeLittleEndianFloat(motion.x); writeLittleEndianFloat(motion.y); writeLittleEndianFloat(motion.z); 1153 return _buffer; 1154 } 1155 1156 public pure nothrow @safe void decode(bool readId=true)() { 1157 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 1158 entityId=varlong.decode(_buffer, &_index); 1159 runtimeId=varlong.decode(_buffer, &_index); 1160 item.decode(bufferInstance); 1161 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 1162 motion.x=readLittleEndianFloat(); motion.y=readLittleEndianFloat(); motion.z=readLittleEndianFloat(); 1163 } 1164 1165 public static pure nothrow @safe AddItemEntity fromBuffer(bool readId=true)(ubyte[] buffer) { 1166 AddItemEntity ret = new AddItemEntity(); 1167 ret._buffer = buffer; 1168 ret.decode!readId(); 1169 return ret; 1170 } 1171 1172 public override string toString() { 1173 return "AddItemEntity(entityId: " ~ std.conv.to!string(this.entityId) ~ ", runtimeId: " ~ std.conv.to!string(this.runtimeId) ~ ", item: " ~ std.conv.to!string(this.item) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", motion: " ~ std.conv.to!string(this.motion) ~ ")"; 1174 } 1175 1176 } 1177 1178 class AddHangingEntity : Buffer { 1179 1180 public enum ubyte ID = 17; 1181 1182 public enum bool CLIENTBOUND = true; 1183 public enum bool SERVERBOUND = false; 1184 1185 public enum string[] FIELDS = ["entityId", "runtimeId", "position", "unknown3"]; 1186 1187 public long entityId; 1188 public long runtimeId; 1189 public sul.protocol.pocket100.types.BlockPosition position; 1190 public int unknown3; 1191 1192 public pure nothrow @safe @nogc this() {} 1193 1194 public pure nothrow @safe @nogc this(long entityId, long runtimeId=long.init, sul.protocol.pocket100.types.BlockPosition position=sul.protocol.pocket100.types.BlockPosition.init, int unknown3=int.init) { 1195 this.entityId = entityId; 1196 this.runtimeId = runtimeId; 1197 this.position = position; 1198 this.unknown3 = unknown3; 1199 } 1200 1201 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1202 _buffer.length = 0; 1203 static if(writeId){ writeBigEndianUbyte(ID); } 1204 writeBytes(varlong.encode(entityId)); 1205 writeBytes(varlong.encode(runtimeId)); 1206 position.encode(bufferInstance); 1207 writeBytes(varint.encode(unknown3)); 1208 return _buffer; 1209 } 1210 1211 public pure nothrow @safe void decode(bool readId=true)() { 1212 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 1213 entityId=varlong.decode(_buffer, &_index); 1214 runtimeId=varlong.decode(_buffer, &_index); 1215 position.decode(bufferInstance); 1216 unknown3=varint.decode(_buffer, &_index); 1217 } 1218 1219 public static pure nothrow @safe AddHangingEntity fromBuffer(bool readId=true)(ubyte[] buffer) { 1220 AddHangingEntity ret = new AddHangingEntity(); 1221 ret._buffer = buffer; 1222 ret.decode!readId(); 1223 return ret; 1224 } 1225 1226 public override string toString() { 1227 return "AddHangingEntity(entityId: " ~ std.conv.to!string(this.entityId) ~ ", runtimeId: " ~ std.conv.to!string(this.runtimeId) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", unknown3: " ~ std.conv.to!string(this.unknown3) ~ ")"; 1228 } 1229 1230 } 1231 1232 class TakeItemEntity : Buffer { 1233 1234 public enum ubyte ID = 18; 1235 1236 public enum bool CLIENTBOUND = true; 1237 public enum bool SERVERBOUND = false; 1238 1239 public enum string[] FIELDS = ["collected", "collector"]; 1240 1241 public long collected; 1242 public long collector; 1243 1244 public pure nothrow @safe @nogc this() {} 1245 1246 public pure nothrow @safe @nogc this(long collected, long collector=long.init) { 1247 this.collected = collected; 1248 this.collector = collector; 1249 } 1250 1251 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1252 _buffer.length = 0; 1253 static if(writeId){ writeBigEndianUbyte(ID); } 1254 writeBytes(varlong.encode(collected)); 1255 writeBytes(varlong.encode(collector)); 1256 return _buffer; 1257 } 1258 1259 public pure nothrow @safe void decode(bool readId=true)() { 1260 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 1261 collected=varlong.decode(_buffer, &_index); 1262 collector=varlong.decode(_buffer, &_index); 1263 } 1264 1265 public static pure nothrow @safe TakeItemEntity fromBuffer(bool readId=true)(ubyte[] buffer) { 1266 TakeItemEntity ret = new TakeItemEntity(); 1267 ret._buffer = buffer; 1268 ret.decode!readId(); 1269 return ret; 1270 } 1271 1272 public override string toString() { 1273 return "TakeItemEntity(collected: " ~ std.conv.to!string(this.collected) ~ ", collector: " ~ std.conv.to!string(this.collector) ~ ")"; 1274 } 1275 1276 } 1277 1278 class MoveEntity : Buffer { 1279 1280 public enum ubyte ID = 19; 1281 1282 public enum bool CLIENTBOUND = true; 1283 public enum bool SERVERBOUND = false; 1284 1285 public enum string[] FIELDS = ["entityId", "position", "pitch", "headYaw", "yaw"]; 1286 1287 public long entityId; 1288 public Tuple!(float, "x", float, "y", float, "z") position; 1289 public ubyte pitch; 1290 public ubyte headYaw; 1291 public ubyte yaw; 1292 1293 public pure nothrow @safe @nogc this() {} 1294 1295 public pure nothrow @safe @nogc this(long entityId, Tuple!(float, "x", float, "y", float, "z") position=Tuple!(float, "x", float, "y", float, "z").init, ubyte pitch=ubyte.init, ubyte headYaw=ubyte.init, ubyte yaw=ubyte.init) { 1296 this.entityId = entityId; 1297 this.position = position; 1298 this.pitch = pitch; 1299 this.headYaw = headYaw; 1300 this.yaw = yaw; 1301 } 1302 1303 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1304 _buffer.length = 0; 1305 static if(writeId){ writeBigEndianUbyte(ID); } 1306 writeBytes(varlong.encode(entityId)); 1307 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 1308 writeBigEndianUbyte(pitch); 1309 writeBigEndianUbyte(headYaw); 1310 writeBigEndianUbyte(yaw); 1311 return _buffer; 1312 } 1313 1314 public pure nothrow @safe void decode(bool readId=true)() { 1315 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 1316 entityId=varlong.decode(_buffer, &_index); 1317 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 1318 pitch=readBigEndianUbyte(); 1319 headYaw=readBigEndianUbyte(); 1320 yaw=readBigEndianUbyte(); 1321 } 1322 1323 public static pure nothrow @safe MoveEntity fromBuffer(bool readId=true)(ubyte[] buffer) { 1324 MoveEntity ret = new MoveEntity(); 1325 ret._buffer = buffer; 1326 ret.decode!readId(); 1327 return ret; 1328 } 1329 1330 public override string toString() { 1331 return "MoveEntity(entityId: " ~ std.conv.to!string(this.entityId) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", pitch: " ~ std.conv.to!string(this.pitch) ~ ", headYaw: " ~ std.conv.to!string(this.headYaw) ~ ", yaw: " ~ std.conv.to!string(this.yaw) ~ ")"; 1332 } 1333 1334 } 1335 1336 class MovePlayer : Buffer { 1337 1338 public enum ubyte ID = 20; 1339 1340 public enum bool CLIENTBOUND = true; 1341 public enum bool SERVERBOUND = true; 1342 1343 // animation 1344 public enum ubyte FULL = 0; 1345 public enum ubyte NONE = 1; 1346 public enum ubyte ROTATION = 2; 1347 1348 public enum string[] FIELDS = ["entityId", "position", "pitch", "headYaw", "yaw", "animation", "onGround"]; 1349 1350 public long entityId; 1351 public Tuple!(float, "x", float, "y", float, "z") position; 1352 public float pitch; 1353 public float headYaw; 1354 public float yaw; 1355 public ubyte animation; 1356 public bool onGround; 1357 1358 public pure nothrow @safe @nogc this() {} 1359 1360 public pure nothrow @safe @nogc this(long entityId, Tuple!(float, "x", float, "y", float, "z") position=Tuple!(float, "x", float, "y", float, "z").init, float pitch=float.init, float headYaw=float.init, float yaw=float.init, ubyte animation=ubyte.init, bool onGround=bool.init) { 1361 this.entityId = entityId; 1362 this.position = position; 1363 this.pitch = pitch; 1364 this.headYaw = headYaw; 1365 this.yaw = yaw; 1366 this.animation = animation; 1367 this.onGround = onGround; 1368 } 1369 1370 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1371 _buffer.length = 0; 1372 static if(writeId){ writeBigEndianUbyte(ID); } 1373 writeBytes(varlong.encode(entityId)); 1374 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 1375 writeLittleEndianFloat(pitch); 1376 writeLittleEndianFloat(headYaw); 1377 writeLittleEndianFloat(yaw); 1378 writeBigEndianUbyte(animation); 1379 writeBigEndianBool(onGround); 1380 return _buffer; 1381 } 1382 1383 public pure nothrow @safe void decode(bool readId=true)() { 1384 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 1385 entityId=varlong.decode(_buffer, &_index); 1386 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 1387 pitch=readLittleEndianFloat(); 1388 headYaw=readLittleEndianFloat(); 1389 yaw=readLittleEndianFloat(); 1390 animation=readBigEndianUbyte(); 1391 onGround=readBigEndianBool(); 1392 } 1393 1394 public static pure nothrow @safe MovePlayer fromBuffer(bool readId=true)(ubyte[] buffer) { 1395 MovePlayer ret = new MovePlayer(); 1396 ret._buffer = buffer; 1397 ret.decode!readId(); 1398 return ret; 1399 } 1400 1401 public override string toString() { 1402 return "MovePlayer(entityId: " ~ std.conv.to!string(this.entityId) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", pitch: " ~ std.conv.to!string(this.pitch) ~ ", headYaw: " ~ std.conv.to!string(this.headYaw) ~ ", yaw: " ~ std.conv.to!string(this.yaw) ~ ", animation: " ~ std.conv.to!string(this.animation) ~ ", onGround: " ~ std.conv.to!string(this.onGround) ~ ")"; 1403 } 1404 1405 } 1406 1407 class RiderJump : Buffer { 1408 1409 public enum ubyte ID = 21; 1410 1411 public enum bool CLIENTBOUND = true; 1412 public enum bool SERVERBOUND = true; 1413 1414 public enum string[] FIELDS = ["rider"]; 1415 1416 public long rider; 1417 1418 public pure nothrow @safe @nogc this() {} 1419 1420 public pure nothrow @safe @nogc this(long rider) { 1421 this.rider = rider; 1422 } 1423 1424 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1425 _buffer.length = 0; 1426 static if(writeId){ writeBigEndianUbyte(ID); } 1427 writeBytes(varlong.encode(rider)); 1428 return _buffer; 1429 } 1430 1431 public pure nothrow @safe void decode(bool readId=true)() { 1432 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 1433 rider=varlong.decode(_buffer, &_index); 1434 } 1435 1436 public static pure nothrow @safe RiderJump fromBuffer(bool readId=true)(ubyte[] buffer) { 1437 RiderJump ret = new RiderJump(); 1438 ret._buffer = buffer; 1439 ret.decode!readId(); 1440 return ret; 1441 } 1442 1443 public override string toString() { 1444 return "RiderJump(rider: " ~ std.conv.to!string(this.rider) ~ ")"; 1445 } 1446 1447 } 1448 1449 class RemoveBlock : Buffer { 1450 1451 public enum ubyte ID = 22; 1452 1453 public enum bool CLIENTBOUND = false; 1454 public enum bool SERVERBOUND = true; 1455 1456 public enum string[] FIELDS = ["position"]; 1457 1458 public sul.protocol.pocket100.types.BlockPosition position; 1459 1460 public pure nothrow @safe @nogc this() {} 1461 1462 public pure nothrow @safe @nogc this(sul.protocol.pocket100.types.BlockPosition position) { 1463 this.position = position; 1464 } 1465 1466 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1467 _buffer.length = 0; 1468 static if(writeId){ writeBigEndianUbyte(ID); } 1469 position.encode(bufferInstance); 1470 return _buffer; 1471 } 1472 1473 public pure nothrow @safe void decode(bool readId=true)() { 1474 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 1475 position.decode(bufferInstance); 1476 } 1477 1478 public static pure nothrow @safe RemoveBlock fromBuffer(bool readId=true)(ubyte[] buffer) { 1479 RemoveBlock ret = new RemoveBlock(); 1480 ret._buffer = buffer; 1481 ret.decode!readId(); 1482 return ret; 1483 } 1484 1485 public override string toString() { 1486 return "RemoveBlock(position: " ~ std.conv.to!string(this.position) ~ ")"; 1487 } 1488 1489 } 1490 1491 class UpdateBlock : Buffer { 1492 1493 public enum ubyte ID = 23; 1494 1495 public enum bool CLIENTBOUND = true; 1496 public enum bool SERVERBOUND = false; 1497 1498 // flags and meta 1499 public enum uint NEIGHBORS = 1; 1500 public enum uint NETWORK = 2; 1501 public enum uint NO_GRAPHIC = 4; 1502 public enum uint PRIORITY = 8; 1503 1504 public enum string[] FIELDS = ["position", "block", "flagsAndMeta"]; 1505 1506 public sul.protocol.pocket100.types.BlockPosition position; 1507 public uint block; 1508 public uint flagsAndMeta; 1509 1510 public pure nothrow @safe @nogc this() {} 1511 1512 public pure nothrow @safe @nogc this(sul.protocol.pocket100.types.BlockPosition position, uint block=uint.init, uint flagsAndMeta=uint.init) { 1513 this.position = position; 1514 this.block = block; 1515 this.flagsAndMeta = flagsAndMeta; 1516 } 1517 1518 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1519 _buffer.length = 0; 1520 static if(writeId){ writeBigEndianUbyte(ID); } 1521 position.encode(bufferInstance); 1522 writeBytes(varuint.encode(block)); 1523 writeBytes(varuint.encode(flagsAndMeta)); 1524 return _buffer; 1525 } 1526 1527 public pure nothrow @safe void decode(bool readId=true)() { 1528 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 1529 position.decode(bufferInstance); 1530 block=varuint.decode(_buffer, &_index); 1531 flagsAndMeta=varuint.decode(_buffer, &_index); 1532 } 1533 1534 public static pure nothrow @safe UpdateBlock fromBuffer(bool readId=true)(ubyte[] buffer) { 1535 UpdateBlock ret = new UpdateBlock(); 1536 ret._buffer = buffer; 1537 ret.decode!readId(); 1538 return ret; 1539 } 1540 1541 public override string toString() { 1542 return "UpdateBlock(position: " ~ std.conv.to!string(this.position) ~ ", block: " ~ std.conv.to!string(this.block) ~ ", flagsAndMeta: " ~ std.conv.to!string(this.flagsAndMeta) ~ ")"; 1543 } 1544 1545 } 1546 1547 class AddPainting : Buffer { 1548 1549 public enum ubyte ID = 24; 1550 1551 public enum bool CLIENTBOUND = true; 1552 public enum bool SERVERBOUND = false; 1553 1554 public enum string[] FIELDS = ["entityId", "runtimeId", "position", "direction", "title"]; 1555 1556 public long entityId; 1557 public long runtimeId; 1558 public sul.protocol.pocket100.types.BlockPosition position; 1559 public int direction; 1560 public string title; 1561 1562 public pure nothrow @safe @nogc this() {} 1563 1564 public pure nothrow @safe @nogc this(long entityId, long runtimeId=long.init, sul.protocol.pocket100.types.BlockPosition position=sul.protocol.pocket100.types.BlockPosition.init, int direction=int.init, string title=string.init) { 1565 this.entityId = entityId; 1566 this.runtimeId = runtimeId; 1567 this.position = position; 1568 this.direction = direction; 1569 this.title = title; 1570 } 1571 1572 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1573 _buffer.length = 0; 1574 static if(writeId){ writeBigEndianUbyte(ID); } 1575 writeBytes(varlong.encode(entityId)); 1576 writeBytes(varlong.encode(runtimeId)); 1577 position.encode(bufferInstance); 1578 writeBytes(varint.encode(direction)); 1579 writeBytes(varuint.encode(cast(uint)title.length)); writeString(title); 1580 return _buffer; 1581 } 1582 1583 public pure nothrow @safe void decode(bool readId=true)() { 1584 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 1585 entityId=varlong.decode(_buffer, &_index); 1586 runtimeId=varlong.decode(_buffer, &_index); 1587 position.decode(bufferInstance); 1588 direction=varint.decode(_buffer, &_index); 1589 uint dlbu=varuint.decode(_buffer, &_index); title=readString(dlbu); 1590 } 1591 1592 public static pure nothrow @safe AddPainting fromBuffer(bool readId=true)(ubyte[] buffer) { 1593 AddPainting ret = new AddPainting(); 1594 ret._buffer = buffer; 1595 ret.decode!readId(); 1596 return ret; 1597 } 1598 1599 public override string toString() { 1600 return "AddPainting(entityId: " ~ std.conv.to!string(this.entityId) ~ ", runtimeId: " ~ std.conv.to!string(this.runtimeId) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", direction: " ~ std.conv.to!string(this.direction) ~ ", title: " ~ std.conv.to!string(this.title) ~ ")"; 1601 } 1602 1603 } 1604 1605 class Explode : Buffer { 1606 1607 public enum ubyte ID = 25; 1608 1609 public enum bool CLIENTBOUND = true; 1610 public enum bool SERVERBOUND = false; 1611 1612 public enum string[] FIELDS = ["position", "radius", "destroyedBlocks"]; 1613 1614 public Tuple!(float, "x", float, "y", float, "z") position; 1615 public float radius; 1616 public sul.protocol.pocket100.types.BlockPosition[] destroyedBlocks; 1617 1618 public pure nothrow @safe @nogc this() {} 1619 1620 public pure nothrow @safe @nogc this(Tuple!(float, "x", float, "y", float, "z") position, float radius=float.init, sul.protocol.pocket100.types.BlockPosition[] destroyedBlocks=(sul.protocol.pocket100.types.BlockPosition[]).init) { 1621 this.position = position; 1622 this.radius = radius; 1623 this.destroyedBlocks = destroyedBlocks; 1624 } 1625 1626 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1627 _buffer.length = 0; 1628 static if(writeId){ writeBigEndianUbyte(ID); } 1629 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 1630 writeLittleEndianFloat(radius); 1631 writeBytes(varuint.encode(cast(uint)destroyedBlocks.length)); foreach(zvdjevqx;destroyedBlocks){ zvdjevqx.encode(bufferInstance); } 1632 return _buffer; 1633 } 1634 1635 public pure nothrow @safe void decode(bool readId=true)() { 1636 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 1637 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 1638 radius=readLittleEndianFloat(); 1639 destroyedBlocks.length=varuint.decode(_buffer, &_index); foreach(ref zvdjevqx;destroyedBlocks){ zvdjevqx.decode(bufferInstance); } 1640 } 1641 1642 public static pure nothrow @safe Explode fromBuffer(bool readId=true)(ubyte[] buffer) { 1643 Explode ret = new Explode(); 1644 ret._buffer = buffer; 1645 ret.decode!readId(); 1646 return ret; 1647 } 1648 1649 public override string toString() { 1650 return "Explode(position: " ~ std.conv.to!string(this.position) ~ ", radius: " ~ std.conv.to!string(this.radius) ~ ", destroyedBlocks: " ~ std.conv.to!string(this.destroyedBlocks) ~ ")"; 1651 } 1652 1653 } 1654 1655 class LevelSoundEvent : Buffer { 1656 1657 public enum ubyte ID = 26; 1658 1659 public enum bool CLIENTBOUND = true; 1660 public enum bool SERVERBOUND = true; 1661 1662 // sound 1663 public enum ubyte ITEM_USE_ON = 0; 1664 public enum ubyte HIT = 1; 1665 public enum ubyte STEP = 2; 1666 public enum ubyte JUMP = 3; 1667 public enum ubyte BREAK = 4; 1668 public enum ubyte PLACE = 5; 1669 public enum ubyte HEAVY_STEP = 6; 1670 public enum ubyte GALLOP = 7; 1671 public enum ubyte FALL = 8; 1672 public enum ubyte AMBIENT = 9; 1673 public enum ubyte AMBIENT_BABY = 10; 1674 public enum ubyte AMBIENT_IN_WATER = 11; 1675 public enum ubyte BREATHE = 12; 1676 public enum ubyte DEATH = 13; 1677 public enum ubyte DEATH_IN_WATER = 14; 1678 public enum ubyte DEATH_TO_ZOMBIE = 15; 1679 public enum ubyte HURT = 16; 1680 public enum ubyte HURT_IN_WATER = 17; 1681 public enum ubyte MAD = 18; 1682 public enum ubyte BOOST = 19; 1683 public enum ubyte BOW = 20; 1684 public enum ubyte SQUISH_BIG = 21; 1685 public enum ubyte SQUISH_SMALL = 22; 1686 public enum ubyte FALL_BIG = 23; 1687 public enum ubyte FALL_SMALL = 24; 1688 public enum ubyte SPLASH = 25; 1689 public enum ubyte FIZZ = 26; 1690 public enum ubyte FLAP = 27; 1691 public enum ubyte SWIM = 28; 1692 public enum ubyte DRINK = 29; 1693 public enum ubyte EAT = 30; 1694 public enum ubyte TAKEOFF = 31; 1695 public enum ubyte SHAKE = 32; 1696 public enum ubyte PLOP = 33; 1697 public enum ubyte LAND = 34; 1698 public enum ubyte SADDLE = 35; 1699 public enum ubyte ARMOR = 36; 1700 public enum ubyte ADD_CHEST = 37; 1701 public enum ubyte THROW = 38; 1702 public enum ubyte ATTACK = 39; 1703 public enum ubyte ATTACK_NODAMAGE = 40; 1704 public enum ubyte WARN = 41; 1705 public enum ubyte SHEAR = 42; 1706 public enum ubyte MILK = 43; 1707 public enum ubyte THUNDER = 44; 1708 public enum ubyte EXPLODE = 45; 1709 public enum ubyte FIRE = 46; 1710 public enum ubyte IGNITE = 47; 1711 public enum ubyte FUSE = 48; 1712 public enum ubyte STARE = 49; 1713 public enum ubyte SPAWN = 50; 1714 public enum ubyte SHOOT = 51; 1715 public enum ubyte BREAK_BLOCK = 52; 1716 public enum ubyte REMEDY = 53; 1717 public enum ubyte UNFECT = 54; 1718 public enum ubyte LEVELUP = 55; 1719 public enum ubyte BOW_HIT = 56; 1720 public enum ubyte BULLET_HIT = 57; 1721 public enum ubyte EXTINGUISH_FIRE = 58; 1722 public enum ubyte ITEM_FIZZ = 59; 1723 public enum ubyte CHEST_OPEN = 60; 1724 public enum ubyte CHEST_CLOSED = 61; 1725 public enum ubyte POWER_ON = 62; 1726 public enum ubyte POWER_OFF = 63; 1727 public enum ubyte ATTACH = 64; 1728 public enum ubyte DETACH = 65; 1729 public enum ubyte DENY = 66; 1730 public enum ubyte TRIPOD = 67; 1731 public enum ubyte POP = 68; 1732 public enum ubyte DROP_SLOT = 69; 1733 public enum ubyte NOTE = 70; 1734 public enum ubyte THORNS = 71; 1735 public enum ubyte PISTON_IN = 72; 1736 public enum ubyte PISTON_OUT = 73; 1737 public enum ubyte PORTAL = 74; 1738 public enum ubyte WATER = 75; 1739 public enum ubyte LAVA_POP = 76; 1740 public enum ubyte LAVA = 77; 1741 public enum ubyte BURP = 78; 1742 public enum ubyte BUCKET_FILL_WATER = 79; 1743 public enum ubyte BUCKET_FILL_LAVA = 80; 1744 public enum ubyte BUCKET_EMPTY_WATER = 81; 1745 public enum ubyte BUCKET_EMPTY_LAVA = 82; 1746 public enum ubyte GUARDIAN_FLOP = 83; 1747 public enum ubyte ELDERGUARDIAN_CURSE = 84; 1748 public enum ubyte MOB_WARNING = 85; 1749 public enum ubyte MOB_WARNING_BABY = 86; 1750 public enum ubyte TELEPORT = 87; 1751 public enum ubyte SHULKER_OPEN = 88; 1752 public enum ubyte SHULKER_CLOSE = 89; 1753 public enum ubyte DEFAULT = 90; 1754 public enum ubyte UNDEFINED = 91; 1755 1756 public enum string[] FIELDS = ["sound", "position", "volume", "pitch", "unknown4"]; 1757 1758 public ubyte sound; 1759 public Tuple!(float, "x", float, "y", float, "z") position; 1760 public uint volume; 1761 public int pitch; 1762 public bool unknown4; 1763 1764 public pure nothrow @safe @nogc this() {} 1765 1766 public pure nothrow @safe @nogc this(ubyte sound, Tuple!(float, "x", float, "y", float, "z") position=Tuple!(float, "x", float, "y", float, "z").init, uint volume=uint.init, int pitch=int.init, bool unknown4=bool.init) { 1767 this.sound = sound; 1768 this.position = position; 1769 this.volume = volume; 1770 this.pitch = pitch; 1771 this.unknown4 = unknown4; 1772 } 1773 1774 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1775 _buffer.length = 0; 1776 static if(writeId){ writeBigEndianUbyte(ID); } 1777 writeBigEndianUbyte(sound); 1778 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 1779 writeBytes(varuint.encode(volume)); 1780 writeBytes(varint.encode(pitch)); 1781 writeBigEndianBool(unknown4); 1782 return _buffer; 1783 } 1784 1785 public pure nothrow @safe void decode(bool readId=true)() { 1786 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 1787 sound=readBigEndianUbyte(); 1788 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 1789 volume=varuint.decode(_buffer, &_index); 1790 pitch=varint.decode(_buffer, &_index); 1791 unknown4=readBigEndianBool(); 1792 } 1793 1794 public static pure nothrow @safe LevelSoundEvent fromBuffer(bool readId=true)(ubyte[] buffer) { 1795 LevelSoundEvent ret = new LevelSoundEvent(); 1796 ret._buffer = buffer; 1797 ret.decode!readId(); 1798 return ret; 1799 } 1800 1801 public override string toString() { 1802 return "LevelSoundEvent(sound: " ~ std.conv.to!string(this.sound) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", volume: " ~ std.conv.to!string(this.volume) ~ ", pitch: " ~ std.conv.to!string(this.pitch) ~ ", unknown4: " ~ std.conv.to!string(this.unknown4) ~ ")"; 1803 } 1804 1805 } 1806 1807 class LevelEvent : Buffer { 1808 1809 public enum ubyte ID = 27; 1810 1811 public enum bool CLIENTBOUND = true; 1812 public enum bool SERVERBOUND = false; 1813 1814 // event id 1815 public enum int START_RAIN = 3001; 1816 public enum int START_THUNDER = 3002; 1817 public enum int STOP_RAIN = 3003; 1818 public enum int STOP_THUNDER = 3004; 1819 public enum int SET_DATA = 4000; 1820 public enum int PLAYERS_SLEEPING = 9800; 1821 public enum int BUBBLE = 16385; 1822 public enum int CRITICAL = 16386; 1823 public enum int BLOCK_FORCE_FIELD = 16387; 1824 public enum int SMOKE = 16388; 1825 public enum int EXPLODE = 16389; 1826 public enum int EVAPORATION = 16390; 1827 public enum int FLAME = 16391; 1828 public enum int LAVA = 16392; 1829 public enum int LARGE_SMOKE = 16393; 1830 public enum int REDSTONE = 16394; 1831 public enum int RISING_RED_DUST = 16395; 1832 public enum int ITEM_BREAK = 16396; 1833 public enum int SNOWBALL_POOF = 16397; 1834 public enum int HUGE_EXPLODE = 16398; 1835 public enum int HUGE_EXPLODE_SEED = 16399; 1836 public enum int MOB_FLAME = 16400; 1837 public enum int HEART = 16401; 1838 public enum int TERRAIN = 16402; 1839 public enum int TOWN_AURA = 16403; 1840 public enum int PORTAL = 16404; 1841 public enum int WATER_SPLASH = 16405; 1842 public enum int WATER_WAKE = 16406; 1843 public enum int DRIP_WATER = 16407; 1844 public enum int DRIP_LAVA = 16408; 1845 public enum int FALLING_DUST = 16409; 1846 public enum int MOB_SPELL = 16410; 1847 public enum int MOB_SPELL_AMBIENT = 16411; 1848 public enum int MOB_SPELL_INSTANTANEOUS = 16412; 1849 public enum int INK = 16413; 1850 public enum int SLIME = 16414; 1851 public enum int RAIN_SPLASH = 16415; 1852 public enum int VILLAGER_ANGRY = 16416; 1853 public enum int VILLAGER_HAPPY = 16417; 1854 public enum int ENCHANTMENT_TABLE = 16418; 1855 public enum int TRACKING_EMITTER = 16419; 1856 public enum int NOTE = 16420; 1857 public enum int WITCH_SPELL = 16421; 1858 public enum int CARROT = 16422; 1859 public enum int END_ROD = 16424; 1860 public enum int DRAGON_BREATH = 16425; 1861 public enum int SHOOT = 2000; 1862 public enum int DESTROY = 2001; 1863 1864 public enum string[] FIELDS = ["eventId", "position", "data"]; 1865 1866 public int eventId; 1867 public Tuple!(float, "x", float, "y", float, "z") position; 1868 public int data; 1869 1870 public pure nothrow @safe @nogc this() {} 1871 1872 public pure nothrow @safe @nogc this(int eventId, Tuple!(float, "x", float, "y", float, "z") position=Tuple!(float, "x", float, "y", float, "z").init, int data=int.init) { 1873 this.eventId = eventId; 1874 this.position = position; 1875 this.data = data; 1876 } 1877 1878 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1879 _buffer.length = 0; 1880 static if(writeId){ writeBigEndianUbyte(ID); } 1881 writeBytes(varint.encode(eventId)); 1882 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 1883 writeBytes(varint.encode(data)); 1884 return _buffer; 1885 } 1886 1887 public pure nothrow @safe void decode(bool readId=true)() { 1888 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 1889 eventId=varint.decode(_buffer, &_index); 1890 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 1891 data=varint.decode(_buffer, &_index); 1892 } 1893 1894 public static pure nothrow @safe LevelEvent fromBuffer(bool readId=true)(ubyte[] buffer) { 1895 LevelEvent ret = new LevelEvent(); 1896 ret._buffer = buffer; 1897 ret.decode!readId(); 1898 return ret; 1899 } 1900 1901 public override string toString() { 1902 return "LevelEvent(eventId: " ~ std.conv.to!string(this.eventId) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")"; 1903 } 1904 1905 } 1906 1907 class BlockEvent : Buffer { 1908 1909 public enum ubyte ID = 28; 1910 1911 public enum bool CLIENTBOUND = true; 1912 public enum bool SERVERBOUND = false; 1913 1914 public enum string[] FIELDS = ["position", "data"]; 1915 1916 public sul.protocol.pocket100.types.BlockPosition position; 1917 public int[2] data; 1918 1919 public pure nothrow @safe @nogc this() {} 1920 1921 public pure nothrow @safe @nogc this(sul.protocol.pocket100.types.BlockPosition position, int[2] data=(int[2]).init) { 1922 this.position = position; 1923 this.data = data; 1924 } 1925 1926 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1927 _buffer.length = 0; 1928 static if(writeId){ writeBigEndianUbyte(ID); } 1929 position.encode(bufferInstance); 1930 foreach(zfy;data){ writeBytes(varint.encode(zfy)); } 1931 return _buffer; 1932 } 1933 1934 public pure nothrow @safe void decode(bool readId=true)() { 1935 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 1936 position.decode(bufferInstance); 1937 foreach(ref zfy;data){ zfy=varint.decode(_buffer, &_index); } 1938 } 1939 1940 public static pure nothrow @safe BlockEvent fromBuffer(bool readId=true)(ubyte[] buffer) { 1941 BlockEvent ret = new BlockEvent(); 1942 ret._buffer = buffer; 1943 ret.decode!readId(); 1944 return ret; 1945 } 1946 1947 public override string toString() { 1948 return "BlockEvent(position: " ~ std.conv.to!string(this.position) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")"; 1949 } 1950 1951 } 1952 1953 class EntityEvent : Buffer { 1954 1955 public enum ubyte ID = 29; 1956 1957 public enum bool CLIENTBOUND = true; 1958 public enum bool SERVERBOUND = true; 1959 1960 // event id 1961 public enum ubyte HURT_ANIMATION = 2; 1962 public enum ubyte DEATH_ANIMATION = 3; 1963 public enum ubyte TAME_FAIL = 6; 1964 public enum ubyte TAME_SUCCESS = 7; 1965 public enum ubyte SHAKE_WET = 8; 1966 public enum ubyte USE_ITEM = 9; 1967 public enum ubyte EAT_GRASS_ANIMATION = 10; 1968 public enum ubyte FISH_HOOK_BUBBLES = 11; 1969 public enum ubyte FISH_HOOK_POSITION = 12; 1970 public enum ubyte FISH_HOOK_HOOK = 13; 1971 public enum ubyte FISH_HOOK_TEASE = 14; 1972 public enum ubyte SQUID_INK_CLOUD = 15; 1973 public enum ubyte AMBIENT_SOUND = 16; 1974 public enum ubyte RESPAWN = 17; 1975 1976 public enum string[] FIELDS = ["entityId", "eventId", "unknown2"]; 1977 1978 public long entityId; 1979 public ubyte eventId; 1980 public int unknown2; 1981 1982 public pure nothrow @safe @nogc this() {} 1983 1984 public pure nothrow @safe @nogc this(long entityId, ubyte eventId=ubyte.init, int unknown2=int.init) { 1985 this.entityId = entityId; 1986 this.eventId = eventId; 1987 this.unknown2 = unknown2; 1988 } 1989 1990 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1991 _buffer.length = 0; 1992 static if(writeId){ writeBigEndianUbyte(ID); } 1993 writeBytes(varlong.encode(entityId)); 1994 writeBigEndianUbyte(eventId); 1995 writeBytes(varint.encode(unknown2)); 1996 return _buffer; 1997 } 1998 1999 public pure nothrow @safe void decode(bool readId=true)() { 2000 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2001 entityId=varlong.decode(_buffer, &_index); 2002 eventId=readBigEndianUbyte(); 2003 unknown2=varint.decode(_buffer, &_index); 2004 } 2005 2006 public static pure nothrow @safe EntityEvent fromBuffer(bool readId=true)(ubyte[] buffer) { 2007 EntityEvent ret = new EntityEvent(); 2008 ret._buffer = buffer; 2009 ret.decode!readId(); 2010 return ret; 2011 } 2012 2013 public override string toString() { 2014 return "EntityEvent(entityId: " ~ std.conv.to!string(this.entityId) ~ ", eventId: " ~ std.conv.to!string(this.eventId) ~ ", unknown2: " ~ std.conv.to!string(this.unknown2) ~ ")"; 2015 } 2016 2017 } 2018 2019 class MobEffect : Buffer { 2020 2021 public enum ubyte ID = 30; 2022 2023 public enum bool CLIENTBOUND = true; 2024 public enum bool SERVERBOUND = false; 2025 2026 // event id 2027 public enum ubyte ADD = 1; 2028 public enum ubyte MODIFY = 2; 2029 public enum ubyte REMOVE = 3; 2030 2031 public enum string[] FIELDS = ["entityId", "eventId", "effect", "amplifier", "particles", "duration"]; 2032 2033 public long entityId; 2034 public ubyte eventId; 2035 public int effect; 2036 public int amplifier; 2037 public bool particles; 2038 public int duration; 2039 2040 public pure nothrow @safe @nogc this() {} 2041 2042 public pure nothrow @safe @nogc this(long entityId, ubyte eventId=ubyte.init, int effect=int.init, int amplifier=int.init, bool particles=bool.init, int duration=int.init) { 2043 this.entityId = entityId; 2044 this.eventId = eventId; 2045 this.effect = effect; 2046 this.amplifier = amplifier; 2047 this.particles = particles; 2048 this.duration = duration; 2049 } 2050 2051 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2052 _buffer.length = 0; 2053 static if(writeId){ writeBigEndianUbyte(ID); } 2054 writeBytes(varlong.encode(entityId)); 2055 writeBigEndianUbyte(eventId); 2056 writeBytes(varint.encode(effect)); 2057 writeBytes(varint.encode(amplifier)); 2058 writeBigEndianBool(particles); 2059 writeBytes(varint.encode(duration)); 2060 return _buffer; 2061 } 2062 2063 public pure nothrow @safe void decode(bool readId=true)() { 2064 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2065 entityId=varlong.decode(_buffer, &_index); 2066 eventId=readBigEndianUbyte(); 2067 effect=varint.decode(_buffer, &_index); 2068 amplifier=varint.decode(_buffer, &_index); 2069 particles=readBigEndianBool(); 2070 duration=varint.decode(_buffer, &_index); 2071 } 2072 2073 public static pure nothrow @safe MobEffect fromBuffer(bool readId=true)(ubyte[] buffer) { 2074 MobEffect ret = new MobEffect(); 2075 ret._buffer = buffer; 2076 ret.decode!readId(); 2077 return ret; 2078 } 2079 2080 public override string toString() { 2081 return "MobEffect(entityId: " ~ std.conv.to!string(this.entityId) ~ ", eventId: " ~ std.conv.to!string(this.eventId) ~ ", effect: " ~ std.conv.to!string(this.effect) ~ ", amplifier: " ~ std.conv.to!string(this.amplifier) ~ ", particles: " ~ std.conv.to!string(this.particles) ~ ", duration: " ~ std.conv.to!string(this.duration) ~ ")"; 2082 } 2083 2084 } 2085 2086 class UpdateAttributes : Buffer { 2087 2088 public enum ubyte ID = 31; 2089 2090 public enum bool CLIENTBOUND = true; 2091 public enum bool SERVERBOUND = false; 2092 2093 public enum string[] FIELDS = ["entityId", "attributes"]; 2094 2095 public long entityId; 2096 public sul.protocol.pocket100.types.Attribute[] attributes; 2097 2098 public pure nothrow @safe @nogc this() {} 2099 2100 public pure nothrow @safe @nogc this(long entityId, sul.protocol.pocket100.types.Attribute[] attributes=(sul.protocol.pocket100.types.Attribute[]).init) { 2101 this.entityId = entityId; 2102 this.attributes = attributes; 2103 } 2104 2105 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2106 _buffer.length = 0; 2107 static if(writeId){ writeBigEndianUbyte(ID); } 2108 writeBytes(varlong.encode(entityId)); 2109 writeBytes(varuint.encode(cast(uint)attributes.length)); foreach(yrcldrc;attributes){ yrcldrc.encode(bufferInstance); } 2110 return _buffer; 2111 } 2112 2113 public pure nothrow @safe void decode(bool readId=true)() { 2114 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2115 entityId=varlong.decode(_buffer, &_index); 2116 attributes.length=varuint.decode(_buffer, &_index); foreach(ref yrcldrc;attributes){ yrcldrc.decode(bufferInstance); } 2117 } 2118 2119 public static pure nothrow @safe UpdateAttributes fromBuffer(bool readId=true)(ubyte[] buffer) { 2120 UpdateAttributes ret = new UpdateAttributes(); 2121 ret._buffer = buffer; 2122 ret.decode!readId(); 2123 return ret; 2124 } 2125 2126 public override string toString() { 2127 return "UpdateAttributes(entityId: " ~ std.conv.to!string(this.entityId) ~ ", attributes: " ~ std.conv.to!string(this.attributes) ~ ")"; 2128 } 2129 2130 } 2131 2132 class MobEquipment : Buffer { 2133 2134 public enum ubyte ID = 32; 2135 2136 public enum bool CLIENTBOUND = true; 2137 public enum bool SERVERBOUND = true; 2138 2139 public enum string[] FIELDS = ["entityId", "item", "inventorySlot", "hotbarSlot", "unknown4"]; 2140 2141 public long entityId; 2142 public sul.protocol.pocket100.types.Slot item; 2143 public ubyte inventorySlot; 2144 public ubyte hotbarSlot; 2145 public ubyte unknown4; 2146 2147 public pure nothrow @safe @nogc this() {} 2148 2149 public pure nothrow @safe @nogc this(long entityId, sul.protocol.pocket100.types.Slot item=sul.protocol.pocket100.types.Slot.init, ubyte inventorySlot=ubyte.init, ubyte hotbarSlot=ubyte.init, ubyte unknown4=ubyte.init) { 2150 this.entityId = entityId; 2151 this.item = item; 2152 this.inventorySlot = inventorySlot; 2153 this.hotbarSlot = hotbarSlot; 2154 this.unknown4 = unknown4; 2155 } 2156 2157 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2158 _buffer.length = 0; 2159 static if(writeId){ writeBigEndianUbyte(ID); } 2160 writeBytes(varlong.encode(entityId)); 2161 item.encode(bufferInstance); 2162 writeBigEndianUbyte(inventorySlot); 2163 writeBigEndianUbyte(hotbarSlot); 2164 writeBigEndianUbyte(unknown4); 2165 return _buffer; 2166 } 2167 2168 public pure nothrow @safe void decode(bool readId=true)() { 2169 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2170 entityId=varlong.decode(_buffer, &_index); 2171 item.decode(bufferInstance); 2172 inventorySlot=readBigEndianUbyte(); 2173 hotbarSlot=readBigEndianUbyte(); 2174 unknown4=readBigEndianUbyte(); 2175 } 2176 2177 public static pure nothrow @safe MobEquipment fromBuffer(bool readId=true)(ubyte[] buffer) { 2178 MobEquipment ret = new MobEquipment(); 2179 ret._buffer = buffer; 2180 ret.decode!readId(); 2181 return ret; 2182 } 2183 2184 public override string toString() { 2185 return "MobEquipment(entityId: " ~ std.conv.to!string(this.entityId) ~ ", item: " ~ std.conv.to!string(this.item) ~ ", inventorySlot: " ~ std.conv.to!string(this.inventorySlot) ~ ", hotbarSlot: " ~ std.conv.to!string(this.hotbarSlot) ~ ", unknown4: " ~ std.conv.to!string(this.unknown4) ~ ")"; 2186 } 2187 2188 } 2189 2190 class MobArmorEquipment : Buffer { 2191 2192 public enum ubyte ID = 33; 2193 2194 public enum bool CLIENTBOUND = true; 2195 public enum bool SERVERBOUND = true; 2196 2197 public enum string[] FIELDS = ["entityId", "armor"]; 2198 2199 public long entityId; 2200 public sul.protocol.pocket100.types.Slot[4] armor; 2201 2202 public pure nothrow @safe @nogc this() {} 2203 2204 public pure nothrow @safe @nogc this(long entityId, sul.protocol.pocket100.types.Slot[4] armor=(sul.protocol.pocket100.types.Slot[4]).init) { 2205 this.entityId = entityId; 2206 this.armor = armor; 2207 } 2208 2209 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2210 _buffer.length = 0; 2211 static if(writeId){ writeBigEndianUbyte(ID); } 2212 writeBytes(varlong.encode(entityId)); 2213 foreach(yjbi;armor){ yjbi.encode(bufferInstance); } 2214 return _buffer; 2215 } 2216 2217 public pure nothrow @safe void decode(bool readId=true)() { 2218 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2219 entityId=varlong.decode(_buffer, &_index); 2220 foreach(ref yjbi;armor){ yjbi.decode(bufferInstance); } 2221 } 2222 2223 public static pure nothrow @safe MobArmorEquipment fromBuffer(bool readId=true)(ubyte[] buffer) { 2224 MobArmorEquipment ret = new MobArmorEquipment(); 2225 ret._buffer = buffer; 2226 ret.decode!readId(); 2227 return ret; 2228 } 2229 2230 public override string toString() { 2231 return "MobArmorEquipment(entityId: " ~ std.conv.to!string(this.entityId) ~ ", armor: " ~ std.conv.to!string(this.armor) ~ ")"; 2232 } 2233 2234 } 2235 2236 class Interact : Buffer { 2237 2238 public enum ubyte ID = 34; 2239 2240 public enum bool CLIENTBOUND = false; 2241 public enum bool SERVERBOUND = true; 2242 2243 // action 2244 public enum ubyte INTERACT = 1; 2245 public enum ubyte ATTACK = 2; 2246 public enum ubyte LEAVE_VEHICLE = 3; 2247 public enum ubyte HOVER = 4; 2248 2249 public enum string[] FIELDS = ["action", "target"]; 2250 2251 public ubyte action; 2252 public long target; 2253 2254 public pure nothrow @safe @nogc this() {} 2255 2256 public pure nothrow @safe @nogc this(ubyte action, long target=long.init) { 2257 this.action = action; 2258 this.target = target; 2259 } 2260 2261 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2262 _buffer.length = 0; 2263 static if(writeId){ writeBigEndianUbyte(ID); } 2264 writeBigEndianUbyte(action); 2265 writeBytes(varlong.encode(target)); 2266 return _buffer; 2267 } 2268 2269 public pure nothrow @safe void decode(bool readId=true)() { 2270 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2271 action=readBigEndianUbyte(); 2272 target=varlong.decode(_buffer, &_index); 2273 } 2274 2275 public static pure nothrow @safe Interact fromBuffer(bool readId=true)(ubyte[] buffer) { 2276 Interact ret = new Interact(); 2277 ret._buffer = buffer; 2278 ret.decode!readId(); 2279 return ret; 2280 } 2281 2282 public override string toString() { 2283 return "Interact(action: " ~ std.conv.to!string(this.action) ~ ", target: " ~ std.conv.to!string(this.target) ~ ")"; 2284 } 2285 2286 } 2287 2288 class UseItem : Buffer { 2289 2290 public enum ubyte ID = 35; 2291 2292 public enum bool CLIENTBOUND = false; 2293 public enum bool SERVERBOUND = true; 2294 2295 public enum string[] FIELDS = ["blockPosition", "hotbarSlot", "face", "facePosition", "position", "slot", "item"]; 2296 2297 public sul.protocol.pocket100.types.BlockPosition blockPosition; 2298 public uint hotbarSlot; 2299 public int face; 2300 public Tuple!(float, "x", float, "y", float, "z") facePosition; 2301 public Tuple!(float, "x", float, "y", float, "z") position; 2302 public int slot; 2303 public sul.protocol.pocket100.types.Slot item; 2304 2305 public pure nothrow @safe @nogc this() {} 2306 2307 public pure nothrow @safe @nogc this(sul.protocol.pocket100.types.BlockPosition blockPosition, uint hotbarSlot=uint.init, int face=int.init, Tuple!(float, "x", float, "y", float, "z") facePosition=Tuple!(float, "x", float, "y", float, "z").init, Tuple!(float, "x", float, "y", float, "z") position=Tuple!(float, "x", float, "y", float, "z").init, int slot=int.init, sul.protocol.pocket100.types.Slot item=sul.protocol.pocket100.types.Slot.init) { 2308 this.blockPosition = blockPosition; 2309 this.hotbarSlot = hotbarSlot; 2310 this.face = face; 2311 this.facePosition = facePosition; 2312 this.position = position; 2313 this.slot = slot; 2314 this.item = item; 2315 } 2316 2317 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2318 _buffer.length = 0; 2319 static if(writeId){ writeBigEndianUbyte(ID); } 2320 blockPosition.encode(bufferInstance); 2321 writeBytes(varuint.encode(hotbarSlot)); 2322 writeBytes(varint.encode(face)); 2323 writeLittleEndianFloat(facePosition.x); writeLittleEndianFloat(facePosition.y); writeLittleEndianFloat(facePosition.z); 2324 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 2325 writeBytes(varint.encode(slot)); 2326 item.encode(bufferInstance); 2327 return _buffer; 2328 } 2329 2330 public pure nothrow @safe void decode(bool readId=true)() { 2331 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2332 blockPosition.decode(bufferInstance); 2333 hotbarSlot=varuint.decode(_buffer, &_index); 2334 face=varint.decode(_buffer, &_index); 2335 facePosition.x=readLittleEndianFloat(); facePosition.y=readLittleEndianFloat(); facePosition.z=readLittleEndianFloat(); 2336 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 2337 slot=varint.decode(_buffer, &_index); 2338 item.decode(bufferInstance); 2339 } 2340 2341 public static pure nothrow @safe UseItem fromBuffer(bool readId=true)(ubyte[] buffer) { 2342 UseItem ret = new UseItem(); 2343 ret._buffer = buffer; 2344 ret.decode!readId(); 2345 return ret; 2346 } 2347 2348 public override string toString() { 2349 return "UseItem(blockPosition: " ~ std.conv.to!string(this.blockPosition) ~ ", hotbarSlot: " ~ std.conv.to!string(this.hotbarSlot) ~ ", face: " ~ std.conv.to!string(this.face) ~ ", facePosition: " ~ std.conv.to!string(this.facePosition) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", slot: " ~ std.conv.to!string(this.slot) ~ ", item: " ~ std.conv.to!string(this.item) ~ ")"; 2350 } 2351 2352 } 2353 2354 class PlayerAction : Buffer { 2355 2356 public enum ubyte ID = 36; 2357 2358 public enum bool CLIENTBOUND = false; 2359 public enum bool SERVERBOUND = true; 2360 2361 // action 2362 public enum int START_BREAK = 0; 2363 public enum int ABORT_BREAK = 1; 2364 public enum int STOP_BREAK = 2; 2365 public enum int RELEASE_ITEM = 5; 2366 public enum int STOP_SLEEPING = 6; 2367 public enum int RESPAWN = 7; 2368 public enum int JUMP = 8; 2369 public enum int START_SPRINT = 9; 2370 public enum int STOP_SPRINT = 10; 2371 public enum int START_SNEAK = 11; 2372 public enum int STOP_SNEAK = 12; 2373 public enum int START_GLIDING = 15; 2374 public enum int STOP_GLIDING = 16; 2375 2376 public enum string[] FIELDS = ["entityId", "action", "position", "face"]; 2377 2378 public long entityId; 2379 public int action; 2380 public sul.protocol.pocket100.types.BlockPosition position; 2381 public int face; 2382 2383 public pure nothrow @safe @nogc this() {} 2384 2385 public pure nothrow @safe @nogc this(long entityId, int action=int.init, sul.protocol.pocket100.types.BlockPosition position=sul.protocol.pocket100.types.BlockPosition.init, int face=int.init) { 2386 this.entityId = entityId; 2387 this.action = action; 2388 this.position = position; 2389 this.face = face; 2390 } 2391 2392 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2393 _buffer.length = 0; 2394 static if(writeId){ writeBigEndianUbyte(ID); } 2395 writeBytes(varlong.encode(entityId)); 2396 writeBytes(varint.encode(action)); 2397 position.encode(bufferInstance); 2398 writeBytes(varint.encode(face)); 2399 return _buffer; 2400 } 2401 2402 public pure nothrow @safe void decode(bool readId=true)() { 2403 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2404 entityId=varlong.decode(_buffer, &_index); 2405 action=varint.decode(_buffer, &_index); 2406 position.decode(bufferInstance); 2407 face=varint.decode(_buffer, &_index); 2408 } 2409 2410 public static pure nothrow @safe PlayerAction fromBuffer(bool readId=true)(ubyte[] buffer) { 2411 PlayerAction ret = new PlayerAction(); 2412 ret._buffer = buffer; 2413 ret.decode!readId(); 2414 return ret; 2415 } 2416 2417 public override string toString() { 2418 return "PlayerAction(entityId: " ~ std.conv.to!string(this.entityId) ~ ", action: " ~ std.conv.to!string(this.action) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", face: " ~ std.conv.to!string(this.face) ~ ")"; 2419 } 2420 2421 } 2422 2423 class PlayerFall : Buffer { 2424 2425 public enum ubyte ID = 37; 2426 2427 public enum bool CLIENTBOUND = false; 2428 public enum bool SERVERBOUND = true; 2429 2430 public enum string[] FIELDS = ["distance"]; 2431 2432 public float distance; 2433 2434 public pure nothrow @safe @nogc this() {} 2435 2436 public pure nothrow @safe @nogc this(float distance) { 2437 this.distance = distance; 2438 } 2439 2440 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2441 _buffer.length = 0; 2442 static if(writeId){ writeBigEndianUbyte(ID); } 2443 writeLittleEndianFloat(distance); 2444 return _buffer; 2445 } 2446 2447 public pure nothrow @safe void decode(bool readId=true)() { 2448 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2449 distance=readLittleEndianFloat(); 2450 } 2451 2452 public static pure nothrow @safe PlayerFall fromBuffer(bool readId=true)(ubyte[] buffer) { 2453 PlayerFall ret = new PlayerFall(); 2454 ret._buffer = buffer; 2455 ret.decode!readId(); 2456 return ret; 2457 } 2458 2459 public override string toString() { 2460 return "PlayerFall(distance: " ~ std.conv.to!string(this.distance) ~ ")"; 2461 } 2462 2463 } 2464 2465 class HurtArmor : Buffer { 2466 2467 public enum ubyte ID = 38; 2468 2469 public enum bool CLIENTBOUND = true; 2470 public enum bool SERVERBOUND = false; 2471 2472 public enum string[] FIELDS = ["unknown0"]; 2473 2474 public int unknown0; 2475 2476 public pure nothrow @safe @nogc this() {} 2477 2478 public pure nothrow @safe @nogc this(int unknown0) { 2479 this.unknown0 = unknown0; 2480 } 2481 2482 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2483 _buffer.length = 0; 2484 static if(writeId){ writeBigEndianUbyte(ID); } 2485 writeBytes(varint.encode(unknown0)); 2486 return _buffer; 2487 } 2488 2489 public pure nothrow @safe void decode(bool readId=true)() { 2490 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2491 unknown0=varint.decode(_buffer, &_index); 2492 } 2493 2494 public static pure nothrow @safe HurtArmor fromBuffer(bool readId=true)(ubyte[] buffer) { 2495 HurtArmor ret = new HurtArmor(); 2496 ret._buffer = buffer; 2497 ret.decode!readId(); 2498 return ret; 2499 } 2500 2501 public override string toString() { 2502 return "HurtArmor(unknown0: " ~ std.conv.to!string(this.unknown0) ~ ")"; 2503 } 2504 2505 } 2506 2507 class SetEntityData : Buffer { 2508 2509 public enum ubyte ID = 39; 2510 2511 public enum bool CLIENTBOUND = true; 2512 public enum bool SERVERBOUND = false; 2513 2514 public enum string[] FIELDS = ["entityId", "metadata"]; 2515 2516 public long entityId; 2517 public Metadata metadata; 2518 2519 public pure nothrow @safe @nogc this() {} 2520 2521 public pure nothrow @safe @nogc this(long entityId, Metadata metadata=Metadata.init) { 2522 this.entityId = entityId; 2523 this.metadata = metadata; 2524 } 2525 2526 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2527 _buffer.length = 0; 2528 static if(writeId){ writeBigEndianUbyte(ID); } 2529 writeBytes(varlong.encode(entityId)); 2530 metadata.encode(bufferInstance); 2531 return _buffer; 2532 } 2533 2534 public pure nothrow @safe void decode(bool readId=true)() { 2535 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2536 entityId=varlong.decode(_buffer, &_index); 2537 metadata=Metadata.decode(bufferInstance); 2538 } 2539 2540 public static pure nothrow @safe SetEntityData fromBuffer(bool readId=true)(ubyte[] buffer) { 2541 SetEntityData ret = new SetEntityData(); 2542 ret._buffer = buffer; 2543 ret.decode!readId(); 2544 return ret; 2545 } 2546 2547 public override string toString() { 2548 return "SetEntityData(entityId: " ~ std.conv.to!string(this.entityId) ~ ", metadata: " ~ std.conv.to!string(this.metadata) ~ ")"; 2549 } 2550 2551 } 2552 2553 class SetEntityMotion : Buffer { 2554 2555 public enum ubyte ID = 40; 2556 2557 public enum bool CLIENTBOUND = true; 2558 public enum bool SERVERBOUND = false; 2559 2560 public enum string[] FIELDS = ["entityId", "motion"]; 2561 2562 public long entityId; 2563 public Tuple!(float, "x", float, "y", float, "z") motion; 2564 2565 public pure nothrow @safe @nogc this() {} 2566 2567 public pure nothrow @safe @nogc this(long entityId, Tuple!(float, "x", float, "y", float, "z") motion=Tuple!(float, "x", float, "y", float, "z").init) { 2568 this.entityId = entityId; 2569 this.motion = motion; 2570 } 2571 2572 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2573 _buffer.length = 0; 2574 static if(writeId){ writeBigEndianUbyte(ID); } 2575 writeBytes(varlong.encode(entityId)); 2576 writeLittleEndianFloat(motion.x); writeLittleEndianFloat(motion.y); writeLittleEndianFloat(motion.z); 2577 return _buffer; 2578 } 2579 2580 public pure nothrow @safe void decode(bool readId=true)() { 2581 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2582 entityId=varlong.decode(_buffer, &_index); 2583 motion.x=readLittleEndianFloat(); motion.y=readLittleEndianFloat(); motion.z=readLittleEndianFloat(); 2584 } 2585 2586 public static pure nothrow @safe SetEntityMotion fromBuffer(bool readId=true)(ubyte[] buffer) { 2587 SetEntityMotion ret = new SetEntityMotion(); 2588 ret._buffer = buffer; 2589 ret.decode!readId(); 2590 return ret; 2591 } 2592 2593 public override string toString() { 2594 return "SetEntityMotion(entityId: " ~ std.conv.to!string(this.entityId) ~ ", motion: " ~ std.conv.to!string(this.motion) ~ ")"; 2595 } 2596 2597 } 2598 2599 class SetEntityLink : Buffer { 2600 2601 public enum ubyte ID = 41; 2602 2603 public enum bool CLIENTBOUND = true; 2604 public enum bool SERVERBOUND = false; 2605 2606 // action 2607 public enum ubyte ADD = 0; 2608 public enum ubyte RIDE = 1; 2609 public enum ubyte REMOVE = 2; 2610 2611 public enum string[] FIELDS = ["from", "to", "action"]; 2612 2613 public long from; 2614 public long to; 2615 public ubyte action; 2616 2617 public pure nothrow @safe @nogc this() {} 2618 2619 public pure nothrow @safe @nogc this(long from, long to=long.init, ubyte action=ubyte.init) { 2620 this.from = from; 2621 this.to = to; 2622 this.action = action; 2623 } 2624 2625 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2626 _buffer.length = 0; 2627 static if(writeId){ writeBigEndianUbyte(ID); } 2628 writeBytes(varlong.encode(from)); 2629 writeBytes(varlong.encode(to)); 2630 writeBigEndianUbyte(action); 2631 return _buffer; 2632 } 2633 2634 public pure nothrow @safe void decode(bool readId=true)() { 2635 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2636 from=varlong.decode(_buffer, &_index); 2637 to=varlong.decode(_buffer, &_index); 2638 action=readBigEndianUbyte(); 2639 } 2640 2641 public static pure nothrow @safe SetEntityLink fromBuffer(bool readId=true)(ubyte[] buffer) { 2642 SetEntityLink ret = new SetEntityLink(); 2643 ret._buffer = buffer; 2644 ret.decode!readId(); 2645 return ret; 2646 } 2647 2648 public override string toString() { 2649 return "SetEntityLink(from: " ~ std.conv.to!string(this.from) ~ ", to: " ~ std.conv.to!string(this.to) ~ ", action: " ~ std.conv.to!string(this.action) ~ ")"; 2650 } 2651 2652 } 2653 2654 class SetHealth : Buffer { 2655 2656 public enum ubyte ID = 42; 2657 2658 public enum bool CLIENTBOUND = true; 2659 public enum bool SERVERBOUND = false; 2660 2661 public enum string[] FIELDS = ["health"]; 2662 2663 public int health; 2664 2665 public pure nothrow @safe @nogc this() {} 2666 2667 public pure nothrow @safe @nogc this(int health) { 2668 this.health = health; 2669 } 2670 2671 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2672 _buffer.length = 0; 2673 static if(writeId){ writeBigEndianUbyte(ID); } 2674 writeBytes(varint.encode(health)); 2675 return _buffer; 2676 } 2677 2678 public pure nothrow @safe void decode(bool readId=true)() { 2679 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2680 health=varint.decode(_buffer, &_index); 2681 } 2682 2683 public static pure nothrow @safe SetHealth fromBuffer(bool readId=true)(ubyte[] buffer) { 2684 SetHealth ret = new SetHealth(); 2685 ret._buffer = buffer; 2686 ret.decode!readId(); 2687 return ret; 2688 } 2689 2690 public override string toString() { 2691 return "SetHealth(health: " ~ std.conv.to!string(this.health) ~ ")"; 2692 } 2693 2694 } 2695 2696 class SetSpawnPosition : Buffer { 2697 2698 public enum ubyte ID = 43; 2699 2700 public enum bool CLIENTBOUND = true; 2701 public enum bool SERVERBOUND = false; 2702 2703 public enum string[] FIELDS = ["unknown0", "position", "unknown2"]; 2704 2705 public int unknown0; 2706 public sul.protocol.pocket100.types.BlockPosition position; 2707 public bool unknown2; 2708 2709 public pure nothrow @safe @nogc this() {} 2710 2711 public pure nothrow @safe @nogc this(int unknown0, sul.protocol.pocket100.types.BlockPosition position=sul.protocol.pocket100.types.BlockPosition.init, bool unknown2=bool.init) { 2712 this.unknown0 = unknown0; 2713 this.position = position; 2714 this.unknown2 = unknown2; 2715 } 2716 2717 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2718 _buffer.length = 0; 2719 static if(writeId){ writeBigEndianUbyte(ID); } 2720 writeBytes(varint.encode(unknown0)); 2721 position.encode(bufferInstance); 2722 writeBigEndianBool(unknown2); 2723 return _buffer; 2724 } 2725 2726 public pure nothrow @safe void decode(bool readId=true)() { 2727 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2728 unknown0=varint.decode(_buffer, &_index); 2729 position.decode(bufferInstance); 2730 unknown2=readBigEndianBool(); 2731 } 2732 2733 public static pure nothrow @safe SetSpawnPosition fromBuffer(bool readId=true)(ubyte[] buffer) { 2734 SetSpawnPosition ret = new SetSpawnPosition(); 2735 ret._buffer = buffer; 2736 ret.decode!readId(); 2737 return ret; 2738 } 2739 2740 public override string toString() { 2741 return "SetSpawnPosition(unknown0: " ~ std.conv.to!string(this.unknown0) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", unknown2: " ~ std.conv.to!string(this.unknown2) ~ ")"; 2742 } 2743 2744 } 2745 2746 class Animate : Buffer { 2747 2748 public enum ubyte ID = 44; 2749 2750 public enum bool CLIENTBOUND = true; 2751 public enum bool SERVERBOUND = true; 2752 2753 // action 2754 public enum int BREAKING = 1; 2755 public enum int WAKE_UP = 3; 2756 2757 public enum string[] FIELDS = ["action", "entityId"]; 2758 2759 public int action; 2760 public long entityId; 2761 2762 public pure nothrow @safe @nogc this() {} 2763 2764 public pure nothrow @safe @nogc this(int action, long entityId=long.init) { 2765 this.action = action; 2766 this.entityId = entityId; 2767 } 2768 2769 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2770 _buffer.length = 0; 2771 static if(writeId){ writeBigEndianUbyte(ID); } 2772 writeBytes(varint.encode(action)); 2773 writeBytes(varlong.encode(entityId)); 2774 return _buffer; 2775 } 2776 2777 public pure nothrow @safe void decode(bool readId=true)() { 2778 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2779 action=varint.decode(_buffer, &_index); 2780 entityId=varlong.decode(_buffer, &_index); 2781 } 2782 2783 public static pure nothrow @safe Animate fromBuffer(bool readId=true)(ubyte[] buffer) { 2784 Animate ret = new Animate(); 2785 ret._buffer = buffer; 2786 ret.decode!readId(); 2787 return ret; 2788 } 2789 2790 public override string toString() { 2791 return "Animate(action: " ~ std.conv.to!string(this.action) ~ ", entityId: " ~ std.conv.to!string(this.entityId) ~ ")"; 2792 } 2793 2794 } 2795 2796 class Respawn : Buffer { 2797 2798 public enum ubyte ID = 45; 2799 2800 public enum bool CLIENTBOUND = true; 2801 public enum bool SERVERBOUND = false; 2802 2803 public enum string[] FIELDS = ["position"]; 2804 2805 public Tuple!(float, "x", float, "y", float, "z") position; 2806 2807 public pure nothrow @safe @nogc this() {} 2808 2809 public pure nothrow @safe @nogc this(Tuple!(float, "x", float, "y", float, "z") position) { 2810 this.position = position; 2811 } 2812 2813 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2814 _buffer.length = 0; 2815 static if(writeId){ writeBigEndianUbyte(ID); } 2816 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 2817 return _buffer; 2818 } 2819 2820 public pure nothrow @safe void decode(bool readId=true)() { 2821 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2822 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 2823 } 2824 2825 public static pure nothrow @safe Respawn fromBuffer(bool readId=true)(ubyte[] buffer) { 2826 Respawn ret = new Respawn(); 2827 ret._buffer = buffer; 2828 ret.decode!readId(); 2829 return ret; 2830 } 2831 2832 public override string toString() { 2833 return "Respawn(position: " ~ std.conv.to!string(this.position) ~ ")"; 2834 } 2835 2836 } 2837 2838 class DropItem : Buffer { 2839 2840 public enum ubyte ID = 46; 2841 2842 public enum bool CLIENTBOUND = false; 2843 public enum bool SERVERBOUND = true; 2844 2845 // action 2846 public enum ubyte DROP = 0; 2847 2848 public enum string[] FIELDS = ["action", "item"]; 2849 2850 public ubyte action; 2851 public sul.protocol.pocket100.types.Slot item; 2852 2853 public pure nothrow @safe @nogc this() {} 2854 2855 public pure nothrow @safe @nogc this(ubyte action, sul.protocol.pocket100.types.Slot item=sul.protocol.pocket100.types.Slot.init) { 2856 this.action = action; 2857 this.item = item; 2858 } 2859 2860 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2861 _buffer.length = 0; 2862 static if(writeId){ writeBigEndianUbyte(ID); } 2863 writeBigEndianUbyte(action); 2864 item.encode(bufferInstance); 2865 return _buffer; 2866 } 2867 2868 public pure nothrow @safe void decode(bool readId=true)() { 2869 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2870 action=readBigEndianUbyte(); 2871 item.decode(bufferInstance); 2872 } 2873 2874 public static pure nothrow @safe DropItem fromBuffer(bool readId=true)(ubyte[] buffer) { 2875 DropItem ret = new DropItem(); 2876 ret._buffer = buffer; 2877 ret.decode!readId(); 2878 return ret; 2879 } 2880 2881 public override string toString() { 2882 return "DropItem(action: " ~ std.conv.to!string(this.action) ~ ", item: " ~ std.conv.to!string(this.item) ~ ")"; 2883 } 2884 2885 } 2886 2887 class InventoryAction : Buffer { 2888 2889 public enum ubyte ID = 47; 2890 2891 public enum bool CLIENTBOUND = false; 2892 public enum bool SERVERBOUND = true; 2893 2894 public enum string[] FIELDS = ["action", "item"]; 2895 2896 public int action; 2897 public sul.protocol.pocket100.types.Slot item; 2898 2899 public pure nothrow @safe @nogc this() {} 2900 2901 public pure nothrow @safe @nogc this(int action, sul.protocol.pocket100.types.Slot item=sul.protocol.pocket100.types.Slot.init) { 2902 this.action = action; 2903 this.item = item; 2904 } 2905 2906 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2907 _buffer.length = 0; 2908 static if(writeId){ writeBigEndianUbyte(ID); } 2909 writeBytes(varint.encode(action)); 2910 item.encode(bufferInstance); 2911 return _buffer; 2912 } 2913 2914 public pure nothrow @safe void decode(bool readId=true)() { 2915 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2916 action=varint.decode(_buffer, &_index); 2917 item.decode(bufferInstance); 2918 } 2919 2920 public static pure nothrow @safe InventoryAction fromBuffer(bool readId=true)(ubyte[] buffer) { 2921 InventoryAction ret = new InventoryAction(); 2922 ret._buffer = buffer; 2923 ret.decode!readId(); 2924 return ret; 2925 } 2926 2927 public override string toString() { 2928 return "InventoryAction(action: " ~ std.conv.to!string(this.action) ~ ", item: " ~ std.conv.to!string(this.item) ~ ")"; 2929 } 2930 2931 } 2932 2933 class ContainerOpen : Buffer { 2934 2935 public enum ubyte ID = 48; 2936 2937 public enum bool CLIENTBOUND = true; 2938 public enum bool SERVERBOUND = false; 2939 2940 public enum string[] FIELDS = ["window", "type", "slotCount", "position", "entityId"]; 2941 2942 public ubyte window; 2943 public ubyte type; 2944 public int slotCount; 2945 public sul.protocol.pocket100.types.BlockPosition position; 2946 public long entityId; 2947 2948 public pure nothrow @safe @nogc this() {} 2949 2950 public pure nothrow @safe @nogc this(ubyte window, ubyte type=ubyte.init, int slotCount=int.init, sul.protocol.pocket100.types.BlockPosition position=sul.protocol.pocket100.types.BlockPosition.init, long entityId=long.init) { 2951 this.window = window; 2952 this.type = type; 2953 this.slotCount = slotCount; 2954 this.position = position; 2955 this.entityId = entityId; 2956 } 2957 2958 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2959 _buffer.length = 0; 2960 static if(writeId){ writeBigEndianUbyte(ID); } 2961 writeBigEndianUbyte(window); 2962 writeBigEndianUbyte(type); 2963 writeBytes(varint.encode(slotCount)); 2964 position.encode(bufferInstance); 2965 writeBytes(varlong.encode(entityId)); 2966 return _buffer; 2967 } 2968 2969 public pure nothrow @safe void decode(bool readId=true)() { 2970 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 2971 window=readBigEndianUbyte(); 2972 type=readBigEndianUbyte(); 2973 slotCount=varint.decode(_buffer, &_index); 2974 position.decode(bufferInstance); 2975 entityId=varlong.decode(_buffer, &_index); 2976 } 2977 2978 public static pure nothrow @safe ContainerOpen fromBuffer(bool readId=true)(ubyte[] buffer) { 2979 ContainerOpen ret = new ContainerOpen(); 2980 ret._buffer = buffer; 2981 ret.decode!readId(); 2982 return ret; 2983 } 2984 2985 public override string toString() { 2986 return "ContainerOpen(window: " ~ std.conv.to!string(this.window) ~ ", type: " ~ std.conv.to!string(this.type) ~ ", slotCount: " ~ std.conv.to!string(this.slotCount) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", entityId: " ~ std.conv.to!string(this.entityId) ~ ")"; 2987 } 2988 2989 } 2990 2991 class ContainerClose : Buffer { 2992 2993 public enum ubyte ID = 49; 2994 2995 public enum bool CLIENTBOUND = true; 2996 public enum bool SERVERBOUND = true; 2997 2998 public enum string[] FIELDS = ["window"]; 2999 3000 public ubyte window; 3001 3002 public pure nothrow @safe @nogc this() {} 3003 3004 public pure nothrow @safe @nogc this(ubyte window) { 3005 this.window = window; 3006 } 3007 3008 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3009 _buffer.length = 0; 3010 static if(writeId){ writeBigEndianUbyte(ID); } 3011 writeBigEndianUbyte(window); 3012 return _buffer; 3013 } 3014 3015 public pure nothrow @safe void decode(bool readId=true)() { 3016 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3017 window=readBigEndianUbyte(); 3018 } 3019 3020 public static pure nothrow @safe ContainerClose fromBuffer(bool readId=true)(ubyte[] buffer) { 3021 ContainerClose ret = new ContainerClose(); 3022 ret._buffer = buffer; 3023 ret.decode!readId(); 3024 return ret; 3025 } 3026 3027 public override string toString() { 3028 return "ContainerClose(window: " ~ std.conv.to!string(this.window) ~ ")"; 3029 } 3030 3031 } 3032 3033 class ContainerSetSlot : Buffer { 3034 3035 public enum ubyte ID = 50; 3036 3037 public enum bool CLIENTBOUND = true; 3038 public enum bool SERVERBOUND = true; 3039 3040 public enum string[] FIELDS = ["window", "slot", "hotbarSlot", "item", "unknown4"]; 3041 3042 public ubyte window; 3043 public int slot; 3044 public int hotbarSlot; 3045 public sul.protocol.pocket100.types.Slot item; 3046 public ubyte unknown4; 3047 3048 public pure nothrow @safe @nogc this() {} 3049 3050 public pure nothrow @safe @nogc this(ubyte window, int slot=int.init, int hotbarSlot=int.init, sul.protocol.pocket100.types.Slot item=sul.protocol.pocket100.types.Slot.init, ubyte unknown4=ubyte.init) { 3051 this.window = window; 3052 this.slot = slot; 3053 this.hotbarSlot = hotbarSlot; 3054 this.item = item; 3055 this.unknown4 = unknown4; 3056 } 3057 3058 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3059 _buffer.length = 0; 3060 static if(writeId){ writeBigEndianUbyte(ID); } 3061 writeBigEndianUbyte(window); 3062 writeBytes(varint.encode(slot)); 3063 writeBytes(varint.encode(hotbarSlot)); 3064 item.encode(bufferInstance); 3065 writeBigEndianUbyte(unknown4); 3066 return _buffer; 3067 } 3068 3069 public pure nothrow @safe void decode(bool readId=true)() { 3070 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3071 window=readBigEndianUbyte(); 3072 slot=varint.decode(_buffer, &_index); 3073 hotbarSlot=varint.decode(_buffer, &_index); 3074 item.decode(bufferInstance); 3075 unknown4=readBigEndianUbyte(); 3076 } 3077 3078 public static pure nothrow @safe ContainerSetSlot fromBuffer(bool readId=true)(ubyte[] buffer) { 3079 ContainerSetSlot ret = new ContainerSetSlot(); 3080 ret._buffer = buffer; 3081 ret.decode!readId(); 3082 return ret; 3083 } 3084 3085 public override string toString() { 3086 return "ContainerSetSlot(window: " ~ std.conv.to!string(this.window) ~ ", slot: " ~ std.conv.to!string(this.slot) ~ ", hotbarSlot: " ~ std.conv.to!string(this.hotbarSlot) ~ ", item: " ~ std.conv.to!string(this.item) ~ ", unknown4: " ~ std.conv.to!string(this.unknown4) ~ ")"; 3087 } 3088 3089 } 3090 3091 class ContainerSetData : Buffer { 3092 3093 public enum ubyte ID = 51; 3094 3095 public enum bool CLIENTBOUND = true; 3096 public enum bool SERVERBOUND = false; 3097 3098 public enum string[] FIELDS = ["window", "property", "value"]; 3099 3100 public ubyte window; 3101 public int property; 3102 public int value; 3103 3104 public pure nothrow @safe @nogc this() {} 3105 3106 public pure nothrow @safe @nogc this(ubyte window, int property=int.init, int value=int.init) { 3107 this.window = window; 3108 this.property = property; 3109 this.value = value; 3110 } 3111 3112 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3113 _buffer.length = 0; 3114 static if(writeId){ writeBigEndianUbyte(ID); } 3115 writeBigEndianUbyte(window); 3116 writeBytes(varint.encode(property)); 3117 writeBytes(varint.encode(value)); 3118 return _buffer; 3119 } 3120 3121 public pure nothrow @safe void decode(bool readId=true)() { 3122 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3123 window=readBigEndianUbyte(); 3124 property=varint.decode(_buffer, &_index); 3125 value=varint.decode(_buffer, &_index); 3126 } 3127 3128 public static pure nothrow @safe ContainerSetData fromBuffer(bool readId=true)(ubyte[] buffer) { 3129 ContainerSetData ret = new ContainerSetData(); 3130 ret._buffer = buffer; 3131 ret.decode!readId(); 3132 return ret; 3133 } 3134 3135 public override string toString() { 3136 return "ContainerSetData(window: " ~ std.conv.to!string(this.window) ~ ", property: " ~ std.conv.to!string(this.property) ~ ", value: " ~ std.conv.to!string(this.value) ~ ")"; 3137 } 3138 3139 } 3140 3141 class ContainerSetContent : Buffer { 3142 3143 public enum ubyte ID = 52; 3144 3145 public enum bool CLIENTBOUND = true; 3146 public enum bool SERVERBOUND = false; 3147 3148 public enum string[] FIELDS = ["window", "slots", "hotbar"]; 3149 3150 public ubyte window; 3151 public sul.protocol.pocket100.types.Slot[] slots; 3152 public int[] hotbar; 3153 3154 public pure nothrow @safe @nogc this() {} 3155 3156 public pure nothrow @safe @nogc this(ubyte window, sul.protocol.pocket100.types.Slot[] slots=(sul.protocol.pocket100.types.Slot[]).init, int[] hotbar=(int[]).init) { 3157 this.window = window; 3158 this.slots = slots; 3159 this.hotbar = hotbar; 3160 } 3161 3162 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3163 _buffer.length = 0; 3164 static if(writeId){ writeBigEndianUbyte(ID); } 3165 writeBigEndianUbyte(window); 3166 writeBytes(varuint.encode(cast(uint)slots.length)); foreach(cxdm;slots){ cxdm.encode(bufferInstance); } 3167 writeBytes(varuint.encode(cast(uint)hotbar.length)); foreach(a9yf;hotbar){ writeBytes(varint.encode(a9yf)); } 3168 return _buffer; 3169 } 3170 3171 public pure nothrow @safe void decode(bool readId=true)() { 3172 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3173 window=readBigEndianUbyte(); 3174 slots.length=varuint.decode(_buffer, &_index); foreach(ref cxdm;slots){ cxdm.decode(bufferInstance); } 3175 hotbar.length=varuint.decode(_buffer, &_index); foreach(ref a9yf;hotbar){ a9yf=varint.decode(_buffer, &_index); } 3176 } 3177 3178 public static pure nothrow @safe ContainerSetContent fromBuffer(bool readId=true)(ubyte[] buffer) { 3179 ContainerSetContent ret = new ContainerSetContent(); 3180 ret._buffer = buffer; 3181 ret.decode!readId(); 3182 return ret; 3183 } 3184 3185 public override string toString() { 3186 return "ContainerSetContent(window: " ~ std.conv.to!string(this.window) ~ ", slots: " ~ std.conv.to!string(this.slots) ~ ", hotbar: " ~ std.conv.to!string(this.hotbar) ~ ")"; 3187 } 3188 3189 } 3190 3191 class CraftingData : Buffer { 3192 3193 public enum ubyte ID = 53; 3194 3195 public enum bool CLIENTBOUND = true; 3196 public enum bool SERVERBOUND = false; 3197 3198 public enum string[] FIELDS = ["recipes"]; 3199 3200 public sul.protocol.pocket100.types.Recipe[] recipes; 3201 3202 public pure nothrow @safe @nogc this() {} 3203 3204 public pure nothrow @safe @nogc this(sul.protocol.pocket100.types.Recipe[] recipes) { 3205 this.recipes = recipes; 3206 } 3207 3208 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3209 _buffer.length = 0; 3210 static if(writeId){ writeBigEndianUbyte(ID); } 3211 writeBytes(varuint.encode(cast(uint)recipes.length)); foreach(cvabc;recipes){ cvabc.encode(bufferInstance); } 3212 return _buffer; 3213 } 3214 3215 public pure nothrow @safe void decode(bool readId=true)() { 3216 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3217 recipes.length=varuint.decode(_buffer, &_index); foreach(ref cvabc;recipes){ cvabc.decode(bufferInstance); } 3218 } 3219 3220 public static pure nothrow @safe CraftingData fromBuffer(bool readId=true)(ubyte[] buffer) { 3221 CraftingData ret = new CraftingData(); 3222 ret._buffer = buffer; 3223 ret.decode!readId(); 3224 return ret; 3225 } 3226 3227 public override string toString() { 3228 return "CraftingData(recipes: " ~ std.conv.to!string(this.recipes) ~ ")"; 3229 } 3230 3231 } 3232 3233 class CraftingEvent : Buffer { 3234 3235 public enum ubyte ID = 54; 3236 3237 public enum bool CLIENTBOUND = false; 3238 public enum bool SERVERBOUND = true; 3239 3240 public enum string[] FIELDS = ["window", "type", "uuid", "input", "output"]; 3241 3242 public ubyte window; 3243 public int type; 3244 public UUID uuid; 3245 public sul.protocol.pocket100.types.Slot[] input; 3246 public sul.protocol.pocket100.types.Slot[] output; 3247 3248 public pure nothrow @safe @nogc this() {} 3249 3250 public pure nothrow @safe @nogc this(ubyte window, int type=int.init, UUID uuid=UUID.init, sul.protocol.pocket100.types.Slot[] input=(sul.protocol.pocket100.types.Slot[]).init, sul.protocol.pocket100.types.Slot[] output=(sul.protocol.pocket100.types.Slot[]).init) { 3251 this.window = window; 3252 this.type = type; 3253 this.uuid = uuid; 3254 this.input = input; 3255 this.output = output; 3256 } 3257 3258 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3259 _buffer.length = 0; 3260 static if(writeId){ writeBigEndianUbyte(ID); } 3261 writeBigEndianUbyte(window); 3262 writeBytes(varint.encode(type)); 3263 writeBytes(uuid.data); 3264 writeBytes(varuint.encode(cast(uint)input.length)); foreach(a5dq;input){ a5dq.encode(bufferInstance); } 3265 writeBytes(varuint.encode(cast(uint)output.length)); foreach(bvcv;output){ bvcv.encode(bufferInstance); } 3266 return _buffer; 3267 } 3268 3269 public pure nothrow @safe void decode(bool readId=true)() { 3270 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3271 window=readBigEndianUbyte(); 3272 type=varint.decode(_buffer, &_index); 3273 if(_buffer.length>=_index+16){ ubyte[16] dvz=_buffer[_index.._index+16].dup; _index+=16; uuid=UUID(dvz); } 3274 input.length=varuint.decode(_buffer, &_index); foreach(ref a5dq;input){ a5dq.decode(bufferInstance); } 3275 output.length=varuint.decode(_buffer, &_index); foreach(ref bvcv;output){ bvcv.decode(bufferInstance); } 3276 } 3277 3278 public static pure nothrow @safe CraftingEvent fromBuffer(bool readId=true)(ubyte[] buffer) { 3279 CraftingEvent ret = new CraftingEvent(); 3280 ret._buffer = buffer; 3281 ret.decode!readId(); 3282 return ret; 3283 } 3284 3285 public override string toString() { 3286 return "CraftingEvent(window: " ~ std.conv.to!string(this.window) ~ ", type: " ~ std.conv.to!string(this.type) ~ ", uuid: " ~ std.conv.to!string(this.uuid) ~ ", input: " ~ std.conv.to!string(this.input) ~ ", output: " ~ std.conv.to!string(this.output) ~ ")"; 3287 } 3288 3289 } 3290 3291 class AdventureSettings : Buffer { 3292 3293 public enum ubyte ID = 55; 3294 3295 public enum bool CLIENTBOUND = true; 3296 public enum bool SERVERBOUND = true; 3297 3298 // flags 3299 public enum uint IMMUTABLE_WORLD = 1; 3300 public enum uint PVP_DISABLED = 2; 3301 public enum uint PVM_DISABLED = 4; 3302 public enum uint MVP_DISBALED = 8; 3303 public enum uint EVP_DISABLED = 16; 3304 public enum uint AUTO_JUMP = 32; 3305 public enum uint ALLOW_FLIGHT = 64; 3306 public enum uint NO_CLIP = 128; 3307 public enum uint FLYING = 512; 3308 3309 // permissions 3310 public enum uint USER = 0; 3311 public enum uint OPERATOR = 1; 3312 public enum uint HOST = 2; 3313 public enum uint AUTOMATION = 3; 3314 public enum uint ADMIN = 4; 3315 3316 public enum string[] FIELDS = ["flags", "permissions"]; 3317 3318 public uint flags; 3319 public uint permissions; 3320 3321 public pure nothrow @safe @nogc this() {} 3322 3323 public pure nothrow @safe @nogc this(uint flags, uint permissions=uint.init) { 3324 this.flags = flags; 3325 this.permissions = permissions; 3326 } 3327 3328 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3329 _buffer.length = 0; 3330 static if(writeId){ writeBigEndianUbyte(ID); } 3331 writeBytes(varuint.encode(flags)); 3332 writeBytes(varuint.encode(permissions)); 3333 return _buffer; 3334 } 3335 3336 public pure nothrow @safe void decode(bool readId=true)() { 3337 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3338 flags=varuint.decode(_buffer, &_index); 3339 permissions=varuint.decode(_buffer, &_index); 3340 } 3341 3342 public static pure nothrow @safe AdventureSettings fromBuffer(bool readId=true)(ubyte[] buffer) { 3343 AdventureSettings ret = new AdventureSettings(); 3344 ret._buffer = buffer; 3345 ret.decode!readId(); 3346 return ret; 3347 } 3348 3349 public override string toString() { 3350 return "AdventureSettings(flags: " ~ std.conv.to!string(this.flags) ~ ", permissions: " ~ std.conv.to!string(this.permissions) ~ ")"; 3351 } 3352 3353 } 3354 3355 class BlockEntityData : Buffer { 3356 3357 public enum ubyte ID = 56; 3358 3359 public enum bool CLIENTBOUND = true; 3360 public enum bool SERVERBOUND = true; 3361 3362 public enum string[] FIELDS = ["position", "nbt"]; 3363 3364 public sul.protocol.pocket100.types.BlockPosition position; 3365 public ubyte[] nbt; 3366 3367 public pure nothrow @safe @nogc this() {} 3368 3369 public pure nothrow @safe @nogc this(sul.protocol.pocket100.types.BlockPosition position, ubyte[] nbt=(ubyte[]).init) { 3370 this.position = position; 3371 this.nbt = nbt; 3372 } 3373 3374 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3375 _buffer.length = 0; 3376 static if(writeId){ writeBigEndianUbyte(ID); } 3377 position.encode(bufferInstance); 3378 writeBytes(nbt); 3379 return _buffer; 3380 } 3381 3382 public pure nothrow @safe void decode(bool readId=true)() { 3383 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3384 position.decode(bufferInstance); 3385 nbt=_buffer[_index..$].dup; _index=_buffer.length; 3386 } 3387 3388 public static pure nothrow @safe BlockEntityData fromBuffer(bool readId=true)(ubyte[] buffer) { 3389 BlockEntityData ret = new BlockEntityData(); 3390 ret._buffer = buffer; 3391 ret.decode!readId(); 3392 return ret; 3393 } 3394 3395 public override string toString() { 3396 return "BlockEntityData(position: " ~ std.conv.to!string(this.position) ~ ", nbt: " ~ std.conv.to!string(this.nbt) ~ ")"; 3397 } 3398 3399 } 3400 3401 class PlayerInput : Buffer { 3402 3403 public enum ubyte ID = 57; 3404 3405 public enum bool CLIENTBOUND = false; 3406 public enum bool SERVERBOUND = true; 3407 3408 public enum string[] FIELDS = ["motion", "flags", "unknown2"]; 3409 3410 public Tuple!(float, "x", float, "y", float, "z") motion; 3411 public ubyte flags; 3412 public bool unknown2; 3413 3414 public pure nothrow @safe @nogc this() {} 3415 3416 public pure nothrow @safe @nogc this(Tuple!(float, "x", float, "y", float, "z") motion, ubyte flags=ubyte.init, bool unknown2=bool.init) { 3417 this.motion = motion; 3418 this.flags = flags; 3419 this.unknown2 = unknown2; 3420 } 3421 3422 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3423 _buffer.length = 0; 3424 static if(writeId){ writeBigEndianUbyte(ID); } 3425 writeLittleEndianFloat(motion.x); writeLittleEndianFloat(motion.y); writeLittleEndianFloat(motion.z); 3426 writeBigEndianUbyte(flags); 3427 writeBigEndianBool(unknown2); 3428 return _buffer; 3429 } 3430 3431 public pure nothrow @safe void decode(bool readId=true)() { 3432 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3433 motion.x=readLittleEndianFloat(); motion.y=readLittleEndianFloat(); motion.z=readLittleEndianFloat(); 3434 flags=readBigEndianUbyte(); 3435 unknown2=readBigEndianBool(); 3436 } 3437 3438 public static pure nothrow @safe PlayerInput fromBuffer(bool readId=true)(ubyte[] buffer) { 3439 PlayerInput ret = new PlayerInput(); 3440 ret._buffer = buffer; 3441 ret.decode!readId(); 3442 return ret; 3443 } 3444 3445 public override string toString() { 3446 return "PlayerInput(motion: " ~ std.conv.to!string(this.motion) ~ ", flags: " ~ std.conv.to!string(this.flags) ~ ", unknown2: " ~ std.conv.to!string(this.unknown2) ~ ")"; 3447 } 3448 3449 } 3450 3451 class FullChunkData : Buffer { 3452 3453 public enum ubyte ID = 58; 3454 3455 public enum bool CLIENTBOUND = true; 3456 public enum bool SERVERBOUND = false; 3457 3458 public enum string[] FIELDS = ["position", "data"]; 3459 3460 public Tuple!(int, "x", int, "z") position; 3461 public sul.protocol.pocket100.types.ChunkData data; 3462 3463 public pure nothrow @safe @nogc this() {} 3464 3465 public pure nothrow @safe @nogc this(Tuple!(int, "x", int, "z") position, sul.protocol.pocket100.types.ChunkData data=sul.protocol.pocket100.types.ChunkData.init) { 3466 this.position = position; 3467 this.data = data; 3468 } 3469 3470 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3471 _buffer.length = 0; 3472 static if(writeId){ writeBigEndianUbyte(ID); } 3473 writeBytes(varint.encode(position.x)); writeBytes(varint.encode(position.z)); 3474 data.encode(bufferInstance); 3475 return _buffer; 3476 } 3477 3478 public pure nothrow @safe void decode(bool readId=true)() { 3479 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3480 position.x=varint.decode(_buffer, &_index); position.z=varint.decode(_buffer, &_index); 3481 data.decode(bufferInstance); 3482 } 3483 3484 public static pure nothrow @safe FullChunkData fromBuffer(bool readId=true)(ubyte[] buffer) { 3485 FullChunkData ret = new FullChunkData(); 3486 ret._buffer = buffer; 3487 ret.decode!readId(); 3488 return ret; 3489 } 3490 3491 public override string toString() { 3492 return "FullChunkData(position: " ~ std.conv.to!string(this.position) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")"; 3493 } 3494 3495 } 3496 3497 class SetCommandsEnabled : Buffer { 3498 3499 public enum ubyte ID = 59; 3500 3501 public enum bool CLIENTBOUND = true; 3502 public enum bool SERVERBOUND = false; 3503 3504 public enum string[] FIELDS = ["enabled"]; 3505 3506 public bool enabled; 3507 3508 public pure nothrow @safe @nogc this() {} 3509 3510 public pure nothrow @safe @nogc this(bool enabled) { 3511 this.enabled = enabled; 3512 } 3513 3514 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3515 _buffer.length = 0; 3516 static if(writeId){ writeBigEndianUbyte(ID); } 3517 writeBigEndianBool(enabled); 3518 return _buffer; 3519 } 3520 3521 public pure nothrow @safe void decode(bool readId=true)() { 3522 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3523 enabled=readBigEndianBool(); 3524 } 3525 3526 public static pure nothrow @safe SetCommandsEnabled fromBuffer(bool readId=true)(ubyte[] buffer) { 3527 SetCommandsEnabled ret = new SetCommandsEnabled(); 3528 ret._buffer = buffer; 3529 ret.decode!readId(); 3530 return ret; 3531 } 3532 3533 public override string toString() { 3534 return "SetCommandsEnabled(enabled: " ~ std.conv.to!string(this.enabled) ~ ")"; 3535 } 3536 3537 } 3538 3539 class SetDifficulty : Buffer { 3540 3541 public enum ubyte ID = 60; 3542 3543 public enum bool CLIENTBOUND = true; 3544 public enum bool SERVERBOUND = false; 3545 3546 // difficulty 3547 public enum uint PEACEFUL = 0; 3548 public enum uint EASY = 1; 3549 public enum uint NORMAL = 2; 3550 public enum uint HARD = 3; 3551 3552 public enum string[] FIELDS = ["difficulty"]; 3553 3554 public uint difficulty; 3555 3556 public pure nothrow @safe @nogc this() {} 3557 3558 public pure nothrow @safe @nogc this(uint difficulty) { 3559 this.difficulty = difficulty; 3560 } 3561 3562 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3563 _buffer.length = 0; 3564 static if(writeId){ writeBigEndianUbyte(ID); } 3565 writeBytes(varuint.encode(difficulty)); 3566 return _buffer; 3567 } 3568 3569 public pure nothrow @safe void decode(bool readId=true)() { 3570 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3571 difficulty=varuint.decode(_buffer, &_index); 3572 } 3573 3574 public static pure nothrow @safe SetDifficulty fromBuffer(bool readId=true)(ubyte[] buffer) { 3575 SetDifficulty ret = new SetDifficulty(); 3576 ret._buffer = buffer; 3577 ret.decode!readId(); 3578 return ret; 3579 } 3580 3581 public override string toString() { 3582 return "SetDifficulty(difficulty: " ~ std.conv.to!string(this.difficulty) ~ ")"; 3583 } 3584 3585 } 3586 3587 class ChangeDimension : Buffer { 3588 3589 public enum ubyte ID = 61; 3590 3591 public enum bool CLIENTBOUND = true; 3592 public enum bool SERVERBOUND = false; 3593 3594 // dimension 3595 public enum int OVERWORLD = 0; 3596 public enum int NETHER = 1; 3597 public enum int END = 2; 3598 3599 public enum string[] FIELDS = ["dimension", "position", "unknown2"]; 3600 3601 public int dimension; 3602 public Tuple!(float, "x", float, "y", float, "z") position; 3603 public bool unknown2; 3604 3605 public pure nothrow @safe @nogc this() {} 3606 3607 public pure nothrow @safe @nogc this(int dimension, Tuple!(float, "x", float, "y", float, "z") position=Tuple!(float, "x", float, "y", float, "z").init, bool unknown2=bool.init) { 3608 this.dimension = dimension; 3609 this.position = position; 3610 this.unknown2 = unknown2; 3611 } 3612 3613 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3614 _buffer.length = 0; 3615 static if(writeId){ writeBigEndianUbyte(ID); } 3616 writeBytes(varint.encode(dimension)); 3617 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 3618 writeBigEndianBool(unknown2); 3619 return _buffer; 3620 } 3621 3622 public pure nothrow @safe void decode(bool readId=true)() { 3623 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3624 dimension=varint.decode(_buffer, &_index); 3625 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 3626 unknown2=readBigEndianBool(); 3627 } 3628 3629 public static pure nothrow @safe ChangeDimension fromBuffer(bool readId=true)(ubyte[] buffer) { 3630 ChangeDimension ret = new ChangeDimension(); 3631 ret._buffer = buffer; 3632 ret.decode!readId(); 3633 return ret; 3634 } 3635 3636 public override string toString() { 3637 return "ChangeDimension(dimension: " ~ std.conv.to!string(this.dimension) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", unknown2: " ~ std.conv.to!string(this.unknown2) ~ ")"; 3638 } 3639 3640 } 3641 3642 class SetPlayerGameType : Buffer { 3643 3644 public enum ubyte ID = 62; 3645 3646 public enum bool CLIENTBOUND = true; 3647 public enum bool SERVERBOUND = true; 3648 3649 // gamemode 3650 public enum int SURVIVAL = 0; 3651 public enum int CREATIVE = 1; 3652 3653 public enum string[] FIELDS = ["gamemode"]; 3654 3655 public int gamemode; 3656 3657 public pure nothrow @safe @nogc this() {} 3658 3659 public pure nothrow @safe @nogc this(int gamemode) { 3660 this.gamemode = gamemode; 3661 } 3662 3663 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3664 _buffer.length = 0; 3665 static if(writeId){ writeBigEndianUbyte(ID); } 3666 writeBytes(varint.encode(gamemode)); 3667 return _buffer; 3668 } 3669 3670 public pure nothrow @safe void decode(bool readId=true)() { 3671 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3672 gamemode=varint.decode(_buffer, &_index); 3673 } 3674 3675 public static pure nothrow @safe SetPlayerGameType fromBuffer(bool readId=true)(ubyte[] buffer) { 3676 SetPlayerGameType ret = new SetPlayerGameType(); 3677 ret._buffer = buffer; 3678 ret.decode!readId(); 3679 return ret; 3680 } 3681 3682 public override string toString() { 3683 return "SetPlayerGameType(gamemode: " ~ std.conv.to!string(this.gamemode) ~ ")"; 3684 } 3685 3686 } 3687 3688 class PlayerList : Buffer { 3689 3690 public enum ubyte ID = 63; 3691 3692 public enum bool CLIENTBOUND = true; 3693 public enum bool SERVERBOUND = false; 3694 3695 public enum string[] FIELDS = ["action"]; 3696 3697 public ubyte action; 3698 3699 public pure nothrow @safe @nogc this() {} 3700 3701 public pure nothrow @safe @nogc this(ubyte action) { 3702 this.action = action; 3703 } 3704 3705 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3706 _buffer.length = 0; 3707 static if(writeId){ writeBigEndianUbyte(ID); } 3708 writeBigEndianUbyte(action); 3709 return _buffer; 3710 } 3711 3712 public pure nothrow @safe void decode(bool readId=true)() { 3713 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3714 action=readBigEndianUbyte(); 3715 } 3716 3717 public static pure nothrow @safe PlayerList fromBuffer(bool readId=true)(ubyte[] buffer) { 3718 PlayerList ret = new PlayerList(); 3719 ret._buffer = buffer; 3720 ret.decode!readId(); 3721 return ret; 3722 } 3723 3724 public override string toString() { 3725 return "PlayerList(action: " ~ std.conv.to!string(this.action) ~ ")"; 3726 } 3727 3728 alias _encode = encode; 3729 3730 enum string variantField = "action"; 3731 3732 alias Variants = TypeTuple!(Add, Remove); 3733 3734 public class Add { 3735 3736 public enum typeof(action) ACTION = 0; 3737 3738 public enum string[] FIELDS = ["players"]; 3739 3740 public sul.protocol.pocket100.types.PlayerList[] players; 3741 3742 public pure nothrow @safe @nogc this() {} 3743 3744 public pure nothrow @safe @nogc this(sul.protocol.pocket100.types.PlayerList[] players) { 3745 this.players = players; 3746 } 3747 3748 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3749 action = 0; 3750 _encode!writeId(); 3751 writeBytes(varuint.encode(cast(uint)players.length)); foreach(cxevc;players){ cxevc.encode(bufferInstance); } 3752 return _buffer; 3753 } 3754 3755 public pure nothrow @safe void decode() { 3756 players.length=varuint.decode(_buffer, &_index); foreach(ref cxevc;players){ cxevc.decode(bufferInstance); } 3757 } 3758 3759 public override string toString() { 3760 return "PlayerList.Add(players: " ~ std.conv.to!string(this.players) ~ ")"; 3761 } 3762 3763 } 3764 3765 public class Remove { 3766 3767 public enum typeof(action) ACTION = 1; 3768 3769 public enum string[] FIELDS = ["players"]; 3770 3771 public UUID[] players; 3772 3773 public pure nothrow @safe @nogc this() {} 3774 3775 public pure nothrow @safe @nogc this(UUID[] players) { 3776 this.players = players; 3777 } 3778 3779 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3780 action = 1; 3781 _encode!writeId(); 3782 writeBytes(varuint.encode(cast(uint)players.length)); foreach(cxevc;players){ writeBytes(cxevc.data); } 3783 return _buffer; 3784 } 3785 3786 public pure nothrow @safe void decode() { 3787 players.length=varuint.decode(_buffer, &_index); foreach(ref cxevc;players){ if(_buffer.length>=_index+16){ ubyte[16] yhdm=_buffer[_index.._index+16].dup; _index+=16; cxevc=UUID(yhdm); } } 3788 } 3789 3790 public override string toString() { 3791 return "PlayerList.Remove(players: " ~ std.conv.to!string(this.players) ~ ")"; 3792 } 3793 3794 } 3795 3796 } 3797 3798 class TelemetryEvent : Buffer { 3799 3800 public enum ubyte ID = 64; 3801 3802 public enum bool CLIENTBOUND = true; 3803 public enum bool SERVERBOUND = false; 3804 3805 public enum string[] FIELDS = ["entityId", "eventId"]; 3806 3807 public long entityId; 3808 public int eventId; 3809 3810 public pure nothrow @safe @nogc this() {} 3811 3812 public pure nothrow @safe @nogc this(long entityId, int eventId=int.init) { 3813 this.entityId = entityId; 3814 this.eventId = eventId; 3815 } 3816 3817 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3818 _buffer.length = 0; 3819 static if(writeId){ writeBigEndianUbyte(ID); } 3820 writeBytes(varlong.encode(entityId)); 3821 writeBytes(varint.encode(eventId)); 3822 return _buffer; 3823 } 3824 3825 public pure nothrow @safe void decode(bool readId=true)() { 3826 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3827 entityId=varlong.decode(_buffer, &_index); 3828 eventId=varint.decode(_buffer, &_index); 3829 } 3830 3831 public static pure nothrow @safe TelemetryEvent fromBuffer(bool readId=true)(ubyte[] buffer) { 3832 TelemetryEvent ret = new TelemetryEvent(); 3833 ret._buffer = buffer; 3834 ret.decode!readId(); 3835 return ret; 3836 } 3837 3838 public override string toString() { 3839 return "TelemetryEvent(entityId: " ~ std.conv.to!string(this.entityId) ~ ", eventId: " ~ std.conv.to!string(this.eventId) ~ ")"; 3840 } 3841 3842 } 3843 3844 class SpawnExperienceOrb : Buffer { 3845 3846 public enum ubyte ID = 65; 3847 3848 public enum bool CLIENTBOUND = true; 3849 public enum bool SERVERBOUND = false; 3850 3851 public enum string[] FIELDS = ["position", "count"]; 3852 3853 public Tuple!(float, "x", float, "y", float, "z") position; 3854 public int count; 3855 3856 public pure nothrow @safe @nogc this() {} 3857 3858 public pure nothrow @safe @nogc this(Tuple!(float, "x", float, "y", float, "z") position, int count=int.init) { 3859 this.position = position; 3860 this.count = count; 3861 } 3862 3863 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3864 _buffer.length = 0; 3865 static if(writeId){ writeBigEndianUbyte(ID); } 3866 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 3867 writeBytes(varint.encode(count)); 3868 return _buffer; 3869 } 3870 3871 public pure nothrow @safe void decode(bool readId=true)() { 3872 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3873 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 3874 count=varint.decode(_buffer, &_index); 3875 } 3876 3877 public static pure nothrow @safe SpawnExperienceOrb fromBuffer(bool readId=true)(ubyte[] buffer) { 3878 SpawnExperienceOrb ret = new SpawnExperienceOrb(); 3879 ret._buffer = buffer; 3880 ret.decode!readId(); 3881 return ret; 3882 } 3883 3884 public override string toString() { 3885 return "SpawnExperienceOrb(position: " ~ std.conv.to!string(this.position) ~ ", count: " ~ std.conv.to!string(this.count) ~ ")"; 3886 } 3887 3888 } 3889 3890 class ClientboundMapItemData : Buffer { 3891 3892 public enum ubyte ID = 66; 3893 3894 public enum bool CLIENTBOUND = true; 3895 public enum bool SERVERBOUND = false; 3896 3897 // update 3898 public enum uint TEXTURE = 2; 3899 public enum uint DECORATIONS = 4; 3900 public enum uint ENTITIES = 8; 3901 3902 public enum string[] FIELDS = ["mapId", "update", "scale", "size", "offset", "data", "decorations"]; 3903 3904 public long mapId; 3905 public uint update; 3906 public ubyte scale; 3907 public Tuple!(int, "x", int, "z") size; 3908 public Tuple!(int, "x", int, "z") offset; 3909 public ubyte[] data; 3910 public sul.protocol.pocket100.types.Decoration[] decorations; 3911 3912 public pure nothrow @safe @nogc this() {} 3913 3914 public pure nothrow @safe @nogc this(long mapId, uint update=uint.init, ubyte scale=ubyte.init, Tuple!(int, "x", int, "z") size=Tuple!(int, "x", int, "z").init, Tuple!(int, "x", int, "z") offset=Tuple!(int, "x", int, "z").init, ubyte[] data=(ubyte[]).init, sul.protocol.pocket100.types.Decoration[] decorations=(sul.protocol.pocket100.types.Decoration[]).init) { 3915 this.mapId = mapId; 3916 this.update = update; 3917 this.scale = scale; 3918 this.size = size; 3919 this.offset = offset; 3920 this.data = data; 3921 this.decorations = decorations; 3922 } 3923 3924 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3925 _buffer.length = 0; 3926 static if(writeId){ writeBigEndianUbyte(ID); } 3927 writeBytes(varlong.encode(mapId)); 3928 writeBytes(varuint.encode(update)); 3929 if(update==2||update==4){ writeBigEndianUbyte(scale); } 3930 if(update==2){ writeBytes(varint.encode(size.x)); writeBytes(varint.encode(size.z)); } 3931 if(update==2){ writeBytes(varint.encode(offset.x)); writeBytes(varint.encode(offset.z)); } 3932 if(update==2){ writeBytes(data); } 3933 if(update==4){ writeBytes(varuint.encode(cast(uint)decorations.length)); foreach(zvbjdlbm;decorations){ zvbjdlbm.encode(bufferInstance); } } 3934 return _buffer; 3935 } 3936 3937 public pure nothrow @safe void decode(bool readId=true)() { 3938 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3939 mapId=varlong.decode(_buffer, &_index); 3940 update=varuint.decode(_buffer, &_index); 3941 if(update==2||update==4){ scale=readBigEndianUbyte(); } 3942 if(update==2){ size.x=varint.decode(_buffer, &_index); size.z=varint.decode(_buffer, &_index); } 3943 if(update==2){ offset.x=varint.decode(_buffer, &_index); offset.z=varint.decode(_buffer, &_index); } 3944 if(update==2){ data=_buffer[_index..$].dup; _index=_buffer.length; } 3945 if(update==4){ decorations.length=varuint.decode(_buffer, &_index); foreach(ref zvbjdlbm;decorations){ zvbjdlbm.decode(bufferInstance); } } 3946 } 3947 3948 public static pure nothrow @safe ClientboundMapItemData fromBuffer(bool readId=true)(ubyte[] buffer) { 3949 ClientboundMapItemData ret = new ClientboundMapItemData(); 3950 ret._buffer = buffer; 3951 ret.decode!readId(); 3952 return ret; 3953 } 3954 3955 public override string toString() { 3956 return "ClientboundMapItemData(mapId: " ~ std.conv.to!string(this.mapId) ~ ", update: " ~ std.conv.to!string(this.update) ~ ", scale: " ~ std.conv.to!string(this.scale) ~ ", size: " ~ std.conv.to!string(this.size) ~ ", offset: " ~ std.conv.to!string(this.offset) ~ ", data: " ~ std.conv.to!string(this.data) ~ ", decorations: " ~ std.conv.to!string(this.decorations) ~ ")"; 3957 } 3958 3959 } 3960 3961 class MapInfoRequest : Buffer { 3962 3963 public enum ubyte ID = 67; 3964 3965 public enum bool CLIENTBOUND = false; 3966 public enum bool SERVERBOUND = true; 3967 3968 public enum string[] FIELDS = ["mapId"]; 3969 3970 public long mapId; 3971 3972 public pure nothrow @safe @nogc this() {} 3973 3974 public pure nothrow @safe @nogc this(long mapId) { 3975 this.mapId = mapId; 3976 } 3977 3978 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3979 _buffer.length = 0; 3980 static if(writeId){ writeBigEndianUbyte(ID); } 3981 writeBytes(varlong.encode(mapId)); 3982 return _buffer; 3983 } 3984 3985 public pure nothrow @safe void decode(bool readId=true)() { 3986 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 3987 mapId=varlong.decode(_buffer, &_index); 3988 } 3989 3990 public static pure nothrow @safe MapInfoRequest fromBuffer(bool readId=true)(ubyte[] buffer) { 3991 MapInfoRequest ret = new MapInfoRequest(); 3992 ret._buffer = buffer; 3993 ret.decode!readId(); 3994 return ret; 3995 } 3996 3997 public override string toString() { 3998 return "MapInfoRequest(mapId: " ~ std.conv.to!string(this.mapId) ~ ")"; 3999 } 4000 4001 } 4002 4003 class RequestChunkRadius : Buffer { 4004 4005 public enum ubyte ID = 68; 4006 4007 public enum bool CLIENTBOUND = false; 4008 public enum bool SERVERBOUND = true; 4009 4010 public enum string[] FIELDS = ["radius"]; 4011 4012 public int radius; 4013 4014 public pure nothrow @safe @nogc this() {} 4015 4016 public pure nothrow @safe @nogc this(int radius) { 4017 this.radius = radius; 4018 } 4019 4020 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4021 _buffer.length = 0; 4022 static if(writeId){ writeBigEndianUbyte(ID); } 4023 writeBytes(varint.encode(radius)); 4024 return _buffer; 4025 } 4026 4027 public pure nothrow @safe void decode(bool readId=true)() { 4028 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 4029 radius=varint.decode(_buffer, &_index); 4030 } 4031 4032 public static pure nothrow @safe RequestChunkRadius fromBuffer(bool readId=true)(ubyte[] buffer) { 4033 RequestChunkRadius ret = new RequestChunkRadius(); 4034 ret._buffer = buffer; 4035 ret.decode!readId(); 4036 return ret; 4037 } 4038 4039 public override string toString() { 4040 return "RequestChunkRadius(radius: " ~ std.conv.to!string(this.radius) ~ ")"; 4041 } 4042 4043 } 4044 4045 class ChunkRadiusUpdated : Buffer { 4046 4047 public enum ubyte ID = 69; 4048 4049 public enum bool CLIENTBOUND = true; 4050 public enum bool SERVERBOUND = false; 4051 4052 public enum string[] FIELDS = ["radius"]; 4053 4054 public int radius; 4055 4056 public pure nothrow @safe @nogc this() {} 4057 4058 public pure nothrow @safe @nogc this(int radius) { 4059 this.radius = radius; 4060 } 4061 4062 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4063 _buffer.length = 0; 4064 static if(writeId){ writeBigEndianUbyte(ID); } 4065 writeBytes(varint.encode(radius)); 4066 return _buffer; 4067 } 4068 4069 public pure nothrow @safe void decode(bool readId=true)() { 4070 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 4071 radius=varint.decode(_buffer, &_index); 4072 } 4073 4074 public static pure nothrow @safe ChunkRadiusUpdated fromBuffer(bool readId=true)(ubyte[] buffer) { 4075 ChunkRadiusUpdated ret = new ChunkRadiusUpdated(); 4076 ret._buffer = buffer; 4077 ret.decode!readId(); 4078 return ret; 4079 } 4080 4081 public override string toString() { 4082 return "ChunkRadiusUpdated(radius: " ~ std.conv.to!string(this.radius) ~ ")"; 4083 } 4084 4085 } 4086 4087 class ItemFrameDropItem : Buffer { 4088 4089 public enum ubyte ID = 70; 4090 4091 public enum bool CLIENTBOUND = true; 4092 public enum bool SERVERBOUND = false; 4093 4094 public enum string[] FIELDS = ["position", "item"]; 4095 4096 public sul.protocol.pocket100.types.BlockPosition position; 4097 public sul.protocol.pocket100.types.Slot item; 4098 4099 public pure nothrow @safe @nogc this() {} 4100 4101 public pure nothrow @safe @nogc this(sul.protocol.pocket100.types.BlockPosition position, sul.protocol.pocket100.types.Slot item=sul.protocol.pocket100.types.Slot.init) { 4102 this.position = position; 4103 this.item = item; 4104 } 4105 4106 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4107 _buffer.length = 0; 4108 static if(writeId){ writeBigEndianUbyte(ID); } 4109 position.encode(bufferInstance); 4110 item.encode(bufferInstance); 4111 return _buffer; 4112 } 4113 4114 public pure nothrow @safe void decode(bool readId=true)() { 4115 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 4116 position.decode(bufferInstance); 4117 item.decode(bufferInstance); 4118 } 4119 4120 public static pure nothrow @safe ItemFrameDropItem fromBuffer(bool readId=true)(ubyte[] buffer) { 4121 ItemFrameDropItem ret = new ItemFrameDropItem(); 4122 ret._buffer = buffer; 4123 ret.decode!readId(); 4124 return ret; 4125 } 4126 4127 public override string toString() { 4128 return "ItemFrameDropItem(position: " ~ std.conv.to!string(this.position) ~ ", item: " ~ std.conv.to!string(this.item) ~ ")"; 4129 } 4130 4131 } 4132 4133 class ReplaceSelectedItem : Buffer { 4134 4135 public enum ubyte ID = 71; 4136 4137 public enum bool CLIENTBOUND = false; 4138 public enum bool SERVERBOUND = true; 4139 4140 public enum string[] FIELDS = ["item"]; 4141 4142 public sul.protocol.pocket100.types.Slot item; 4143 4144 public pure nothrow @safe @nogc this() {} 4145 4146 public pure nothrow @safe @nogc this(sul.protocol.pocket100.types.Slot item) { 4147 this.item = item; 4148 } 4149 4150 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4151 _buffer.length = 0; 4152 static if(writeId){ writeBigEndianUbyte(ID); } 4153 item.encode(bufferInstance); 4154 return _buffer; 4155 } 4156 4157 public pure nothrow @safe void decode(bool readId=true)() { 4158 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 4159 item.decode(bufferInstance); 4160 } 4161 4162 public static pure nothrow @safe ReplaceSelectedItem fromBuffer(bool readId=true)(ubyte[] buffer) { 4163 ReplaceSelectedItem ret = new ReplaceSelectedItem(); 4164 ret._buffer = buffer; 4165 ret.decode!readId(); 4166 return ret; 4167 } 4168 4169 public override string toString() { 4170 return "ReplaceSelectedItem(item: " ~ std.conv.to!string(this.item) ~ ")"; 4171 } 4172 4173 } 4174 4175 class GameRulesChanged : Buffer { 4176 4177 public enum ubyte ID = 72; 4178 4179 public enum bool CLIENTBOUND = true; 4180 public enum bool SERVERBOUND = false; 4181 4182 public enum string[] FIELDS = ["rules"]; 4183 4184 public sul.protocol.pocket100.types.Rule[] rules; 4185 4186 public pure nothrow @safe @nogc this() {} 4187 4188 public pure nothrow @safe @nogc this(sul.protocol.pocket100.types.Rule[] rules) { 4189 this.rules = rules; 4190 } 4191 4192 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4193 _buffer.length = 0; 4194 static if(writeId){ writeBigEndianUbyte(ID); } 4195 writeBigEndianUint(cast(uint)rules.length); foreach(cvzm;rules){ cvzm.encode(bufferInstance); } 4196 return _buffer; 4197 } 4198 4199 public pure nothrow @safe void decode(bool readId=true)() { 4200 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 4201 rules.length=readBigEndianUint(); foreach(ref cvzm;rules){ cvzm.decode(bufferInstance); } 4202 } 4203 4204 public static pure nothrow @safe GameRulesChanged fromBuffer(bool readId=true)(ubyte[] buffer) { 4205 GameRulesChanged ret = new GameRulesChanged(); 4206 ret._buffer = buffer; 4207 ret.decode!readId(); 4208 return ret; 4209 } 4210 4211 public override string toString() { 4212 return "GameRulesChanged(rules: " ~ std.conv.to!string(this.rules) ~ ")"; 4213 } 4214 4215 } 4216 4217 class Camera : Buffer { 4218 4219 public enum ubyte ID = 73; 4220 4221 public enum bool CLIENTBOUND = true; 4222 public enum bool SERVERBOUND = false; 4223 4224 public enum string[] FIELDS = ["unknown0", "unknown1"]; 4225 4226 public long unknown0; 4227 public long unknown1; 4228 4229 public pure nothrow @safe @nogc this() {} 4230 4231 public pure nothrow @safe @nogc this(long unknown0, long unknown1=long.init) { 4232 this.unknown0 = unknown0; 4233 this.unknown1 = unknown1; 4234 } 4235 4236 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4237 _buffer.length = 0; 4238 static if(writeId){ writeBigEndianUbyte(ID); } 4239 writeBytes(varlong.encode(unknown0)); 4240 writeBytes(varlong.encode(unknown1)); 4241 return _buffer; 4242 } 4243 4244 public pure nothrow @safe void decode(bool readId=true)() { 4245 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 4246 unknown0=varlong.decode(_buffer, &_index); 4247 unknown1=varlong.decode(_buffer, &_index); 4248 } 4249 4250 public static pure nothrow @safe Camera fromBuffer(bool readId=true)(ubyte[] buffer) { 4251 Camera ret = new Camera(); 4252 ret._buffer = buffer; 4253 ret.decode!readId(); 4254 return ret; 4255 } 4256 4257 public override string toString() { 4258 return "Camera(unknown0: " ~ std.conv.to!string(this.unknown0) ~ ", unknown1: " ~ std.conv.to!string(this.unknown1) ~ ")"; 4259 } 4260 4261 } 4262 4263 class AddItem : Buffer { 4264 4265 public enum ubyte ID = 74; 4266 4267 public enum bool CLIENTBOUND = true; 4268 public enum bool SERVERBOUND = false; 4269 4270 public enum string[] FIELDS = ["item"]; 4271 4272 public sul.protocol.pocket100.types.Slot item; 4273 4274 public pure nothrow @safe @nogc this() {} 4275 4276 public pure nothrow @safe @nogc this(sul.protocol.pocket100.types.Slot item) { 4277 this.item = item; 4278 } 4279 4280 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4281 _buffer.length = 0; 4282 static if(writeId){ writeBigEndianUbyte(ID); } 4283 item.encode(bufferInstance); 4284 return _buffer; 4285 } 4286 4287 public pure nothrow @safe void decode(bool readId=true)() { 4288 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 4289 item.decode(bufferInstance); 4290 } 4291 4292 public static pure nothrow @safe AddItem fromBuffer(bool readId=true)(ubyte[] buffer) { 4293 AddItem ret = new AddItem(); 4294 ret._buffer = buffer; 4295 ret.decode!readId(); 4296 return ret; 4297 } 4298 4299 public override string toString() { 4300 return "AddItem(item: " ~ std.conv.to!string(this.item) ~ ")"; 4301 } 4302 4303 } 4304 4305 class BossEvent : Buffer { 4306 4307 public enum ubyte ID = 75; 4308 4309 public enum bool CLIENTBOUND = true; 4310 public enum bool SERVERBOUND = false; 4311 4312 // event id 4313 public enum uint ADD = 0; 4314 public enum uint UPDATE = 1; 4315 public enum uint REMOVE = 2; 4316 4317 public enum string[] FIELDS = ["entityId", "eventId"]; 4318 4319 public long entityId; 4320 public uint eventId; 4321 4322 public pure nothrow @safe @nogc this() {} 4323 4324 public pure nothrow @safe @nogc this(long entityId, uint eventId=uint.init) { 4325 this.entityId = entityId; 4326 this.eventId = eventId; 4327 } 4328 4329 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4330 _buffer.length = 0; 4331 static if(writeId){ writeBigEndianUbyte(ID); } 4332 writeBytes(varlong.encode(entityId)); 4333 writeBytes(varuint.encode(eventId)); 4334 return _buffer; 4335 } 4336 4337 public pure nothrow @safe void decode(bool readId=true)() { 4338 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 4339 entityId=varlong.decode(_buffer, &_index); 4340 eventId=varuint.decode(_buffer, &_index); 4341 } 4342 4343 public static pure nothrow @safe BossEvent fromBuffer(bool readId=true)(ubyte[] buffer) { 4344 BossEvent ret = new BossEvent(); 4345 ret._buffer = buffer; 4346 ret.decode!readId(); 4347 return ret; 4348 } 4349 4350 public override string toString() { 4351 return "BossEvent(entityId: " ~ std.conv.to!string(this.entityId) ~ ", eventId: " ~ std.conv.to!string(this.eventId) ~ ")"; 4352 } 4353 4354 } 4355 4356 class ShowCredits : Buffer { 4357 4358 public enum ubyte ID = 76; 4359 4360 public enum bool CLIENTBOUND = true; 4361 public enum bool SERVERBOUND = true; 4362 4363 // status 4364 public enum int START = 0; 4365 public enum int END = 1; 4366 4367 public enum string[] FIELDS = ["entityId", "status"]; 4368 4369 public long entityId; 4370 public int status; 4371 4372 public pure nothrow @safe @nogc this() {} 4373 4374 public pure nothrow @safe @nogc this(long entityId, int status=int.init) { 4375 this.entityId = entityId; 4376 this.status = status; 4377 } 4378 4379 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4380 _buffer.length = 0; 4381 static if(writeId){ writeBigEndianUbyte(ID); } 4382 writeBytes(varlong.encode(entityId)); 4383 writeBytes(varint.encode(status)); 4384 return _buffer; 4385 } 4386 4387 public pure nothrow @safe void decode(bool readId=true)() { 4388 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 4389 entityId=varlong.decode(_buffer, &_index); 4390 status=varint.decode(_buffer, &_index); 4391 } 4392 4393 public static pure nothrow @safe ShowCredits fromBuffer(bool readId=true)(ubyte[] buffer) { 4394 ShowCredits ret = new ShowCredits(); 4395 ret._buffer = buffer; 4396 ret.decode!readId(); 4397 return ret; 4398 } 4399 4400 public override string toString() { 4401 return "ShowCredits(entityId: " ~ std.conv.to!string(this.entityId) ~ ", status: " ~ std.conv.to!string(this.status) ~ ")"; 4402 } 4403 4404 } 4405 4406 class AvailableCommands : Buffer { 4407 4408 public enum ubyte ID = 77; 4409 4410 public enum bool CLIENTBOUND = true; 4411 public enum bool SERVERBOUND = false; 4412 4413 public enum string[] FIELDS = ["commands", "unknown1"]; 4414 4415 public string commands; 4416 public string unknown1; 4417 4418 public pure nothrow @safe @nogc this() {} 4419 4420 public pure nothrow @safe @nogc this(string commands, string unknown1=string.init) { 4421 this.commands = commands; 4422 this.unknown1 = unknown1; 4423 } 4424 4425 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4426 _buffer.length = 0; 4427 static if(writeId){ writeBigEndianUbyte(ID); } 4428 writeBytes(varuint.encode(cast(uint)commands.length)); writeString(commands); 4429 writeBytes(varuint.encode(cast(uint)unknown1.length)); writeString(unknown1); 4430 return _buffer; 4431 } 4432 4433 public pure nothrow @safe void decode(bool readId=true)() { 4434 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 4435 uint y9bfzm=varuint.decode(_buffer, &_index); commands=readString(y9bfzm); 4436 uint d5b9be=varuint.decode(_buffer, &_index); unknown1=readString(d5b9be); 4437 } 4438 4439 public static pure nothrow @safe AvailableCommands fromBuffer(bool readId=true)(ubyte[] buffer) { 4440 AvailableCommands ret = new AvailableCommands(); 4441 ret._buffer = buffer; 4442 ret.decode!readId(); 4443 return ret; 4444 } 4445 4446 public override string toString() { 4447 return "AvailableCommands(commands: " ~ std.conv.to!string(this.commands) ~ ", unknown1: " ~ std.conv.to!string(this.unknown1) ~ ")"; 4448 } 4449 4450 } 4451 4452 class CommandStep : Buffer { 4453 4454 public enum ubyte ID = 78; 4455 4456 public enum bool CLIENTBOUND = false; 4457 public enum bool SERVERBOUND = true; 4458 4459 public enum string[] FIELDS = ["command", "overload", "unknown2", "currentStep", "done", "clientId", "input", "output"]; 4460 4461 public string command; 4462 public string overload; 4463 public uint unknown2; 4464 public uint currentStep; 4465 public bool done; 4466 public ulong clientId; 4467 public string input; 4468 public string output; 4469 4470 public pure nothrow @safe @nogc this() {} 4471 4472 public pure nothrow @safe @nogc this(string command, string overload=string.init, uint unknown2=uint.init, uint currentStep=uint.init, bool done=bool.init, ulong clientId=ulong.init, string input=string.init, string output=string.init) { 4473 this.command = command; 4474 this.overload = overload; 4475 this.unknown2 = unknown2; 4476 this.currentStep = currentStep; 4477 this.done = done; 4478 this.clientId = clientId; 4479 this.input = input; 4480 this.output = output; 4481 } 4482 4483 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4484 _buffer.length = 0; 4485 static if(writeId){ writeBigEndianUbyte(ID); } 4486 writeBytes(varuint.encode(cast(uint)command.length)); writeString(command); 4487 writeBytes(varuint.encode(cast(uint)overload.length)); writeString(overload); 4488 writeBytes(varuint.encode(unknown2)); 4489 writeBytes(varuint.encode(currentStep)); 4490 writeBigEndianBool(done); 4491 writeBytes(varulong.encode(clientId)); 4492 writeBytes(varuint.encode(cast(uint)input.length)); writeString(input); 4493 writeBytes(varuint.encode(cast(uint)output.length)); writeString(output); 4494 return _buffer; 4495 } 4496 4497 public pure nothrow @safe void decode(bool readId=true)() { 4498 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 4499 uint y9bfz=varuint.decode(_buffer, &_index); command=readString(y9bfz); 4500 uint bzcxyq=varuint.decode(_buffer, &_index); overload=readString(bzcxyq); 4501 unknown2=varuint.decode(_buffer, &_index); 4502 currentStep=varuint.decode(_buffer, &_index); 4503 done=readBigEndianBool(); 4504 clientId=varulong.decode(_buffer, &_index); 4505 uint a5dq=varuint.decode(_buffer, &_index); input=readString(a5dq); 4506 uint bvcv=varuint.decode(_buffer, &_index); output=readString(bvcv); 4507 } 4508 4509 public static pure nothrow @safe CommandStep fromBuffer(bool readId=true)(ubyte[] buffer) { 4510 CommandStep ret = new CommandStep(); 4511 ret._buffer = buffer; 4512 ret.decode!readId(); 4513 return ret; 4514 } 4515 4516 public override string toString() { 4517 return "CommandStep(command: " ~ std.conv.to!string(this.command) ~ ", overload: " ~ std.conv.to!string(this.overload) ~ ", unknown2: " ~ std.conv.to!string(this.unknown2) ~ ", currentStep: " ~ std.conv.to!string(this.currentStep) ~ ", done: " ~ std.conv.to!string(this.done) ~ ", clientId: " ~ std.conv.to!string(this.clientId) ~ ", input: " ~ std.conv.to!string(this.input) ~ ", output: " ~ std.conv.to!string(this.output) ~ ")"; 4518 } 4519 4520 } 4521 4522 class ResourcePackDataInfo : Buffer { 4523 4524 public enum ubyte ID = 79; 4525 4526 public enum bool CLIENTBOUND = true; 4527 public enum bool SERVERBOUND = false; 4528 4529 public enum string[] FIELDS = ["id", "maxChunkSize", "chunkCount", "compressedPackSize", "sha256"]; 4530 4531 public string id; 4532 public uint maxChunkSize; 4533 public uint chunkCount; 4534 public ulong compressedPackSize; 4535 public string sha256; 4536 4537 public pure nothrow @safe @nogc this() {} 4538 4539 public pure nothrow @safe @nogc this(string id, uint maxChunkSize=uint.init, uint chunkCount=uint.init, ulong compressedPackSize=ulong.init, string sha256=string.init) { 4540 this.id = id; 4541 this.maxChunkSize = maxChunkSize; 4542 this.chunkCount = chunkCount; 4543 this.compressedPackSize = compressedPackSize; 4544 this.sha256 = sha256; 4545 } 4546 4547 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4548 _buffer.length = 0; 4549 static if(writeId){ writeBigEndianUbyte(ID); } 4550 writeBytes(varuint.encode(cast(uint)id.length)); writeString(id); 4551 writeLittleEndianUint(maxChunkSize); 4552 writeLittleEndianUint(chunkCount); 4553 writeLittleEndianUlong(compressedPackSize); 4554 writeBytes(varuint.encode(cast(uint)sha256.length)); writeString(sha256); 4555 return _buffer; 4556 } 4557 4558 public pure nothrow @safe void decode(bool readId=true)() { 4559 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 4560 uint aq=varuint.decode(_buffer, &_index); id=readString(aq); 4561 maxChunkSize=readLittleEndianUint(); 4562 chunkCount=readLittleEndianUint(); 4563 compressedPackSize=readLittleEndianUlong(); 4564 uint chmu=varuint.decode(_buffer, &_index); sha256=readString(chmu); 4565 } 4566 4567 public static pure nothrow @safe ResourcePackDataInfo fromBuffer(bool readId=true)(ubyte[] buffer) { 4568 ResourcePackDataInfo ret = new ResourcePackDataInfo(); 4569 ret._buffer = buffer; 4570 ret.decode!readId(); 4571 return ret; 4572 } 4573 4574 public override string toString() { 4575 return "ResourcePackDataInfo(id: " ~ std.conv.to!string(this.id) ~ ", maxChunkSize: " ~ std.conv.to!string(this.maxChunkSize) ~ ", chunkCount: " ~ std.conv.to!string(this.chunkCount) ~ ", compressedPackSize: " ~ std.conv.to!string(this.compressedPackSize) ~ ", sha256: " ~ std.conv.to!string(this.sha256) ~ ")"; 4576 } 4577 4578 } 4579 4580 class ResourcePackChunkData : Buffer { 4581 4582 public enum ubyte ID = 80; 4583 4584 public enum bool CLIENTBOUND = true; 4585 public enum bool SERVERBOUND = false; 4586 4587 public enum string[] FIELDS = ["id", "chunkIndex", "progress", "data"]; 4588 4589 public string id; 4590 public uint chunkIndex; 4591 public ulong progress; 4592 public ubyte[] data; 4593 4594 public pure nothrow @safe @nogc this() {} 4595 4596 public pure nothrow @safe @nogc this(string id, uint chunkIndex=uint.init, ulong progress=ulong.init, ubyte[] data=(ubyte[]).init) { 4597 this.id = id; 4598 this.chunkIndex = chunkIndex; 4599 this.progress = progress; 4600 this.data = data; 4601 } 4602 4603 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4604 _buffer.length = 0; 4605 static if(writeId){ writeBigEndianUbyte(ID); } 4606 writeBytes(varuint.encode(cast(uint)id.length)); writeString(id); 4607 writeLittleEndianUint(chunkIndex); 4608 writeLittleEndianUlong(progress); 4609 writeBytes(varuint.encode(cast(uint)data.length)); writeBytes(data); 4610 return _buffer; 4611 } 4612 4613 public pure nothrow @safe void decode(bool readId=true)() { 4614 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 4615 uint aq=varuint.decode(_buffer, &_index); id=readString(aq); 4616 chunkIndex=readLittleEndianUint(); 4617 progress=readLittleEndianUlong(); 4618 data.length=varuint.decode(_buffer, &_index); if(_buffer.length>=_index+data.length){ data=_buffer[_index.._index+data.length].dup; _index+=data.length; } 4619 } 4620 4621 public static pure nothrow @safe ResourcePackChunkData fromBuffer(bool readId=true)(ubyte[] buffer) { 4622 ResourcePackChunkData ret = new ResourcePackChunkData(); 4623 ret._buffer = buffer; 4624 ret.decode!readId(); 4625 return ret; 4626 } 4627 4628 public override string toString() { 4629 return "ResourcePackChunkData(id: " ~ std.conv.to!string(this.id) ~ ", chunkIndex: " ~ std.conv.to!string(this.chunkIndex) ~ ", progress: " ~ std.conv.to!string(this.progress) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")"; 4630 } 4631 4632 } 4633 4634 class ResourcePackChunkRequest : Buffer { 4635 4636 public enum ubyte ID = 81; 4637 4638 public enum bool CLIENTBOUND = false; 4639 public enum bool SERVERBOUND = true; 4640 4641 public enum string[] FIELDS = ["id", "chunkIndex"]; 4642 4643 public string id; 4644 public uint chunkIndex; 4645 4646 public pure nothrow @safe @nogc this() {} 4647 4648 public pure nothrow @safe @nogc this(string id, uint chunkIndex=uint.init) { 4649 this.id = id; 4650 this.chunkIndex = chunkIndex; 4651 } 4652 4653 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4654 _buffer.length = 0; 4655 static if(writeId){ writeBigEndianUbyte(ID); } 4656 writeBytes(varuint.encode(cast(uint)id.length)); writeString(id); 4657 writeLittleEndianUint(chunkIndex); 4658 return _buffer; 4659 } 4660 4661 public pure nothrow @safe void decode(bool readId=true)() { 4662 static if(readId){ ubyte _id; _id=readBigEndianUbyte(); } 4663 uint aq=varuint.decode(_buffer, &_index); id=readString(aq); 4664 chunkIndex=readLittleEndianUint(); 4665 } 4666 4667 public static pure nothrow @safe ResourcePackChunkRequest fromBuffer(bool readId=true)(ubyte[] buffer) { 4668 ResourcePackChunkRequest ret = new ResourcePackChunkRequest(); 4669 ret._buffer = buffer; 4670 ret.decode!readId(); 4671 return ret; 4672 } 4673 4674 public override string toString() { 4675 return "ResourcePackChunkRequest(id: " ~ std.conv.to!string(this.id) ~ ", chunkIndex: " ~ std.conv.to!string(this.chunkIndex) ~ ")"; 4676 } 4677 4678 } 4679