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