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