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/bedrock160.xml 8 */ 9 module sul.protocol.bedrock160.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.bedrock160.types; 22 23 static if(__traits(compiles, { import sul.metadata.bedrock160; })) import sul.metadata.bedrock160; 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 = 160; 37 public sul.protocol.bedrock160.types.LoginBody body_; 38 39 public pure nothrow @safe @nogc this() {} 40 41 public pure nothrow @safe @nogc this(uint protocol, sul.protocol.bedrock160.types.LoginBody body_=sul.protocol.bedrock160.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.bedrock160.types.PackWithSize[] behaviourPacks; 259 public sul.protocol.bedrock160.types.PackWithSize[] resourcePacks; 260 261 public pure nothrow @safe @nogc this() {} 262 263 public pure nothrow @safe @nogc this(bool mustAccept, sul.protocol.bedrock160.types.PackWithSize[] behaviourPacks=(sul.protocol.bedrock160.types.PackWithSize[]).init, sul.protocol.bedrock160.types.PackWithSize[] resourcePacks=(sul.protocol.bedrock160.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.bedrock160.types.Pack[] behaviourPacks; 309 public sul.protocol.bedrock160.types.Pack[] resourcePacks; 310 311 public pure nothrow @safe @nogc this() {} 312 313 public pure nothrow @safe @nogc this(bool mustAccept, sul.protocol.bedrock160.types.Pack[] behaviourPacks=(sul.protocol.bedrock160.types.Pack[]).init, sul.protocol.bedrock160.types.Pack[] resourcePacks=(sul.protocol.bedrock160.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.bedrock160.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.bedrock160.types.Rule[] gameRules=(sul.protocol.bedrock160.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.bedrock160.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.bedrock160.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.bedrock160.types.Link[] links; 1031 1032 public pure nothrow @safe @nogc this() {} 1033 1034 public pure nothrow @safe @nogc this(sul.protocol.bedrock160.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.bedrock160.types.Slot heldItem=sul.protocol.bedrock160.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.bedrock160.types.Link[] links=(sul.protocol.bedrock160.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.bedrock160.types.Attribute[] attributes; 1131 public Metadata metadata; 1132 public sul.protocol.bedrock160.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.bedrock160.types.Attribute[] attributes=(sul.protocol.bedrock160.types.Attribute[]).init, Metadata metadata=Metadata.init, sul.protocol.bedrock160.types.Link[] links=(sul.protocol.bedrock160.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.bedrock160.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.bedrock160.types.Slot item=sul.protocol.bedrock160.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.bedrock160.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.bedrock160.types.BlockPosition position=sul.protocol.bedrock160.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.bedrock160.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.bedrock160.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.bedrock160.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.bedrock160.types.BlockPosition position=sul.protocol.bedrock160.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.bedrock160.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.bedrock160.types.BlockPosition[] destroyedBlocks=(sul.protocol.bedrock160.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 ATTACK_STRONG = 42; 1803 public enum ubyte WARN = 43; 1804 public enum ubyte SHEAR = 44; 1805 public enum ubyte MILK = 45; 1806 public enum ubyte THUNDER = 46; 1807 public enum ubyte EXPLODE = 47; 1808 public enum ubyte FIRE = 48; 1809 public enum ubyte IGNITE = 49; 1810 public enum ubyte FUSE = 50; 1811 public enum ubyte STARE = 51; 1812 public enum ubyte SPAWN = 52; 1813 public enum ubyte SHOOT = 53; 1814 public enum ubyte BREAK_BLOCK = 54; 1815 public enum ubyte LAUNCH = 55; 1816 public enum ubyte BLAST = 56; 1817 public enum ubyte LARGE_BLAST = 57; 1818 public enum ubyte TWINKLE = 58; 1819 public enum ubyte REMEDY = 59; 1820 public enum ubyte UNFECT = 60; 1821 public enum ubyte LEVELUP = 61; 1822 public enum ubyte BOW_HIT = 62; 1823 public enum ubyte BULLET_HIT = 63; 1824 public enum ubyte EXTINGUISH_FIRE = 64; 1825 public enum ubyte ITEM_FIZZ = 65; 1826 public enum ubyte CHEST_OPEN = 66; 1827 public enum ubyte CHEST_CLOSED = 67; 1828 public enum ubyte SHULKER_BOX_OPEN = 68; 1829 public enum ubyte SHULKER_BOX_CLOSE = 69; 1830 public enum ubyte POWER_ON = 70; 1831 public enum ubyte POWER_OFF = 71; 1832 public enum ubyte ATTACH = 72; 1833 public enum ubyte DETACH = 73; 1834 public enum ubyte DENY = 74; 1835 public enum ubyte TRIPOD = 75; 1836 public enum ubyte POP = 76; 1837 public enum ubyte DROP_SLOT = 77; 1838 public enum ubyte NOTE = 78; 1839 public enum ubyte THORNS = 79; 1840 public enum ubyte PISTON_IN = 80; 1841 public enum ubyte PISTON_OUT = 81; 1842 public enum ubyte PORTAL = 82; 1843 public enum ubyte WATER = 83; 1844 public enum ubyte LAVA_POP = 84; 1845 public enum ubyte LAVA = 85; 1846 public enum ubyte BURP = 86; 1847 public enum ubyte BUCKET_FILL_WATER = 87; 1848 public enum ubyte BUCKET_FILL_LAVA = 88; 1849 public enum ubyte BUCKET_EMPTY_WATER = 89; 1850 public enum ubyte BUCKET_EMPTY_LAVA = 90; 1851 public enum ubyte RECORD_13 = 91; 1852 public enum ubyte RECORD_CAT = 92; 1853 public enum ubyte RECORD_BLOCKS = 93; 1854 public enum ubyte RECORD_CHIRP = 94; 1855 public enum ubyte RECORD_FAR = 95; 1856 public enum ubyte RECORD_MALL = 96; 1857 public enum ubyte RECORD_MELLOHI = 97; 1858 public enum ubyte RECORD_STAL = 98; 1859 public enum ubyte RECORD_STRAD = 99; 1860 public enum ubyte RECORD_WARD = 100; 1861 public enum ubyte RECORD_11 = 101; 1862 public enum ubyte RECORD_WAIT = 102; 1863 public enum ubyte GUARDIAN_FLOP = 104; 1864 public enum ubyte ELDERGUARDIAN_CURSE = 105; 1865 public enum ubyte MOB_WARNING = 106; 1866 public enum ubyte MOB_WARNING_BABY = 107; 1867 public enum ubyte TELEPORT = 108; 1868 public enum ubyte SHULKER_OPEN = 109; 1869 public enum ubyte SHULKER_CLOSE = 110; 1870 public enum ubyte HAGGLE = 111; 1871 public enum ubyte HAGGLE_YES = 112; 1872 public enum ubyte HAGGLE_NO = 113; 1873 public enum ubyte HAGGLE_IDLE = 114; 1874 public enum ubyte CHORUS_GROW = 115; 1875 public enum ubyte CHORUS_DEATH = 116; 1876 public enum ubyte GLASS = 117; 1877 public enum ubyte CAST_SPELL = 118; 1878 public enum ubyte PREPARE_ATTACK = 119; 1879 public enum ubyte PREPARE_SUMMON = 120; 1880 public enum ubyte PREPARE_WOLOLO = 121; 1881 public enum ubyte FANG = 122; 1882 public enum ubyte CHARGE = 123; 1883 public enum ubyte CAMERA_TAKE_PICTURE = 124; 1884 public enum ubyte LEASHKNOT_PLACE = 125; 1885 public enum ubyte LEASHKNOT_BREAK = 126; 1886 public enum ubyte GROWL = 127; 1887 public enum ubyte WHINE = 128; 1888 public enum ubyte PANT = 129; 1889 public enum ubyte PURR = 130; 1890 public enum ubyte PURREOW = 131; 1891 public enum ubyte DEATH_MIN_VOLUME = 132; 1892 public enum ubyte DEATH_MID_VOLUME = 133; 1893 public enum ubyte INITIATE_BLAZE = 134; 1894 public enum ubyte INITIATE_CAVE_SPIDER = 135; 1895 public enum ubyte INITIATE_CREEPER = 136; 1896 public enum ubyte INITIATE_ELDER_GUARDIAN = 137; 1897 public enum ubyte INITIATE_ENDER_DRAGON = 138; 1898 public enum ubyte INITIATE_ENDERMAN = 139; 1899 public enum ubyte INITIATE_EVOCATION_ILLAGER = 141; 1900 public enum ubyte INITIATE_GHAST = 142; 1901 public enum ubyte INITIATE_HUSK = 143; 1902 public enum ubyte INITIATE_ILLUSION_ILLAGER = 144; 1903 public enum ubyte INITIATE_MAGMA_CUBE = 145; 1904 public enum ubyte INITIATE_POLAR_BEAR = 146; 1905 public enum ubyte INITIATE_SHULKER = 147; 1906 public enum ubyte INITIATE_SILVERFISH = 148; 1907 public enum ubyte INITIATE_SKELETON = 149; 1908 public enum ubyte INITIATE_SLIME = 150; 1909 public enum ubyte INITIATE_SPIDER = 151; 1910 public enum ubyte INITIATE_STRAY = 152; 1911 public enum ubyte INITIATE_VEX = 153; 1912 public enum ubyte INITIATE_VINDICATION_ILLAGER = 154; 1913 public enum ubyte INITIATE_WITCH = 155; 1914 public enum ubyte INITIATE_WITHER = 156; 1915 public enum ubyte INITIATE_WITHER_SKELETON = 157; 1916 public enum ubyte INITIATE_WOLF = 158; 1917 public enum ubyte INITIATE_ZOMBIE = 159; 1918 public enum ubyte INITIATE_ZOMBIE_PIGMAN = 160; 1919 public enum ubyte INITIATE_ZOMBIE_VILLAGER = 161; 1920 public enum ubyte BLOCK_END_PORTAL_FRAME_FILL = 162; 1921 public enum ubyte BLOCK_END_PORTAL_SPAWN = 163; 1922 public enum ubyte RANDOM_ANVIL_USE = 164; 1923 public enum ubyte BOTTLE_DRAGONBREATH = 165; 1924 public enum ubyte DEFAULT = 166; 1925 public enum ubyte UNDEFINED = 167; 1926 1927 public enum string[] FIELDS = ["sound", "position", "volume", "pitch", "unknown4", "disableRelativeVolume"]; 1928 1929 public ubyte sound; 1930 public Tuple!(float, "x", float, "y", float, "z") position; 1931 public uint volume; 1932 public int pitch; 1933 public bool unknown4; 1934 public bool disableRelativeVolume; 1935 1936 public pure nothrow @safe @nogc this() {} 1937 1938 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) { 1939 this.sound = sound; 1940 this.position = position; 1941 this.volume = volume; 1942 this.pitch = pitch; 1943 this.unknown4 = unknown4; 1944 this.disableRelativeVolume = disableRelativeVolume; 1945 } 1946 1947 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 1948 _buffer.length = 0; 1949 static if(writeId){ writeBytes(varuint.encode(ID)); } 1950 writeLittleEndianUbyte(sound); 1951 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 1952 writeBytes(varuint.encode(volume)); 1953 writeBytes(varint.encode(pitch)); 1954 writeLittleEndianBool(unknown4); 1955 writeLittleEndianBool(disableRelativeVolume); 1956 return _buffer; 1957 } 1958 1959 public pure nothrow @safe void decode(bool readId=true)() { 1960 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 1961 sound=readLittleEndianUbyte(); 1962 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 1963 volume=varuint.decode(_buffer, &_index); 1964 pitch=varint.decode(_buffer, &_index); 1965 unknown4=readLittleEndianBool(); 1966 disableRelativeVolume=readLittleEndianBool(); 1967 } 1968 1969 public static pure nothrow @safe LevelSoundEvent fromBuffer(bool readId=true)(ubyte[] buffer) { 1970 LevelSoundEvent ret = new LevelSoundEvent(); 1971 ret._buffer = buffer; 1972 ret.decode!readId(); 1973 return ret; 1974 } 1975 1976 public override string toString() { 1977 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) ~ ")"; 1978 } 1979 1980 } 1981 1982 class LevelEvent : Buffer { 1983 1984 public enum uint ID = 25; 1985 1986 public enum bool CLIENTBOUND = true; 1987 public enum bool SERVERBOUND = false; 1988 1989 // event id 1990 public enum int START_RAIN = 3001; 1991 public enum int START_THUNDER = 3002; 1992 public enum int STOP_RAIN = 3003; 1993 public enum int STOP_THUNDER = 3004; 1994 public enum int START_BLOCK_BREAK = 3600; 1995 public enum int STOP_BLOCK_BREAK = 3601; 1996 public enum int SET_DATA = 4000; 1997 public enum int PLAYERS_SLEEPING = 9800; 1998 public enum int PARTICLE_BUBBLE = 16385; 1999 public enum int PARTICLE_CRITICAL = 16386; 2000 public enum int PARTICLE_BLOCK_FORCE_FIELD = 16387; 2001 public enum int PARTICLE_SMOKE = 16388; 2002 public enum int PARTICLE_EXPLODE = 16389; 2003 public enum int PARTICLE_EVAPORATION = 16390; 2004 public enum int PARTICLE_FLAME = 16391; 2005 public enum int PARTICLE_LAVA = 16392; 2006 public enum int PARTICLE_LARGE_SMOKE = 16393; 2007 public enum int PARTICLE_REDSTONE = 16394; 2008 public enum int PARTICLE_RISING_RED_DUST = 16395; 2009 public enum int PARTICLE_ITEM_BREAK = 16396; 2010 public enum int PARTICLE_SNOWBALL_POOF = 16397; 2011 public enum int PARTICLE_HUGE_EXPLODE = 16398; 2012 public enum int PARTICLE_HUGE_EXPLODE_SEED = 16399; 2013 public enum int PARTICLE_MOB_FLAME = 16400; 2014 public enum int PARTICLE_HEART = 16401; 2015 public enum int PARTICLE_TERRAIN = 16402; 2016 public enum int PARTICLE_TOWN_AURA = 16403; 2017 public enum int PARTICLE_PORTAL = 16404; 2018 public enum int PARTICLE_WATER_SPLASH = 16405; 2019 public enum int PARTICLE_WATER_WAKE = 16406; 2020 public enum int PARTICLE_DRIP_WATER = 16407; 2021 public enum int PARTICLE_DRIP_LAVA = 16408; 2022 public enum int PARTICLE_FALLING_DUST = 16409; 2023 public enum int PARTICLE_MOB_SPELL = 16410; 2024 public enum int PARTICLE_MOB_SPELL_AMBIENT = 16411; 2025 public enum int PARTICLE_MOB_SPELL_INSTANTANEOUS = 16412; 2026 public enum int PARTICLE_INK = 16413; 2027 public enum int PARTICLE_SLIME = 16414; 2028 public enum int PARTICLE_RAIN_SPLASH = 16415; 2029 public enum int PARTICLE_VILLAGER_ANGRY = 16416; 2030 public enum int PARTICLE_VILLAGER_HAPPY = 16417; 2031 public enum int PARTICLE_ENCHANTMENT_TABLE = 16418; 2032 public enum int PARTICLE_TRACKING_EMITTER = 16419; 2033 public enum int PARTICLE_NOTE = 16420; 2034 public enum int PARTICLE_WITCH_SPELL = 16421; 2035 public enum int PARTICLE_CARROT = 16422; 2036 public enum int PARTICLE_END_ROD = 16424; 2037 public enum int PARTICLE_DRAGON_BREATH = 16425; 2038 public enum int PARTICLE_SHOOT = 2000; 2039 public enum int PARTICLE_DESTROY = 2001; 2040 public enum int PARTICLE_SPLASH = 2002; 2041 public enum int PARTICLE_EYE_DESPAWN = 2003; 2042 public enum int PARTICLE_SPAWN = 2004; 2043 2044 public enum string[] FIELDS = ["eventId", "position", "data"]; 2045 2046 public int eventId; 2047 public Tuple!(float, "x", float, "y", float, "z") position; 2048 public int data; 2049 2050 public pure nothrow @safe @nogc this() {} 2051 2052 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) { 2053 this.eventId = eventId; 2054 this.position = position; 2055 this.data = data; 2056 } 2057 2058 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2059 _buffer.length = 0; 2060 static if(writeId){ writeBytes(varuint.encode(ID)); } 2061 writeBytes(varint.encode(eventId)); 2062 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 2063 writeBytes(varint.encode(data)); 2064 return _buffer; 2065 } 2066 2067 public pure nothrow @safe void decode(bool readId=true)() { 2068 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 2069 eventId=varint.decode(_buffer, &_index); 2070 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 2071 data=varint.decode(_buffer, &_index); 2072 } 2073 2074 public static pure nothrow @safe LevelEvent fromBuffer(bool readId=true)(ubyte[] buffer) { 2075 LevelEvent ret = new LevelEvent(); 2076 ret._buffer = buffer; 2077 ret.decode!readId(); 2078 return ret; 2079 } 2080 2081 public override string toString() { 2082 return "LevelEvent(eventId: " ~ std.conv.to!string(this.eventId) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")"; 2083 } 2084 2085 } 2086 2087 class BlockEvent : Buffer { 2088 2089 public enum uint ID = 26; 2090 2091 public enum bool CLIENTBOUND = true; 2092 public enum bool SERVERBOUND = false; 2093 2094 public enum string[] FIELDS = ["position", "data"]; 2095 2096 public sul.protocol.bedrock160.types.BlockPosition position; 2097 public int[2] data; 2098 2099 public pure nothrow @safe @nogc this() {} 2100 2101 public pure nothrow @safe @nogc this(sul.protocol.bedrock160.types.BlockPosition position, int[2] data=(int[2]).init) { 2102 this.position = position; 2103 this.data = data; 2104 } 2105 2106 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2107 _buffer.length = 0; 2108 static if(writeId){ writeBytes(varuint.encode(ID)); } 2109 position.encode(bufferInstance); 2110 foreach(zfy;data){ writeBytes(varint.encode(zfy)); } 2111 return _buffer; 2112 } 2113 2114 public pure nothrow @safe void decode(bool readId=true)() { 2115 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 2116 position.decode(bufferInstance); 2117 foreach(ref zfy;data){ zfy=varint.decode(_buffer, &_index); } 2118 } 2119 2120 public static pure nothrow @safe BlockEvent fromBuffer(bool readId=true)(ubyte[] buffer) { 2121 BlockEvent ret = new BlockEvent(); 2122 ret._buffer = buffer; 2123 ret.decode!readId(); 2124 return ret; 2125 } 2126 2127 public override string toString() { 2128 return "BlockEvent(position: " ~ std.conv.to!string(this.position) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")"; 2129 } 2130 2131 } 2132 2133 class EntityEvent : Buffer { 2134 2135 public enum uint ID = 27; 2136 2137 public enum bool CLIENTBOUND = true; 2138 public enum bool SERVERBOUND = true; 2139 2140 // event id 2141 public enum ubyte HURT_ANIMATION = 2; 2142 public enum ubyte DEATH_ANIMATION = 3; 2143 public enum ubyte ARM_SWING = 4; 2144 public enum ubyte TAME_FAIL = 6; 2145 public enum ubyte TAME_SUCCESS = 7; 2146 public enum ubyte SHAKE_WET = 8; 2147 public enum ubyte USE_ITEM = 9; 2148 public enum ubyte EAT_GRASS_ANIMATION = 10; 2149 public enum ubyte FISH_HOOK_BUBBLES = 11; 2150 public enum ubyte FISH_HOOK_POSITION = 12; 2151 public enum ubyte FISH_HOOK_HOOK = 13; 2152 public enum ubyte FISH_HOOK_TEASE = 14; 2153 public enum ubyte SQUID_INK_CLOUD = 15; 2154 public enum ubyte ZOMBIE_VILLAGER_CURE = 16; 2155 public enum ubyte RESPAWN = 18; 2156 public enum ubyte IRON_GOLEM_OFFER_FLOWER = 19; 2157 public enum ubyte IRON_GOLEM_WITHDRAW_FLOWER = 20; 2158 public enum ubyte LOVE_PARTICLES = 21; 2159 public enum ubyte WITCH_SPELL_ANIMATION = 24; 2160 public enum ubyte FIREWORK_PARTICLES = 25; 2161 public enum ubyte SILVERFISH_SPAWN_ANIMATION = 27; 2162 public enum ubyte WITCH_DRINK_POTION = 29; 2163 public enum ubyte WITCH_THROWN_POTION = 30; 2164 public enum ubyte MINECART_TNT_PRIME_FUSE = 31; 2165 public enum ubyte PLAYER_ADD_XP_LEVELS = 34; 2166 public enum ubyte ELDER_GUARDIAN_CURSE = 35; 2167 public enum ubyte AGENT_ARM_SWING = 36; 2168 public enum ubyte ENDER_DRAGON_DEATH = 37; 2169 public enum ubyte DUST_PARTICLES = 38; 2170 public enum ubyte EATING_ITEM = 57; 2171 public enum ubyte BABY_ANIMAL_FEED = 60; 2172 public enum ubyte DEATH_SMOKE_CLOUD = 61; 2173 public enum ubyte COMPLETE_TRADE = 62; 2174 public enum ubyte REMOVE_LEASH = 63; 2175 public enum ubyte CONSUME_TOTEM = 65; 2176 public enum ubyte ENTITY_SPAWN = 67; 2177 public enum ubyte DRAGON_PUKE = 68; 2178 public enum ubyte ITEM_ENTITY_MERGE = 69; 2179 2180 public enum string[] FIELDS = ["entityId", "eventId", "data"]; 2181 2182 public long entityId; 2183 public ubyte eventId; 2184 public int data; 2185 2186 public pure nothrow @safe @nogc this() {} 2187 2188 public pure nothrow @safe @nogc this(long entityId, ubyte eventId=ubyte.init, int data=int.init) { 2189 this.entityId = entityId; 2190 this.eventId = eventId; 2191 this.data = data; 2192 } 2193 2194 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2195 _buffer.length = 0; 2196 static if(writeId){ writeBytes(varuint.encode(ID)); } 2197 writeBytes(varlong.encode(entityId)); 2198 writeLittleEndianUbyte(eventId); 2199 writeBytes(varint.encode(data)); 2200 return _buffer; 2201 } 2202 2203 public pure nothrow @safe void decode(bool readId=true)() { 2204 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 2205 entityId=varlong.decode(_buffer, &_index); 2206 eventId=readLittleEndianUbyte(); 2207 data=varint.decode(_buffer, &_index); 2208 } 2209 2210 public static pure nothrow @safe EntityEvent fromBuffer(bool readId=true)(ubyte[] buffer) { 2211 EntityEvent ret = new EntityEvent(); 2212 ret._buffer = buffer; 2213 ret.decode!readId(); 2214 return ret; 2215 } 2216 2217 public override string toString() { 2218 return "EntityEvent(entityId: " ~ std.conv.to!string(this.entityId) ~ ", eventId: " ~ std.conv.to!string(this.eventId) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")"; 2219 } 2220 2221 } 2222 2223 class MobEffect : Buffer { 2224 2225 public enum uint ID = 28; 2226 2227 public enum bool CLIENTBOUND = true; 2228 public enum bool SERVERBOUND = false; 2229 2230 // event id 2231 public enum ubyte ADD = 1; 2232 public enum ubyte MODIFY = 2; 2233 public enum ubyte REMOVE = 3; 2234 2235 public enum string[] FIELDS = ["entityId", "eventId", "effect", "amplifier", "particles", "duration"]; 2236 2237 public long entityId; 2238 public ubyte eventId; 2239 public int effect; 2240 public int amplifier; 2241 public bool particles; 2242 public int duration; 2243 2244 public pure nothrow @safe @nogc this() {} 2245 2246 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) { 2247 this.entityId = entityId; 2248 this.eventId = eventId; 2249 this.effect = effect; 2250 this.amplifier = amplifier; 2251 this.particles = particles; 2252 this.duration = duration; 2253 } 2254 2255 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2256 _buffer.length = 0; 2257 static if(writeId){ writeBytes(varuint.encode(ID)); } 2258 writeBytes(varlong.encode(entityId)); 2259 writeLittleEndianUbyte(eventId); 2260 writeBytes(varint.encode(effect)); 2261 writeBytes(varint.encode(amplifier)); 2262 writeLittleEndianBool(particles); 2263 writeBytes(varint.encode(duration)); 2264 return _buffer; 2265 } 2266 2267 public pure nothrow @safe void decode(bool readId=true)() { 2268 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 2269 entityId=varlong.decode(_buffer, &_index); 2270 eventId=readLittleEndianUbyte(); 2271 effect=varint.decode(_buffer, &_index); 2272 amplifier=varint.decode(_buffer, &_index); 2273 particles=readLittleEndianBool(); 2274 duration=varint.decode(_buffer, &_index); 2275 } 2276 2277 public static pure nothrow @safe MobEffect fromBuffer(bool readId=true)(ubyte[] buffer) { 2278 MobEffect ret = new MobEffect(); 2279 ret._buffer = buffer; 2280 ret.decode!readId(); 2281 return ret; 2282 } 2283 2284 public override string toString() { 2285 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) ~ ")"; 2286 } 2287 2288 } 2289 2290 class UpdateAttributes : Buffer { 2291 2292 public enum uint ID = 29; 2293 2294 public enum bool CLIENTBOUND = true; 2295 public enum bool SERVERBOUND = false; 2296 2297 public enum string[] FIELDS = ["entityId", "attributes"]; 2298 2299 public long entityId; 2300 public sul.protocol.bedrock160.types.Attribute[] attributes; 2301 2302 public pure nothrow @safe @nogc this() {} 2303 2304 public pure nothrow @safe @nogc this(long entityId, sul.protocol.bedrock160.types.Attribute[] attributes=(sul.protocol.bedrock160.types.Attribute[]).init) { 2305 this.entityId = entityId; 2306 this.attributes = attributes; 2307 } 2308 2309 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2310 _buffer.length = 0; 2311 static if(writeId){ writeBytes(varuint.encode(ID)); } 2312 writeBytes(varlong.encode(entityId)); 2313 writeBytes(varuint.encode(cast(uint)attributes.length)); foreach(yrcldrc;attributes){ yrcldrc.encode(bufferInstance); } 2314 return _buffer; 2315 } 2316 2317 public pure nothrow @safe void decode(bool readId=true)() { 2318 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 2319 entityId=varlong.decode(_buffer, &_index); 2320 attributes.length=varuint.decode(_buffer, &_index); foreach(ref yrcldrc;attributes){ yrcldrc.decode(bufferInstance); } 2321 } 2322 2323 public static pure nothrow @safe UpdateAttributes fromBuffer(bool readId=true)(ubyte[] buffer) { 2324 UpdateAttributes ret = new UpdateAttributes(); 2325 ret._buffer = buffer; 2326 ret.decode!readId(); 2327 return ret; 2328 } 2329 2330 public override string toString() { 2331 return "UpdateAttributes(entityId: " ~ std.conv.to!string(this.entityId) ~ ", attributes: " ~ std.conv.to!string(this.attributes) ~ ")"; 2332 } 2333 2334 } 2335 2336 class InventoryTransaction : Buffer { 2337 2338 public enum uint ID = 30; 2339 2340 public enum bool CLIENTBOUND = false; 2341 public enum bool SERVERBOUND = true; 2342 2343 public enum string[] FIELDS = ["type", "actions"]; 2344 2345 public uint type; 2346 public sul.protocol.bedrock160.types.InventoryAction[] actions; 2347 2348 public pure nothrow @safe @nogc this() {} 2349 2350 public pure nothrow @safe @nogc this(uint type, sul.protocol.bedrock160.types.InventoryAction[] actions=(sul.protocol.bedrock160.types.InventoryAction[]).init) { 2351 this.type = type; 2352 this.actions = actions; 2353 } 2354 2355 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2356 _buffer.length = 0; 2357 static if(writeId){ writeBytes(varuint.encode(ID)); } 2358 writeBytes(varuint.encode(type)); 2359 writeBytes(varuint.encode(cast(uint)actions.length)); foreach(yna9c;actions){ yna9c.encode(bufferInstance); } 2360 return _buffer; 2361 } 2362 2363 public pure nothrow @safe void decode(bool readId=true)() { 2364 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 2365 type=varuint.decode(_buffer, &_index); 2366 actions.length=varuint.decode(_buffer, &_index); foreach(ref yna9c;actions){ yna9c.decode(bufferInstance); } 2367 } 2368 2369 public static pure nothrow @safe InventoryTransaction fromBuffer(bool readId=true)(ubyte[] buffer) { 2370 InventoryTransaction ret = new InventoryTransaction(); 2371 ret._buffer = buffer; 2372 ret.decode!readId(); 2373 return ret; 2374 } 2375 2376 public override string toString() { 2377 return "InventoryTransaction(type: " ~ std.conv.to!string(this.type) ~ ", actions: " ~ std.conv.to!string(this.actions) ~ ")"; 2378 } 2379 2380 alias _encode = encode; 2381 2382 enum string variantField = "type"; 2383 2384 alias Variants = TypeTuple!(Normal0, Normal1, UseItem, UseItemOnEntity, ReleaseItem); 2385 2386 public class Normal0 { 2387 2388 public enum typeof(type) TYPE = 0; 2389 2390 public enum string[] FIELDS = []; 2391 2392 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2393 type = 0; 2394 _encode!writeId(); 2395 return _buffer; 2396 } 2397 2398 public pure nothrow @safe void decode() { 2399 } 2400 2401 public override string toString() { 2402 return "InventoryTransaction.Normal0()"; 2403 } 2404 2405 } 2406 2407 public class Normal1 { 2408 2409 public enum typeof(type) TYPE = 1; 2410 2411 public enum string[] FIELDS = []; 2412 2413 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2414 type = 1; 2415 _encode!writeId(); 2416 return _buffer; 2417 } 2418 2419 public pure nothrow @safe void decode() { 2420 } 2421 2422 public override string toString() { 2423 return "InventoryTransaction.Normal1()"; 2424 } 2425 2426 } 2427 2428 public class UseItem { 2429 2430 public enum typeof(type) TYPE = 2; 2431 2432 // action type 2433 public enum uint CLICK_BLOCK = 0; 2434 public enum uint CLICK_AIR = 1; 2435 public enum uint BREAK_BLOCK = 2; 2436 2437 public enum string[] FIELDS = ["actionType", "blockPosition", "face", "hotbarSlot", "item", "playerPosition", "clickPosition"]; 2438 2439 public uint actionType; 2440 public sul.protocol.bedrock160.types.BlockPosition blockPosition; 2441 public int face; 2442 public int hotbarSlot; 2443 public sul.protocol.bedrock160.types.Slot item; 2444 public Tuple!(float, "x", float, "y", float, "z") playerPosition; 2445 public Tuple!(float, "x", float, "y", float, "z") clickPosition; 2446 2447 public pure nothrow @safe @nogc this() {} 2448 2449 public pure nothrow @safe @nogc this(uint actionType, sul.protocol.bedrock160.types.BlockPosition blockPosition=sul.protocol.bedrock160.types.BlockPosition.init, int face=int.init, int hotbarSlot=int.init, sul.protocol.bedrock160.types.Slot item=sul.protocol.bedrock160.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) { 2450 this.actionType = actionType; 2451 this.blockPosition = blockPosition; 2452 this.face = face; 2453 this.hotbarSlot = hotbarSlot; 2454 this.item = item; 2455 this.playerPosition = playerPosition; 2456 this.clickPosition = clickPosition; 2457 } 2458 2459 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2460 type = 2; 2461 _encode!writeId(); 2462 writeBytes(varuint.encode(actionType)); 2463 blockPosition.encode(bufferInstance); 2464 writeBytes(varint.encode(face)); 2465 writeBytes(varint.encode(hotbarSlot)); 2466 item.encode(bufferInstance); 2467 writeLittleEndianFloat(playerPosition.x); writeLittleEndianFloat(playerPosition.y); writeLittleEndianFloat(playerPosition.z); 2468 writeLittleEndianFloat(clickPosition.x); writeLittleEndianFloat(clickPosition.y); writeLittleEndianFloat(clickPosition.z); 2469 return _buffer; 2470 } 2471 2472 public pure nothrow @safe void decode() { 2473 actionType=varuint.decode(_buffer, &_index); 2474 blockPosition.decode(bufferInstance); 2475 face=varint.decode(_buffer, &_index); 2476 hotbarSlot=varint.decode(_buffer, &_index); 2477 item.decode(bufferInstance); 2478 playerPosition.x=readLittleEndianFloat(); playerPosition.y=readLittleEndianFloat(); playerPosition.z=readLittleEndianFloat(); 2479 clickPosition.x=readLittleEndianFloat(); clickPosition.y=readLittleEndianFloat(); clickPosition.z=readLittleEndianFloat(); 2480 } 2481 2482 public override string toString() { 2483 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) ~ ")"; 2484 } 2485 2486 } 2487 2488 public class UseItemOnEntity { 2489 2490 public enum typeof(type) TYPE = 3; 2491 2492 // action type 2493 public enum uint INTERACT = 0; 2494 public enum uint ATTACK = 1; 2495 2496 public enum string[] FIELDS = ["entityId", "actionType", "hotbarSlot", "item", "unknown4", "unknown5"]; 2497 2498 public long entityId; 2499 public uint actionType; 2500 public int hotbarSlot; 2501 public sul.protocol.bedrock160.types.Slot item; 2502 public Tuple!(float, "x", float, "y", float, "z") unknown4; 2503 public Tuple!(float, "x", float, "y", float, "z") unknown5; 2504 2505 public pure nothrow @safe @nogc this() {} 2506 2507 public pure nothrow @safe @nogc this(long entityId, uint actionType=uint.init, int hotbarSlot=int.init, sul.protocol.bedrock160.types.Slot item=sul.protocol.bedrock160.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) { 2508 this.entityId = entityId; 2509 this.actionType = actionType; 2510 this.hotbarSlot = hotbarSlot; 2511 this.item = item; 2512 this.unknown4 = unknown4; 2513 this.unknown5 = unknown5; 2514 } 2515 2516 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2517 type = 3; 2518 _encode!writeId(); 2519 writeBytes(varlong.encode(entityId)); 2520 writeBytes(varuint.encode(actionType)); 2521 writeBytes(varint.encode(hotbarSlot)); 2522 item.encode(bufferInstance); 2523 writeLittleEndianFloat(unknown4.x); writeLittleEndianFloat(unknown4.y); writeLittleEndianFloat(unknown4.z); 2524 writeLittleEndianFloat(unknown5.x); writeLittleEndianFloat(unknown5.y); writeLittleEndianFloat(unknown5.z); 2525 return _buffer; 2526 } 2527 2528 public pure nothrow @safe void decode() { 2529 entityId=varlong.decode(_buffer, &_index); 2530 actionType=varuint.decode(_buffer, &_index); 2531 hotbarSlot=varint.decode(_buffer, &_index); 2532 item.decode(bufferInstance); 2533 unknown4.x=readLittleEndianFloat(); unknown4.y=readLittleEndianFloat(); unknown4.z=readLittleEndianFloat(); 2534 unknown5.x=readLittleEndianFloat(); unknown5.y=readLittleEndianFloat(); unknown5.z=readLittleEndianFloat(); 2535 } 2536 2537 public override string toString() { 2538 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) ~ ")"; 2539 } 2540 2541 } 2542 2543 public class ReleaseItem { 2544 2545 public enum typeof(type) TYPE = 4; 2546 2547 // action type 2548 public enum uint SHOOT_BOW = 0; 2549 public enum uint CONSUME = 1; 2550 2551 public enum string[] FIELDS = ["actionType", "hotbarSlot", "item", "headPosition"]; 2552 2553 public uint actionType; 2554 public int hotbarSlot; 2555 public sul.protocol.bedrock160.types.Slot item; 2556 public Tuple!(float, "x", float, "y", float, "z") headPosition; 2557 2558 public pure nothrow @safe @nogc this() {} 2559 2560 public pure nothrow @safe @nogc this(uint actionType, int hotbarSlot=int.init, sul.protocol.bedrock160.types.Slot item=sul.protocol.bedrock160.types.Slot.init, Tuple!(float, "x", float, "y", float, "z") headPosition=Tuple!(float, "x", float, "y", float, "z").init) { 2561 this.actionType = actionType; 2562 this.hotbarSlot = hotbarSlot; 2563 this.item = item; 2564 this.headPosition = headPosition; 2565 } 2566 2567 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2568 type = 4; 2569 _encode!writeId(); 2570 writeBytes(varuint.encode(actionType)); 2571 writeBytes(varint.encode(hotbarSlot)); 2572 item.encode(bufferInstance); 2573 writeLittleEndianFloat(headPosition.x); writeLittleEndianFloat(headPosition.y); writeLittleEndianFloat(headPosition.z); 2574 return _buffer; 2575 } 2576 2577 public pure nothrow @safe void decode() { 2578 actionType=varuint.decode(_buffer, &_index); 2579 hotbarSlot=varint.decode(_buffer, &_index); 2580 item.decode(bufferInstance); 2581 headPosition.x=readLittleEndianFloat(); headPosition.y=readLittleEndianFloat(); headPosition.z=readLittleEndianFloat(); 2582 } 2583 2584 public override string toString() { 2585 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) ~ ")"; 2586 } 2587 2588 } 2589 2590 } 2591 2592 class MobEquipment : Buffer { 2593 2594 public enum uint ID = 31; 2595 2596 public enum bool CLIENTBOUND = true; 2597 public enum bool SERVERBOUND = true; 2598 2599 public enum string[] FIELDS = ["entityId", "item", "inventorySlot", "hotbarSlot", "unknown4"]; 2600 2601 public long entityId; 2602 public sul.protocol.bedrock160.types.Slot item; 2603 public ubyte inventorySlot; 2604 public ubyte hotbarSlot; 2605 public ubyte unknown4; 2606 2607 public pure nothrow @safe @nogc this() {} 2608 2609 public pure nothrow @safe @nogc this(long entityId, sul.protocol.bedrock160.types.Slot item=sul.protocol.bedrock160.types.Slot.init, ubyte inventorySlot=ubyte.init, ubyte hotbarSlot=ubyte.init, ubyte unknown4=ubyte.init) { 2610 this.entityId = entityId; 2611 this.item = item; 2612 this.inventorySlot = inventorySlot; 2613 this.hotbarSlot = hotbarSlot; 2614 this.unknown4 = unknown4; 2615 } 2616 2617 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2618 _buffer.length = 0; 2619 static if(writeId){ writeBytes(varuint.encode(ID)); } 2620 writeBytes(varlong.encode(entityId)); 2621 item.encode(bufferInstance); 2622 writeLittleEndianUbyte(inventorySlot); 2623 writeLittleEndianUbyte(hotbarSlot); 2624 writeLittleEndianUbyte(unknown4); 2625 return _buffer; 2626 } 2627 2628 public pure nothrow @safe void decode(bool readId=true)() { 2629 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 2630 entityId=varlong.decode(_buffer, &_index); 2631 item.decode(bufferInstance); 2632 inventorySlot=readLittleEndianUbyte(); 2633 hotbarSlot=readLittleEndianUbyte(); 2634 unknown4=readLittleEndianUbyte(); 2635 } 2636 2637 public static pure nothrow @safe MobEquipment fromBuffer(bool readId=true)(ubyte[] buffer) { 2638 MobEquipment ret = new MobEquipment(); 2639 ret._buffer = buffer; 2640 ret.decode!readId(); 2641 return ret; 2642 } 2643 2644 public override string toString() { 2645 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) ~ ")"; 2646 } 2647 2648 } 2649 2650 class MobArmorEquipment : Buffer { 2651 2652 public enum uint ID = 32; 2653 2654 public enum bool CLIENTBOUND = true; 2655 public enum bool SERVERBOUND = true; 2656 2657 public enum string[] FIELDS = ["entityId", "armor"]; 2658 2659 public long entityId; 2660 public sul.protocol.bedrock160.types.Slot[4] armor; 2661 2662 public pure nothrow @safe @nogc this() {} 2663 2664 public pure nothrow @safe @nogc this(long entityId, sul.protocol.bedrock160.types.Slot[4] armor=(sul.protocol.bedrock160.types.Slot[4]).init) { 2665 this.entityId = entityId; 2666 this.armor = armor; 2667 } 2668 2669 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2670 _buffer.length = 0; 2671 static if(writeId){ writeBytes(varuint.encode(ID)); } 2672 writeBytes(varlong.encode(entityId)); 2673 foreach(yjbi;armor){ yjbi.encode(bufferInstance); } 2674 return _buffer; 2675 } 2676 2677 public pure nothrow @safe void decode(bool readId=true)() { 2678 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 2679 entityId=varlong.decode(_buffer, &_index); 2680 foreach(ref yjbi;armor){ yjbi.decode(bufferInstance); } 2681 } 2682 2683 public static pure nothrow @safe MobArmorEquipment fromBuffer(bool readId=true)(ubyte[] buffer) { 2684 MobArmorEquipment ret = new MobArmorEquipment(); 2685 ret._buffer = buffer; 2686 ret.decode!readId(); 2687 return ret; 2688 } 2689 2690 public override string toString() { 2691 return "MobArmorEquipment(entityId: " ~ std.conv.to!string(this.entityId) ~ ", armor: " ~ std.conv.to!string(this.armor) ~ ")"; 2692 } 2693 2694 } 2695 2696 class Interact : Buffer { 2697 2698 public enum uint ID = 33; 2699 2700 public enum bool CLIENTBOUND = false; 2701 public enum bool SERVERBOUND = true; 2702 2703 // action 2704 public enum ubyte LEAVE_VEHICLE = 3; 2705 public enum ubyte HOVER = 4; 2706 public enum ubyte OPEN_INVENTORY = 6; 2707 2708 public enum string[] FIELDS = ["action", "target", "targetPosition"]; 2709 2710 public ubyte action; 2711 public long target; 2712 public Tuple!(float, "x", float, "y", float, "z") targetPosition; 2713 2714 public pure nothrow @safe @nogc this() {} 2715 2716 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) { 2717 this.action = action; 2718 this.target = target; 2719 this.targetPosition = targetPosition; 2720 } 2721 2722 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2723 _buffer.length = 0; 2724 static if(writeId){ writeBytes(varuint.encode(ID)); } 2725 writeLittleEndianUbyte(action); 2726 writeBytes(varlong.encode(target)); 2727 if(action==4){ writeLittleEndianFloat(targetPosition.x); writeLittleEndianFloat(targetPosition.y); writeLittleEndianFloat(targetPosition.z); } 2728 return _buffer; 2729 } 2730 2731 public pure nothrow @safe void decode(bool readId=true)() { 2732 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 2733 action=readLittleEndianUbyte(); 2734 target=varlong.decode(_buffer, &_index); 2735 if(action==4){ targetPosition.x=readLittleEndianFloat(); targetPosition.y=readLittleEndianFloat(); targetPosition.z=readLittleEndianFloat(); } 2736 } 2737 2738 public static pure nothrow @safe Interact fromBuffer(bool readId=true)(ubyte[] buffer) { 2739 Interact ret = new Interact(); 2740 ret._buffer = buffer; 2741 ret.decode!readId(); 2742 return ret; 2743 } 2744 2745 public override string toString() { 2746 return "Interact(action: " ~ std.conv.to!string(this.action) ~ ", target: " ~ std.conv.to!string(this.target) ~ ", targetPosition: " ~ std.conv.to!string(this.targetPosition) ~ ")"; 2747 } 2748 2749 } 2750 2751 class BlockPickRequest : Buffer { 2752 2753 public enum uint ID = 34; 2754 2755 public enum bool CLIENTBOUND = false; 2756 public enum bool SERVERBOUND = true; 2757 2758 public enum string[] FIELDS = ["position", "unknown1", "slot"]; 2759 2760 public Tuple!(int, "x", int, "y", int, "z") position; 2761 public bool unknown1; 2762 public ubyte slot; 2763 2764 public pure nothrow @safe @nogc this() {} 2765 2766 public pure nothrow @safe @nogc this(Tuple!(int, "x", int, "y", int, "z") position, bool unknown1=bool.init, ubyte slot=ubyte.init) { 2767 this.position = position; 2768 this.unknown1 = unknown1; 2769 this.slot = slot; 2770 } 2771 2772 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2773 _buffer.length = 0; 2774 static if(writeId){ writeBytes(varuint.encode(ID)); } 2775 writeBytes(varint.encode(position.x)); writeBytes(varint.encode(position.y)); writeBytes(varint.encode(position.z)); 2776 writeLittleEndianBool(unknown1); 2777 writeLittleEndianUbyte(slot); 2778 return _buffer; 2779 } 2780 2781 public pure nothrow @safe void decode(bool readId=true)() { 2782 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 2783 position.x=varint.decode(_buffer, &_index); position.y=varint.decode(_buffer, &_index); position.z=varint.decode(_buffer, &_index); 2784 unknown1=readLittleEndianBool(); 2785 slot=readLittleEndianUbyte(); 2786 } 2787 2788 public static pure nothrow @safe BlockPickRequest fromBuffer(bool readId=true)(ubyte[] buffer) { 2789 BlockPickRequest ret = new BlockPickRequest(); 2790 ret._buffer = buffer; 2791 ret.decode!readId(); 2792 return ret; 2793 } 2794 2795 public override string toString() { 2796 return "BlockPickRequest(position: " ~ std.conv.to!string(this.position) ~ ", unknown1: " ~ std.conv.to!string(this.unknown1) ~ ", slot: " ~ std.conv.to!string(this.slot) ~ ")"; 2797 } 2798 2799 } 2800 2801 class EntityPickRequest : Buffer { 2802 2803 public enum uint ID = 35; 2804 2805 public enum bool CLIENTBOUND = false; 2806 public enum bool SERVERBOUND = true; 2807 2808 public enum string[] FIELDS = ["entityType", "slot"]; 2809 2810 public long entityType; 2811 public ubyte slot; 2812 2813 public pure nothrow @safe @nogc this() {} 2814 2815 public pure nothrow @safe @nogc this(long entityType, ubyte slot=ubyte.init) { 2816 this.entityType = entityType; 2817 this.slot = slot; 2818 } 2819 2820 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2821 _buffer.length = 0; 2822 static if(writeId){ writeBytes(varuint.encode(ID)); } 2823 writeLittleEndianLong(entityType); 2824 writeLittleEndianUbyte(slot); 2825 return _buffer; 2826 } 2827 2828 public pure nothrow @safe void decode(bool readId=true)() { 2829 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 2830 entityType=readLittleEndianLong(); 2831 slot=readLittleEndianUbyte(); 2832 } 2833 2834 public static pure nothrow @safe EntityPickRequest fromBuffer(bool readId=true)(ubyte[] buffer) { 2835 EntityPickRequest ret = new EntityPickRequest(); 2836 ret._buffer = buffer; 2837 ret.decode!readId(); 2838 return ret; 2839 } 2840 2841 public override string toString() { 2842 return "EntityPickRequest(entityType: " ~ std.conv.to!string(this.entityType) ~ ", slot: " ~ std.conv.to!string(this.slot) ~ ")"; 2843 } 2844 2845 } 2846 2847 class PlayerAction : Buffer { 2848 2849 public enum uint ID = 36; 2850 2851 public enum bool CLIENTBOUND = false; 2852 public enum bool SERVERBOUND = true; 2853 2854 // action 2855 public enum int START_BREAK = 0; 2856 public enum int ABORT_BREAK = 1; 2857 public enum int STOP_BREAK = 2; 2858 public enum int GET_UPDATED_BLOCK = 3; 2859 public enum int DROP_ITEM = 4; 2860 public enum int START_SLEEPING = 5; 2861 public enum int STOP_SLEEPING = 6; 2862 public enum int RESPAWN = 7; 2863 public enum int JUMP = 8; 2864 public enum int START_SPRINT = 9; 2865 public enum int STOP_SPRINT = 10; 2866 public enum int START_SNEAK = 11; 2867 public enum int STOP_SNEAK = 12; 2868 public enum int START_GLIDING = 15; 2869 public enum int STOP_GLIDING = 16; 2870 public enum int BUILD_DENIED = 17; 2871 public enum int CONTINUE_BREAK = 18; 2872 public enum int CHANGE_SKIN = 19; 2873 2874 public enum string[] FIELDS = ["entityId", "action", "position", "face"]; 2875 2876 public long entityId; 2877 public int action; 2878 public sul.protocol.bedrock160.types.BlockPosition position; 2879 public int face; 2880 2881 public pure nothrow @safe @nogc this() {} 2882 2883 public pure nothrow @safe @nogc this(long entityId, int action=int.init, sul.protocol.bedrock160.types.BlockPosition position=sul.protocol.bedrock160.types.BlockPosition.init, int face=int.init) { 2884 this.entityId = entityId; 2885 this.action = action; 2886 this.position = position; 2887 this.face = face; 2888 } 2889 2890 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2891 _buffer.length = 0; 2892 static if(writeId){ writeBytes(varuint.encode(ID)); } 2893 writeBytes(varlong.encode(entityId)); 2894 writeBytes(varint.encode(action)); 2895 position.encode(bufferInstance); 2896 writeBytes(varint.encode(face)); 2897 return _buffer; 2898 } 2899 2900 public pure nothrow @safe void decode(bool readId=true)() { 2901 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 2902 entityId=varlong.decode(_buffer, &_index); 2903 action=varint.decode(_buffer, &_index); 2904 position.decode(bufferInstance); 2905 face=varint.decode(_buffer, &_index); 2906 } 2907 2908 public static pure nothrow @safe PlayerAction fromBuffer(bool readId=true)(ubyte[] buffer) { 2909 PlayerAction ret = new PlayerAction(); 2910 ret._buffer = buffer; 2911 ret.decode!readId(); 2912 return ret; 2913 } 2914 2915 public override string toString() { 2916 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) ~ ")"; 2917 } 2918 2919 } 2920 2921 class EntityFall : Buffer { 2922 2923 public enum uint ID = 37; 2924 2925 public enum bool CLIENTBOUND = false; 2926 public enum bool SERVERBOUND = true; 2927 2928 public enum string[] FIELDS = ["entityId", "distance", "unknown2"]; 2929 2930 public long entityId; 2931 public float distance; 2932 public bool unknown2; 2933 2934 public pure nothrow @safe @nogc this() {} 2935 2936 public pure nothrow @safe @nogc this(long entityId, float distance=float.init, bool unknown2=bool.init) { 2937 this.entityId = entityId; 2938 this.distance = distance; 2939 this.unknown2 = unknown2; 2940 } 2941 2942 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2943 _buffer.length = 0; 2944 static if(writeId){ writeBytes(varuint.encode(ID)); } 2945 writeBytes(varlong.encode(entityId)); 2946 writeLittleEndianFloat(distance); 2947 writeLittleEndianBool(unknown2); 2948 return _buffer; 2949 } 2950 2951 public pure nothrow @safe void decode(bool readId=true)() { 2952 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 2953 entityId=varlong.decode(_buffer, &_index); 2954 distance=readLittleEndianFloat(); 2955 unknown2=readLittleEndianBool(); 2956 } 2957 2958 public static pure nothrow @safe EntityFall fromBuffer(bool readId=true)(ubyte[] buffer) { 2959 EntityFall ret = new EntityFall(); 2960 ret._buffer = buffer; 2961 ret.decode!readId(); 2962 return ret; 2963 } 2964 2965 public override string toString() { 2966 return "EntityFall(entityId: " ~ std.conv.to!string(this.entityId) ~ ", distance: " ~ std.conv.to!string(this.distance) ~ ", unknown2: " ~ std.conv.to!string(this.unknown2) ~ ")"; 2967 } 2968 2969 } 2970 2971 class HurtArmor : Buffer { 2972 2973 public enum uint ID = 38; 2974 2975 public enum bool CLIENTBOUND = true; 2976 public enum bool SERVERBOUND = false; 2977 2978 public enum string[] FIELDS = ["unknown0"]; 2979 2980 public int unknown0; 2981 2982 public pure nothrow @safe @nogc this() {} 2983 2984 public pure nothrow @safe @nogc this(int unknown0) { 2985 this.unknown0 = unknown0; 2986 } 2987 2988 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 2989 _buffer.length = 0; 2990 static if(writeId){ writeBytes(varuint.encode(ID)); } 2991 writeBytes(varint.encode(unknown0)); 2992 return _buffer; 2993 } 2994 2995 public pure nothrow @safe void decode(bool readId=true)() { 2996 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 2997 unknown0=varint.decode(_buffer, &_index); 2998 } 2999 3000 public static pure nothrow @safe HurtArmor fromBuffer(bool readId=true)(ubyte[] buffer) { 3001 HurtArmor ret = new HurtArmor(); 3002 ret._buffer = buffer; 3003 ret.decode!readId(); 3004 return ret; 3005 } 3006 3007 public override string toString() { 3008 return "HurtArmor(unknown0: " ~ std.conv.to!string(this.unknown0) ~ ")"; 3009 } 3010 3011 } 3012 3013 class SetEntityData : Buffer { 3014 3015 public enum uint ID = 39; 3016 3017 public enum bool CLIENTBOUND = true; 3018 public enum bool SERVERBOUND = false; 3019 3020 public enum string[] FIELDS = ["entityId", "metadata"]; 3021 3022 public long entityId; 3023 public Metadata metadata; 3024 3025 public pure nothrow @safe @nogc this() {} 3026 3027 public pure nothrow @safe @nogc this(long entityId, Metadata metadata=Metadata.init) { 3028 this.entityId = entityId; 3029 this.metadata = metadata; 3030 } 3031 3032 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3033 _buffer.length = 0; 3034 static if(writeId){ writeBytes(varuint.encode(ID)); } 3035 writeBytes(varlong.encode(entityId)); 3036 metadata.encode(bufferInstance); 3037 return _buffer; 3038 } 3039 3040 public pure nothrow @safe void decode(bool readId=true)() { 3041 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3042 entityId=varlong.decode(_buffer, &_index); 3043 metadata=Metadata.decode(bufferInstance); 3044 } 3045 3046 public static pure nothrow @safe SetEntityData fromBuffer(bool readId=true)(ubyte[] buffer) { 3047 SetEntityData ret = new SetEntityData(); 3048 ret._buffer = buffer; 3049 ret.decode!readId(); 3050 return ret; 3051 } 3052 3053 public override string toString() { 3054 return "SetEntityData(entityId: " ~ std.conv.to!string(this.entityId) ~ ", metadata: " ~ std.conv.to!string(this.metadata) ~ ")"; 3055 } 3056 3057 } 3058 3059 class SetEntityMotion : Buffer { 3060 3061 public enum uint ID = 40; 3062 3063 public enum bool CLIENTBOUND = true; 3064 public enum bool SERVERBOUND = false; 3065 3066 public enum string[] FIELDS = ["entityId", "motion"]; 3067 3068 public long entityId; 3069 public Tuple!(float, "x", float, "y", float, "z") motion; 3070 3071 public pure nothrow @safe @nogc this() {} 3072 3073 public pure nothrow @safe @nogc this(long entityId, Tuple!(float, "x", float, "y", float, "z") motion=Tuple!(float, "x", float, "y", float, "z").init) { 3074 this.entityId = entityId; 3075 this.motion = motion; 3076 } 3077 3078 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3079 _buffer.length = 0; 3080 static if(writeId){ writeBytes(varuint.encode(ID)); } 3081 writeBytes(varlong.encode(entityId)); 3082 writeLittleEndianFloat(motion.x); writeLittleEndianFloat(motion.y); writeLittleEndianFloat(motion.z); 3083 return _buffer; 3084 } 3085 3086 public pure nothrow @safe void decode(bool readId=true)() { 3087 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3088 entityId=varlong.decode(_buffer, &_index); 3089 motion.x=readLittleEndianFloat(); motion.y=readLittleEndianFloat(); motion.z=readLittleEndianFloat(); 3090 } 3091 3092 public static pure nothrow @safe SetEntityMotion fromBuffer(bool readId=true)(ubyte[] buffer) { 3093 SetEntityMotion ret = new SetEntityMotion(); 3094 ret._buffer = buffer; 3095 ret.decode!readId(); 3096 return ret; 3097 } 3098 3099 public override string toString() { 3100 return "SetEntityMotion(entityId: " ~ std.conv.to!string(this.entityId) ~ ", motion: " ~ std.conv.to!string(this.motion) ~ ")"; 3101 } 3102 3103 } 3104 3105 class SetEntityLink : Buffer { 3106 3107 public enum uint ID = 41; 3108 3109 public enum bool CLIENTBOUND = true; 3110 public enum bool SERVERBOUND = false; 3111 3112 // action 3113 public enum ubyte REMOVE = 0; 3114 public enum ubyte ADD = 1; 3115 3116 public enum string[] FIELDS = ["vehicle", "passenger", "action"]; 3117 3118 public long vehicle; 3119 public long passenger; 3120 public ubyte action; 3121 3122 public pure nothrow @safe @nogc this() {} 3123 3124 public pure nothrow @safe @nogc this(long vehicle, long passenger=long.init, ubyte action=ubyte.init) { 3125 this.vehicle = vehicle; 3126 this.passenger = passenger; 3127 this.action = action; 3128 } 3129 3130 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3131 _buffer.length = 0; 3132 static if(writeId){ writeBytes(varuint.encode(ID)); } 3133 writeBytes(varlong.encode(vehicle)); 3134 writeBytes(varlong.encode(passenger)); 3135 writeLittleEndianUbyte(action); 3136 return _buffer; 3137 } 3138 3139 public pure nothrow @safe void decode(bool readId=true)() { 3140 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3141 vehicle=varlong.decode(_buffer, &_index); 3142 passenger=varlong.decode(_buffer, &_index); 3143 action=readLittleEndianUbyte(); 3144 } 3145 3146 public static pure nothrow @safe SetEntityLink fromBuffer(bool readId=true)(ubyte[] buffer) { 3147 SetEntityLink ret = new SetEntityLink(); 3148 ret._buffer = buffer; 3149 ret.decode!readId(); 3150 return ret; 3151 } 3152 3153 public override string toString() { 3154 return "SetEntityLink(vehicle: " ~ std.conv.to!string(this.vehicle) ~ ", passenger: " ~ std.conv.to!string(this.passenger) ~ ", action: " ~ std.conv.to!string(this.action) ~ ")"; 3155 } 3156 3157 } 3158 3159 class SetHealth : Buffer { 3160 3161 public enum uint ID = 42; 3162 3163 public enum bool CLIENTBOUND = true; 3164 public enum bool SERVERBOUND = false; 3165 3166 public enum string[] FIELDS = ["health"]; 3167 3168 public int health; 3169 3170 public pure nothrow @safe @nogc this() {} 3171 3172 public pure nothrow @safe @nogc this(int health) { 3173 this.health = health; 3174 } 3175 3176 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3177 _buffer.length = 0; 3178 static if(writeId){ writeBytes(varuint.encode(ID)); } 3179 writeBytes(varint.encode(health)); 3180 return _buffer; 3181 } 3182 3183 public pure nothrow @safe void decode(bool readId=true)() { 3184 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3185 health=varint.decode(_buffer, &_index); 3186 } 3187 3188 public static pure nothrow @safe SetHealth fromBuffer(bool readId=true)(ubyte[] buffer) { 3189 SetHealth ret = new SetHealth(); 3190 ret._buffer = buffer; 3191 ret.decode!readId(); 3192 return ret; 3193 } 3194 3195 public override string toString() { 3196 return "SetHealth(health: " ~ std.conv.to!string(this.health) ~ ")"; 3197 } 3198 3199 } 3200 3201 class SetSpawnPosition : Buffer { 3202 3203 public enum uint ID = 43; 3204 3205 public enum bool CLIENTBOUND = true; 3206 public enum bool SERVERBOUND = false; 3207 3208 // type 3209 public enum int PLAYER_SPAWN = 0; 3210 public enum int WORLD_SPAWN = 1; 3211 3212 public enum string[] FIELDS = ["type", "position", "forced"]; 3213 3214 public int type; 3215 public sul.protocol.bedrock160.types.BlockPosition position; 3216 public bool forced; 3217 3218 public pure nothrow @safe @nogc this() {} 3219 3220 public pure nothrow @safe @nogc this(int type, sul.protocol.bedrock160.types.BlockPosition position=sul.protocol.bedrock160.types.BlockPosition.init, bool forced=bool.init) { 3221 this.type = type; 3222 this.position = position; 3223 this.forced = forced; 3224 } 3225 3226 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3227 _buffer.length = 0; 3228 static if(writeId){ writeBytes(varuint.encode(ID)); } 3229 writeBytes(varint.encode(type)); 3230 position.encode(bufferInstance); 3231 writeLittleEndianBool(forced); 3232 return _buffer; 3233 } 3234 3235 public pure nothrow @safe void decode(bool readId=true)() { 3236 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3237 type=varint.decode(_buffer, &_index); 3238 position.decode(bufferInstance); 3239 forced=readLittleEndianBool(); 3240 } 3241 3242 public static pure nothrow @safe SetSpawnPosition fromBuffer(bool readId=true)(ubyte[] buffer) { 3243 SetSpawnPosition ret = new SetSpawnPosition(); 3244 ret._buffer = buffer; 3245 ret.decode!readId(); 3246 return ret; 3247 } 3248 3249 public override string toString() { 3250 return "SetSpawnPosition(type: " ~ std.conv.to!string(this.type) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", forced: " ~ std.conv.to!string(this.forced) ~ ")"; 3251 } 3252 3253 } 3254 3255 class Animate : Buffer { 3256 3257 public enum uint ID = 44; 3258 3259 public enum bool CLIENTBOUND = true; 3260 public enum bool SERVERBOUND = true; 3261 3262 // action 3263 public enum int BREAKING = 1; 3264 public enum int WAKE_UP = 3; 3265 3266 public enum string[] FIELDS = ["action", "entityId", "unknown2"]; 3267 3268 public int action; 3269 public long entityId; 3270 public float unknown2; 3271 3272 public pure nothrow @safe @nogc this() {} 3273 3274 public pure nothrow @safe @nogc this(int action, long entityId=long.init, float unknown2=float.init) { 3275 this.action = action; 3276 this.entityId = entityId; 3277 this.unknown2 = unknown2; 3278 } 3279 3280 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3281 _buffer.length = 0; 3282 static if(writeId){ writeBytes(varuint.encode(ID)); } 3283 writeBytes(varint.encode(action)); 3284 writeBytes(varlong.encode(entityId)); 3285 if(action>128){ writeLittleEndianFloat(unknown2); } 3286 return _buffer; 3287 } 3288 3289 public pure nothrow @safe void decode(bool readId=true)() { 3290 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3291 action=varint.decode(_buffer, &_index); 3292 entityId=varlong.decode(_buffer, &_index); 3293 if(action>128){ unknown2=readLittleEndianFloat(); } 3294 } 3295 3296 public static pure nothrow @safe Animate fromBuffer(bool readId=true)(ubyte[] buffer) { 3297 Animate ret = new Animate(); 3298 ret._buffer = buffer; 3299 ret.decode!readId(); 3300 return ret; 3301 } 3302 3303 public override string toString() { 3304 return "Animate(action: " ~ std.conv.to!string(this.action) ~ ", entityId: " ~ std.conv.to!string(this.entityId) ~ ", unknown2: " ~ std.conv.to!string(this.unknown2) ~ ")"; 3305 } 3306 3307 } 3308 3309 class Respawn : Buffer { 3310 3311 public enum uint ID = 45; 3312 3313 public enum bool CLIENTBOUND = true; 3314 public enum bool SERVERBOUND = false; 3315 3316 public enum string[] FIELDS = ["position"]; 3317 3318 public Tuple!(float, "x", float, "y", float, "z") position; 3319 3320 public pure nothrow @safe @nogc this() {} 3321 3322 public pure nothrow @safe @nogc this(Tuple!(float, "x", float, "y", float, "z") position) { 3323 this.position = position; 3324 } 3325 3326 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3327 _buffer.length = 0; 3328 static if(writeId){ writeBytes(varuint.encode(ID)); } 3329 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 3330 return _buffer; 3331 } 3332 3333 public pure nothrow @safe void decode(bool readId=true)() { 3334 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3335 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 3336 } 3337 3338 public static pure nothrow @safe Respawn fromBuffer(bool readId=true)(ubyte[] buffer) { 3339 Respawn ret = new Respawn(); 3340 ret._buffer = buffer; 3341 ret.decode!readId(); 3342 return ret; 3343 } 3344 3345 public override string toString() { 3346 return "Respawn(position: " ~ std.conv.to!string(this.position) ~ ")"; 3347 } 3348 3349 } 3350 3351 class ContainerOpen : Buffer { 3352 3353 public enum uint ID = 46; 3354 3355 public enum bool CLIENTBOUND = true; 3356 public enum bool SERVERBOUND = false; 3357 3358 public enum string[] FIELDS = ["window", "type", "position", "entityId"]; 3359 3360 public ubyte window; 3361 public ubyte type; 3362 public sul.protocol.bedrock160.types.BlockPosition position; 3363 public long entityId; 3364 3365 public pure nothrow @safe @nogc this() {} 3366 3367 public pure nothrow @safe @nogc this(ubyte window, ubyte type=ubyte.init, sul.protocol.bedrock160.types.BlockPosition position=sul.protocol.bedrock160.types.BlockPosition.init, long entityId=long.init) { 3368 this.window = window; 3369 this.type = type; 3370 this.position = position; 3371 this.entityId = entityId; 3372 } 3373 3374 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3375 _buffer.length = 0; 3376 static if(writeId){ writeBytes(varuint.encode(ID)); } 3377 writeLittleEndianUbyte(window); 3378 writeLittleEndianUbyte(type); 3379 position.encode(bufferInstance); 3380 writeBytes(varlong.encode(entityId)); 3381 return _buffer; 3382 } 3383 3384 public pure nothrow @safe void decode(bool readId=true)() { 3385 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3386 window=readLittleEndianUbyte(); 3387 type=readLittleEndianUbyte(); 3388 position.decode(bufferInstance); 3389 entityId=varlong.decode(_buffer, &_index); 3390 } 3391 3392 public static pure nothrow @safe ContainerOpen fromBuffer(bool readId=true)(ubyte[] buffer) { 3393 ContainerOpen ret = new ContainerOpen(); 3394 ret._buffer = buffer; 3395 ret.decode!readId(); 3396 return ret; 3397 } 3398 3399 public override string toString() { 3400 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) ~ ")"; 3401 } 3402 3403 } 3404 3405 class ContainerClose : Buffer { 3406 3407 public enum uint ID = 47; 3408 3409 public enum bool CLIENTBOUND = true; 3410 public enum bool SERVERBOUND = true; 3411 3412 public enum string[] FIELDS = ["window"]; 3413 3414 public ubyte window; 3415 3416 public pure nothrow @safe @nogc this() {} 3417 3418 public pure nothrow @safe @nogc this(ubyte window) { 3419 this.window = window; 3420 } 3421 3422 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3423 _buffer.length = 0; 3424 static if(writeId){ writeBytes(varuint.encode(ID)); } 3425 writeLittleEndianUbyte(window); 3426 return _buffer; 3427 } 3428 3429 public pure nothrow @safe void decode(bool readId=true)() { 3430 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3431 window=readLittleEndianUbyte(); 3432 } 3433 3434 public static pure nothrow @safe ContainerClose fromBuffer(bool readId=true)(ubyte[] buffer) { 3435 ContainerClose ret = new ContainerClose(); 3436 ret._buffer = buffer; 3437 ret.decode!readId(); 3438 return ret; 3439 } 3440 3441 public override string toString() { 3442 return "ContainerClose(window: " ~ std.conv.to!string(this.window) ~ ")"; 3443 } 3444 3445 } 3446 3447 class PlayerHotbar : Buffer { 3448 3449 public enum uint ID = 48; 3450 3451 public enum bool CLIENTBOUND = false; 3452 public enum bool SERVERBOUND = false; 3453 3454 public enum string[] FIELDS = []; 3455 3456 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3457 _buffer.length = 0; 3458 static if(writeId){ writeBytes(varuint.encode(ID)); } 3459 return _buffer; 3460 } 3461 3462 public pure nothrow @safe void decode(bool readId=true)() { 3463 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3464 } 3465 3466 public static pure nothrow @safe PlayerHotbar fromBuffer(bool readId=true)(ubyte[] buffer) { 3467 PlayerHotbar ret = new PlayerHotbar(); 3468 ret._buffer = buffer; 3469 ret.decode!readId(); 3470 return ret; 3471 } 3472 3473 public override string toString() { 3474 return "PlayerHotbar()"; 3475 } 3476 3477 } 3478 3479 class InventoryContent : Buffer { 3480 3481 public enum uint ID = 49; 3482 3483 public enum bool CLIENTBOUND = true; 3484 public enum bool SERVERBOUND = false; 3485 3486 public enum string[] FIELDS = ["window", "slots"]; 3487 3488 public uint window; 3489 public sul.protocol.bedrock160.types.Slot[] slots; 3490 3491 public pure nothrow @safe @nogc this() {} 3492 3493 public pure nothrow @safe @nogc this(uint window, sul.protocol.bedrock160.types.Slot[] slots=(sul.protocol.bedrock160.types.Slot[]).init) { 3494 this.window = window; 3495 this.slots = slots; 3496 } 3497 3498 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3499 _buffer.length = 0; 3500 static if(writeId){ writeBytes(varuint.encode(ID)); } 3501 writeBytes(varuint.encode(window)); 3502 writeBytes(varuint.encode(cast(uint)slots.length)); foreach(cxdm;slots){ cxdm.encode(bufferInstance); } 3503 return _buffer; 3504 } 3505 3506 public pure nothrow @safe void decode(bool readId=true)() { 3507 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3508 window=varuint.decode(_buffer, &_index); 3509 slots.length=varuint.decode(_buffer, &_index); foreach(ref cxdm;slots){ cxdm.decode(bufferInstance); } 3510 } 3511 3512 public static pure nothrow @safe InventoryContent fromBuffer(bool readId=true)(ubyte[] buffer) { 3513 InventoryContent ret = new InventoryContent(); 3514 ret._buffer = buffer; 3515 ret.decode!readId(); 3516 return ret; 3517 } 3518 3519 public override string toString() { 3520 return "InventoryContent(window: " ~ std.conv.to!string(this.window) ~ ", slots: " ~ std.conv.to!string(this.slots) ~ ")"; 3521 } 3522 3523 } 3524 3525 class InventorySlot : Buffer { 3526 3527 public enum uint ID = 50; 3528 3529 public enum bool CLIENTBOUND = true; 3530 public enum bool SERVERBOUND = false; 3531 3532 public enum string[] FIELDS = []; 3533 3534 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3535 _buffer.length = 0; 3536 static if(writeId){ writeBytes(varuint.encode(ID)); } 3537 return _buffer; 3538 } 3539 3540 public pure nothrow @safe void decode(bool readId=true)() { 3541 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3542 } 3543 3544 public static pure nothrow @safe InventorySlot fromBuffer(bool readId=true)(ubyte[] buffer) { 3545 InventorySlot ret = new InventorySlot(); 3546 ret._buffer = buffer; 3547 ret.decode!readId(); 3548 return ret; 3549 } 3550 3551 public override string toString() { 3552 return "InventorySlot()"; 3553 } 3554 3555 } 3556 3557 class ContainerSetData : Buffer { 3558 3559 public enum uint ID = 51; 3560 3561 public enum bool CLIENTBOUND = true; 3562 public enum bool SERVERBOUND = false; 3563 3564 public enum string[] FIELDS = ["window", "property", "value"]; 3565 3566 public ubyte window; 3567 public int property; 3568 public int value; 3569 3570 public pure nothrow @safe @nogc this() {} 3571 3572 public pure nothrow @safe @nogc this(ubyte window, int property=int.init, int value=int.init) { 3573 this.window = window; 3574 this.property = property; 3575 this.value = value; 3576 } 3577 3578 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3579 _buffer.length = 0; 3580 static if(writeId){ writeBytes(varuint.encode(ID)); } 3581 writeLittleEndianUbyte(window); 3582 writeBytes(varint.encode(property)); 3583 writeBytes(varint.encode(value)); 3584 return _buffer; 3585 } 3586 3587 public pure nothrow @safe void decode(bool readId=true)() { 3588 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3589 window=readLittleEndianUbyte(); 3590 property=varint.decode(_buffer, &_index); 3591 value=varint.decode(_buffer, &_index); 3592 } 3593 3594 public static pure nothrow @safe ContainerSetData fromBuffer(bool readId=true)(ubyte[] buffer) { 3595 ContainerSetData ret = new ContainerSetData(); 3596 ret._buffer = buffer; 3597 ret.decode!readId(); 3598 return ret; 3599 } 3600 3601 public override string toString() { 3602 return "ContainerSetData(window: " ~ std.conv.to!string(this.window) ~ ", property: " ~ std.conv.to!string(this.property) ~ ", value: " ~ std.conv.to!string(this.value) ~ ")"; 3603 } 3604 3605 } 3606 3607 class CraftingData : Buffer { 3608 3609 public enum uint ID = 52; 3610 3611 public enum bool CLIENTBOUND = true; 3612 public enum bool SERVERBOUND = false; 3613 3614 public enum string[] FIELDS = ["recipes"]; 3615 3616 public sul.protocol.bedrock160.types.Recipe[] recipes; 3617 3618 public pure nothrow @safe @nogc this() {} 3619 3620 public pure nothrow @safe @nogc this(sul.protocol.bedrock160.types.Recipe[] recipes) { 3621 this.recipes = recipes; 3622 } 3623 3624 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3625 _buffer.length = 0; 3626 static if(writeId){ writeBytes(varuint.encode(ID)); } 3627 writeBytes(varuint.encode(cast(uint)recipes.length)); foreach(cvabc;recipes){ cvabc.encode(bufferInstance); } 3628 return _buffer; 3629 } 3630 3631 public pure nothrow @safe void decode(bool readId=true)() { 3632 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3633 recipes.length=varuint.decode(_buffer, &_index); foreach(ref cvabc;recipes){ cvabc.decode(bufferInstance); } 3634 } 3635 3636 public static pure nothrow @safe CraftingData fromBuffer(bool readId=true)(ubyte[] buffer) { 3637 CraftingData ret = new CraftingData(); 3638 ret._buffer = buffer; 3639 ret.decode!readId(); 3640 return ret; 3641 } 3642 3643 public override string toString() { 3644 return "CraftingData(recipes: " ~ std.conv.to!string(this.recipes) ~ ")"; 3645 } 3646 3647 } 3648 3649 class CraftingEvent : Buffer { 3650 3651 public enum uint ID = 53; 3652 3653 public enum bool CLIENTBOUND = false; 3654 public enum bool SERVERBOUND = true; 3655 3656 public enum string[] FIELDS = ["window", "type", "uuid", "input", "output"]; 3657 3658 public ubyte window; 3659 public int type; 3660 public sul.protocol.bedrock160.types.McpeUuid uuid; 3661 public sul.protocol.bedrock160.types.Slot[] input; 3662 public sul.protocol.bedrock160.types.Slot[] output; 3663 3664 public pure nothrow @safe @nogc this() {} 3665 3666 public pure nothrow @safe @nogc this(ubyte window, int type=int.init, sul.protocol.bedrock160.types.McpeUuid uuid=sul.protocol.bedrock160.types.McpeUuid.init, sul.protocol.bedrock160.types.Slot[] input=(sul.protocol.bedrock160.types.Slot[]).init, sul.protocol.bedrock160.types.Slot[] output=(sul.protocol.bedrock160.types.Slot[]).init) { 3667 this.window = window; 3668 this.type = type; 3669 this.uuid = uuid; 3670 this.input = input; 3671 this.output = output; 3672 } 3673 3674 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3675 _buffer.length = 0; 3676 static if(writeId){ writeBytes(varuint.encode(ID)); } 3677 writeLittleEndianUbyte(window); 3678 writeBytes(varint.encode(type)); 3679 uuid.encode(bufferInstance); 3680 writeBytes(varuint.encode(cast(uint)input.length)); foreach(a5dq;input){ a5dq.encode(bufferInstance); } 3681 writeBytes(varuint.encode(cast(uint)output.length)); foreach(bvcv;output){ bvcv.encode(bufferInstance); } 3682 return _buffer; 3683 } 3684 3685 public pure nothrow @safe void decode(bool readId=true)() { 3686 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3687 window=readLittleEndianUbyte(); 3688 type=varint.decode(_buffer, &_index); 3689 uuid.decode(bufferInstance); 3690 input.length=varuint.decode(_buffer, &_index); foreach(ref a5dq;input){ a5dq.decode(bufferInstance); } 3691 output.length=varuint.decode(_buffer, &_index); foreach(ref bvcv;output){ bvcv.decode(bufferInstance); } 3692 } 3693 3694 public static pure nothrow @safe CraftingEvent fromBuffer(bool readId=true)(ubyte[] buffer) { 3695 CraftingEvent ret = new CraftingEvent(); 3696 ret._buffer = buffer; 3697 ret.decode!readId(); 3698 return ret; 3699 } 3700 3701 public override string toString() { 3702 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) ~ ")"; 3703 } 3704 3705 } 3706 3707 class GuiDataPickItem : Buffer { 3708 3709 public enum uint ID = 54; 3710 3711 public enum bool CLIENTBOUND = false; 3712 public enum bool SERVERBOUND = true; 3713 3714 public enum string[] FIELDS = ["slot"]; 3715 3716 public uint slot; 3717 3718 public pure nothrow @safe @nogc this() {} 3719 3720 public pure nothrow @safe @nogc this(uint slot) { 3721 this.slot = slot; 3722 } 3723 3724 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3725 _buffer.length = 0; 3726 static if(writeId){ writeBytes(varuint.encode(ID)); } 3727 writeLittleEndianUint(slot); 3728 return _buffer; 3729 } 3730 3731 public pure nothrow @safe void decode(bool readId=true)() { 3732 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3733 slot=readLittleEndianUint(); 3734 } 3735 3736 public static pure nothrow @safe GuiDataPickItem fromBuffer(bool readId=true)(ubyte[] buffer) { 3737 GuiDataPickItem ret = new GuiDataPickItem(); 3738 ret._buffer = buffer; 3739 ret.decode!readId(); 3740 return ret; 3741 } 3742 3743 public override string toString() { 3744 return "GuiDataPickItem(slot: " ~ std.conv.to!string(this.slot) ~ ")"; 3745 } 3746 3747 } 3748 3749 class AdventureSettings : Buffer { 3750 3751 public enum uint ID = 55; 3752 3753 public enum bool CLIENTBOUND = true; 3754 public enum bool SERVERBOUND = true; 3755 3756 // flags 3757 public enum uint IMMUTABLE_WORLD = 1; 3758 public enum uint PVP_DISABLED = 2; 3759 public enum uint PVM_DISABLED = 4; 3760 public enum uint MVP_DISBALED = 8; 3761 public enum uint EVP_DISABLED = 16; 3762 public enum uint AUTO_JUMP = 32; 3763 public enum uint ALLOW_FLIGHT = 64; 3764 public enum uint NO_CLIP = 128; 3765 public enum uint FLYING = 512; 3766 public enum uint MUTED = 1024; 3767 3768 // permission level 3769 public enum uint LEVEL_USER = 0; 3770 public enum uint LEVEL_OPERATOR = 1; 3771 public enum uint LEVEL_HOST = 2; 3772 public enum uint LEVEL_AUTOMATION = 3; 3773 public enum uint LEVEL_ADMIN = 4; 3774 3775 // abilities 3776 public enum uint BUILD_AND_MINE = 1; 3777 public enum uint DOORS_AND_SWITCHES = 2; 3778 public enum uint OPEN_CONTAINERS = 4; 3779 public enum uint ATTACK_PLAYERS = 8; 3780 public enum uint ATTACK_MOBS = 16; 3781 public enum uint OP = 32; 3782 public enum uint TELEPORT = 64; 3783 3784 // player rank 3785 public enum uint VISITOR = 0; 3786 public enum uint MEMBER = 1; 3787 public enum uint OPERATOR = 2; 3788 public enum uint CUSTOM = 3; 3789 3790 public enum string[] FIELDS = ["flags", "permissionLevel", "abilities", "playerRank", "customPermissions", "entityId"]; 3791 3792 public uint flags; 3793 public uint permissionLevel; 3794 public uint abilities; 3795 public uint playerRank; 3796 public uint customPermissions; 3797 public long entityId; 3798 3799 public pure nothrow @safe @nogc this() {} 3800 3801 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) { 3802 this.flags = flags; 3803 this.permissionLevel = permissionLevel; 3804 this.abilities = abilities; 3805 this.playerRank = playerRank; 3806 this.customPermissions = customPermissions; 3807 this.entityId = entityId; 3808 } 3809 3810 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3811 _buffer.length = 0; 3812 static if(writeId){ writeBytes(varuint.encode(ID)); } 3813 writeBytes(varuint.encode(flags)); 3814 writeBytes(varuint.encode(permissionLevel)); 3815 writeBytes(varuint.encode(abilities)); 3816 writeBytes(varuint.encode(playerRank)); 3817 writeBytes(varuint.encode(customPermissions)); 3818 writeLittleEndianLong(entityId); 3819 return _buffer; 3820 } 3821 3822 public pure nothrow @safe void decode(bool readId=true)() { 3823 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3824 flags=varuint.decode(_buffer, &_index); 3825 permissionLevel=varuint.decode(_buffer, &_index); 3826 abilities=varuint.decode(_buffer, &_index); 3827 playerRank=varuint.decode(_buffer, &_index); 3828 customPermissions=varuint.decode(_buffer, &_index); 3829 entityId=readLittleEndianLong(); 3830 } 3831 3832 public static pure nothrow @safe AdventureSettings fromBuffer(bool readId=true)(ubyte[] buffer) { 3833 AdventureSettings ret = new AdventureSettings(); 3834 ret._buffer = buffer; 3835 ret.decode!readId(); 3836 return ret; 3837 } 3838 3839 public override string toString() { 3840 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) ~ ")"; 3841 } 3842 3843 } 3844 3845 class BlockEntityData : Buffer { 3846 3847 public enum uint ID = 56; 3848 3849 public enum bool CLIENTBOUND = true; 3850 public enum bool SERVERBOUND = true; 3851 3852 public enum string[] FIELDS = ["position", "nbt"]; 3853 3854 public sul.protocol.bedrock160.types.BlockPosition position; 3855 public ubyte[] nbt; 3856 3857 public pure nothrow @safe @nogc this() {} 3858 3859 public pure nothrow @safe @nogc this(sul.protocol.bedrock160.types.BlockPosition position, ubyte[] nbt=(ubyte[]).init) { 3860 this.position = position; 3861 this.nbt = nbt; 3862 } 3863 3864 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3865 _buffer.length = 0; 3866 static if(writeId){ writeBytes(varuint.encode(ID)); } 3867 position.encode(bufferInstance); 3868 writeBytes(nbt); 3869 return _buffer; 3870 } 3871 3872 public pure nothrow @safe void decode(bool readId=true)() { 3873 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3874 position.decode(bufferInstance); 3875 nbt=_buffer[_index..$].dup; _index=_buffer.length; 3876 } 3877 3878 public static pure nothrow @safe BlockEntityData fromBuffer(bool readId=true)(ubyte[] buffer) { 3879 BlockEntityData ret = new BlockEntityData(); 3880 ret._buffer = buffer; 3881 ret.decode!readId(); 3882 return ret; 3883 } 3884 3885 public override string toString() { 3886 return "BlockEntityData(position: " ~ std.conv.to!string(this.position) ~ ", nbt: " ~ std.conv.to!string(this.nbt) ~ ")"; 3887 } 3888 3889 } 3890 3891 class PlayerInput : Buffer { 3892 3893 public enum uint ID = 57; 3894 3895 public enum bool CLIENTBOUND = false; 3896 public enum bool SERVERBOUND = true; 3897 3898 public enum string[] FIELDS = ["sideways", "forward", "unknown2", "unknown3"]; 3899 3900 public float sideways; 3901 public float forward; 3902 public bool unknown2; 3903 public bool unknown3; 3904 3905 public pure nothrow @safe @nogc this() {} 3906 3907 public pure nothrow @safe @nogc this(float sideways, float forward=float.init, bool unknown2=bool.init, bool unknown3=bool.init) { 3908 this.sideways = sideways; 3909 this.forward = forward; 3910 this.unknown2 = unknown2; 3911 this.unknown3 = unknown3; 3912 } 3913 3914 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3915 _buffer.length = 0; 3916 static if(writeId){ writeBytes(varuint.encode(ID)); } 3917 writeLittleEndianFloat(sideways); 3918 writeLittleEndianFloat(forward); 3919 writeLittleEndianBool(unknown2); 3920 writeLittleEndianBool(unknown3); 3921 return _buffer; 3922 } 3923 3924 public pure nothrow @safe void decode(bool readId=true)() { 3925 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3926 sideways=readLittleEndianFloat(); 3927 forward=readLittleEndianFloat(); 3928 unknown2=readLittleEndianBool(); 3929 unknown3=readLittleEndianBool(); 3930 } 3931 3932 public static pure nothrow @safe PlayerInput fromBuffer(bool readId=true)(ubyte[] buffer) { 3933 PlayerInput ret = new PlayerInput(); 3934 ret._buffer = buffer; 3935 ret.decode!readId(); 3936 return ret; 3937 } 3938 3939 public override string toString() { 3940 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) ~ ")"; 3941 } 3942 3943 } 3944 3945 class FullChunkData : Buffer { 3946 3947 public enum uint ID = 58; 3948 3949 public enum bool CLIENTBOUND = true; 3950 public enum bool SERVERBOUND = false; 3951 3952 public enum string[] FIELDS = ["position", "data"]; 3953 3954 public Tuple!(int, "x", int, "z") position; 3955 public sul.protocol.bedrock160.types.ChunkData data; 3956 3957 public pure nothrow @safe @nogc this() {} 3958 3959 public pure nothrow @safe @nogc this(Tuple!(int, "x", int, "z") position, sul.protocol.bedrock160.types.ChunkData data=sul.protocol.bedrock160.types.ChunkData.init) { 3960 this.position = position; 3961 this.data = data; 3962 } 3963 3964 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 3965 _buffer.length = 0; 3966 static if(writeId){ writeBytes(varuint.encode(ID)); } 3967 writeBytes(varint.encode(position.x)); writeBytes(varint.encode(position.z)); 3968 data.encode(bufferInstance); 3969 return _buffer; 3970 } 3971 3972 public pure nothrow @safe void decode(bool readId=true)() { 3973 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 3974 position.x=varint.decode(_buffer, &_index); position.z=varint.decode(_buffer, &_index); 3975 data.decode(bufferInstance); 3976 } 3977 3978 public static pure nothrow @safe FullChunkData fromBuffer(bool readId=true)(ubyte[] buffer) { 3979 FullChunkData ret = new FullChunkData(); 3980 ret._buffer = buffer; 3981 ret.decode!readId(); 3982 return ret; 3983 } 3984 3985 public override string toString() { 3986 return "FullChunkData(position: " ~ std.conv.to!string(this.position) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")"; 3987 } 3988 3989 } 3990 3991 class SetCommandsEnabled : Buffer { 3992 3993 public enum uint ID = 59; 3994 3995 public enum bool CLIENTBOUND = true; 3996 public enum bool SERVERBOUND = false; 3997 3998 public enum string[] FIELDS = ["enabled"]; 3999 4000 public bool enabled; 4001 4002 public pure nothrow @safe @nogc this() {} 4003 4004 public pure nothrow @safe @nogc this(bool enabled) { 4005 this.enabled = enabled; 4006 } 4007 4008 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4009 _buffer.length = 0; 4010 static if(writeId){ writeBytes(varuint.encode(ID)); } 4011 writeLittleEndianBool(enabled); 4012 return _buffer; 4013 } 4014 4015 public pure nothrow @safe void decode(bool readId=true)() { 4016 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4017 enabled=readLittleEndianBool(); 4018 } 4019 4020 public static pure nothrow @safe SetCommandsEnabled fromBuffer(bool readId=true)(ubyte[] buffer) { 4021 SetCommandsEnabled ret = new SetCommandsEnabled(); 4022 ret._buffer = buffer; 4023 ret.decode!readId(); 4024 return ret; 4025 } 4026 4027 public override string toString() { 4028 return "SetCommandsEnabled(enabled: " ~ std.conv.to!string(this.enabled) ~ ")"; 4029 } 4030 4031 } 4032 4033 class SetDifficulty : Buffer { 4034 4035 public enum uint ID = 60; 4036 4037 public enum bool CLIENTBOUND = true; 4038 public enum bool SERVERBOUND = false; 4039 4040 // difficulty 4041 public enum uint PEACEFUL = 0; 4042 public enum uint EASY = 1; 4043 public enum uint NORMAL = 2; 4044 public enum uint HARD = 3; 4045 4046 public enum string[] FIELDS = ["difficulty"]; 4047 4048 public uint difficulty; 4049 4050 public pure nothrow @safe @nogc this() {} 4051 4052 public pure nothrow @safe @nogc this(uint difficulty) { 4053 this.difficulty = difficulty; 4054 } 4055 4056 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4057 _buffer.length = 0; 4058 static if(writeId){ writeBytes(varuint.encode(ID)); } 4059 writeBytes(varuint.encode(difficulty)); 4060 return _buffer; 4061 } 4062 4063 public pure nothrow @safe void decode(bool readId=true)() { 4064 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4065 difficulty=varuint.decode(_buffer, &_index); 4066 } 4067 4068 public static pure nothrow @safe SetDifficulty fromBuffer(bool readId=true)(ubyte[] buffer) { 4069 SetDifficulty ret = new SetDifficulty(); 4070 ret._buffer = buffer; 4071 ret.decode!readId(); 4072 return ret; 4073 } 4074 4075 public override string toString() { 4076 return "SetDifficulty(difficulty: " ~ std.conv.to!string(this.difficulty) ~ ")"; 4077 } 4078 4079 } 4080 4081 class ChangeDimension : Buffer { 4082 4083 public enum uint ID = 61; 4084 4085 public enum bool CLIENTBOUND = true; 4086 public enum bool SERVERBOUND = false; 4087 4088 // dimension 4089 public enum int OVERWORLD = 0; 4090 public enum int NETHER = 1; 4091 public enum int END = 2; 4092 4093 public enum string[] FIELDS = ["dimension", "position", "unknown2"]; 4094 4095 public int dimension; 4096 public Tuple!(float, "x", float, "y", float, "z") position; 4097 public bool unknown2; 4098 4099 public pure nothrow @safe @nogc this() {} 4100 4101 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) { 4102 this.dimension = dimension; 4103 this.position = position; 4104 this.unknown2 = unknown2; 4105 } 4106 4107 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4108 _buffer.length = 0; 4109 static if(writeId){ writeBytes(varuint.encode(ID)); } 4110 writeBytes(varint.encode(dimension)); 4111 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 4112 writeLittleEndianBool(unknown2); 4113 return _buffer; 4114 } 4115 4116 public pure nothrow @safe void decode(bool readId=true)() { 4117 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4118 dimension=varint.decode(_buffer, &_index); 4119 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 4120 unknown2=readLittleEndianBool(); 4121 } 4122 4123 public static pure nothrow @safe ChangeDimension fromBuffer(bool readId=true)(ubyte[] buffer) { 4124 ChangeDimension ret = new ChangeDimension(); 4125 ret._buffer = buffer; 4126 ret.decode!readId(); 4127 return ret; 4128 } 4129 4130 public override string toString() { 4131 return "ChangeDimension(dimension: " ~ std.conv.to!string(this.dimension) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", unknown2: " ~ std.conv.to!string(this.unknown2) ~ ")"; 4132 } 4133 4134 } 4135 4136 class SetPlayerGameType : Buffer { 4137 4138 public enum uint ID = 62; 4139 4140 public enum bool CLIENTBOUND = true; 4141 public enum bool SERVERBOUND = true; 4142 4143 // gamemode 4144 public enum int SURVIVAL = 0; 4145 public enum int CREATIVE = 1; 4146 public enum int ADVENTURE = 2; 4147 4148 public enum string[] FIELDS = ["gamemode"]; 4149 4150 public int gamemode; 4151 4152 public pure nothrow @safe @nogc this() {} 4153 4154 public pure nothrow @safe @nogc this(int gamemode) { 4155 this.gamemode = gamemode; 4156 } 4157 4158 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4159 _buffer.length = 0; 4160 static if(writeId){ writeBytes(varuint.encode(ID)); } 4161 writeBytes(varint.encode(gamemode)); 4162 return _buffer; 4163 } 4164 4165 public pure nothrow @safe void decode(bool readId=true)() { 4166 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4167 gamemode=varint.decode(_buffer, &_index); 4168 } 4169 4170 public static pure nothrow @safe SetPlayerGameType fromBuffer(bool readId=true)(ubyte[] buffer) { 4171 SetPlayerGameType ret = new SetPlayerGameType(); 4172 ret._buffer = buffer; 4173 ret.decode!readId(); 4174 return ret; 4175 } 4176 4177 public override string toString() { 4178 return "SetPlayerGameType(gamemode: " ~ std.conv.to!string(this.gamemode) ~ ")"; 4179 } 4180 4181 } 4182 4183 class PlayerList : Buffer { 4184 4185 public enum uint ID = 63; 4186 4187 public enum bool CLIENTBOUND = true; 4188 public enum bool SERVERBOUND = false; 4189 4190 public enum string[] FIELDS = ["action"]; 4191 4192 public ubyte action; 4193 4194 public pure nothrow @safe @nogc this() {} 4195 4196 public pure nothrow @safe @nogc this(ubyte action) { 4197 this.action = action; 4198 } 4199 4200 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4201 _buffer.length = 0; 4202 static if(writeId){ writeBytes(varuint.encode(ID)); } 4203 writeLittleEndianUbyte(action); 4204 return _buffer; 4205 } 4206 4207 public pure nothrow @safe void decode(bool readId=true)() { 4208 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4209 action=readLittleEndianUbyte(); 4210 } 4211 4212 public static pure nothrow @safe PlayerList fromBuffer(bool readId=true)(ubyte[] buffer) { 4213 PlayerList ret = new PlayerList(); 4214 ret._buffer = buffer; 4215 ret.decode!readId(); 4216 return ret; 4217 } 4218 4219 public override string toString() { 4220 return "PlayerList(action: " ~ std.conv.to!string(this.action) ~ ")"; 4221 } 4222 4223 alias _encode = encode; 4224 4225 enum string variantField = "action"; 4226 4227 alias Variants = TypeTuple!(Add, Remove); 4228 4229 public class Add { 4230 4231 public enum typeof(action) ACTION = 0; 4232 4233 public enum string[] FIELDS = ["players"]; 4234 4235 public sul.protocol.bedrock160.types.PlayerList[] players; 4236 4237 public pure nothrow @safe @nogc this() {} 4238 4239 public pure nothrow @safe @nogc this(sul.protocol.bedrock160.types.PlayerList[] players) { 4240 this.players = players; 4241 } 4242 4243 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4244 action = 0; 4245 _encode!writeId(); 4246 writeBytes(varuint.encode(cast(uint)players.length)); foreach(cxevc;players){ cxevc.encode(bufferInstance); } 4247 return _buffer; 4248 } 4249 4250 public pure nothrow @safe void decode() { 4251 players.length=varuint.decode(_buffer, &_index); foreach(ref cxevc;players){ cxevc.decode(bufferInstance); } 4252 } 4253 4254 public override string toString() { 4255 return "PlayerList.Add(players: " ~ std.conv.to!string(this.players) ~ ")"; 4256 } 4257 4258 } 4259 4260 public class Remove { 4261 4262 public enum typeof(action) ACTION = 1; 4263 4264 public enum string[] FIELDS = ["players"]; 4265 4266 public sul.protocol.bedrock160.types.McpeUuid[] players; 4267 4268 public pure nothrow @safe @nogc this() {} 4269 4270 public pure nothrow @safe @nogc this(sul.protocol.bedrock160.types.McpeUuid[] players) { 4271 this.players = players; 4272 } 4273 4274 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4275 action = 1; 4276 _encode!writeId(); 4277 writeBytes(varuint.encode(cast(uint)players.length)); foreach(cxevc;players){ cxevc.encode(bufferInstance); } 4278 return _buffer; 4279 } 4280 4281 public pure nothrow @safe void decode() { 4282 players.length=varuint.decode(_buffer, &_index); foreach(ref cxevc;players){ cxevc.decode(bufferInstance); } 4283 } 4284 4285 public override string toString() { 4286 return "PlayerList.Remove(players: " ~ std.conv.to!string(this.players) ~ ")"; 4287 } 4288 4289 } 4290 4291 } 4292 4293 class SimpleEvent : Buffer { 4294 4295 public enum uint ID = 64; 4296 4297 public enum bool CLIENTBOUND = true; 4298 public enum bool SERVERBOUND = true; 4299 4300 public enum string[] FIELDS = []; 4301 4302 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4303 _buffer.length = 0; 4304 static if(writeId){ writeBytes(varuint.encode(ID)); } 4305 return _buffer; 4306 } 4307 4308 public pure nothrow @safe void decode(bool readId=true)() { 4309 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4310 } 4311 4312 public static pure nothrow @safe SimpleEvent fromBuffer(bool readId=true)(ubyte[] buffer) { 4313 SimpleEvent ret = new SimpleEvent(); 4314 ret._buffer = buffer; 4315 ret.decode!readId(); 4316 return ret; 4317 } 4318 4319 public override string toString() { 4320 return "SimpleEvent()"; 4321 } 4322 4323 } 4324 4325 class TelemetryEvent : Buffer { 4326 4327 public enum uint ID = 65; 4328 4329 public enum bool CLIENTBOUND = true; 4330 public enum bool SERVERBOUND = false; 4331 4332 public enum string[] FIELDS = ["entityId", "eventId"]; 4333 4334 public long entityId; 4335 public int eventId; 4336 4337 public pure nothrow @safe @nogc this() {} 4338 4339 public pure nothrow @safe @nogc this(long entityId, int eventId=int.init) { 4340 this.entityId = entityId; 4341 this.eventId = eventId; 4342 } 4343 4344 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4345 _buffer.length = 0; 4346 static if(writeId){ writeBytes(varuint.encode(ID)); } 4347 writeBytes(varlong.encode(entityId)); 4348 writeBytes(varint.encode(eventId)); 4349 return _buffer; 4350 } 4351 4352 public pure nothrow @safe void decode(bool readId=true)() { 4353 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4354 entityId=varlong.decode(_buffer, &_index); 4355 eventId=varint.decode(_buffer, &_index); 4356 } 4357 4358 public static pure nothrow @safe TelemetryEvent fromBuffer(bool readId=true)(ubyte[] buffer) { 4359 TelemetryEvent ret = new TelemetryEvent(); 4360 ret._buffer = buffer; 4361 ret.decode!readId(); 4362 return ret; 4363 } 4364 4365 public override string toString() { 4366 return "TelemetryEvent(entityId: " ~ std.conv.to!string(this.entityId) ~ ", eventId: " ~ std.conv.to!string(this.eventId) ~ ")"; 4367 } 4368 4369 } 4370 4371 class SpawnExperienceOrb : Buffer { 4372 4373 public enum uint ID = 66; 4374 4375 public enum bool CLIENTBOUND = true; 4376 public enum bool SERVERBOUND = false; 4377 4378 public enum string[] FIELDS = ["position", "count"]; 4379 4380 public Tuple!(float, "x", float, "y", float, "z") position; 4381 public int count; 4382 4383 public pure nothrow @safe @nogc this() {} 4384 4385 public pure nothrow @safe @nogc this(Tuple!(float, "x", float, "y", float, "z") position, int count=int.init) { 4386 this.position = position; 4387 this.count = count; 4388 } 4389 4390 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4391 _buffer.length = 0; 4392 static if(writeId){ writeBytes(varuint.encode(ID)); } 4393 writeLittleEndianFloat(position.x); writeLittleEndianFloat(position.y); writeLittleEndianFloat(position.z); 4394 writeBytes(varint.encode(count)); 4395 return _buffer; 4396 } 4397 4398 public pure nothrow @safe void decode(bool readId=true)() { 4399 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4400 position.x=readLittleEndianFloat(); position.y=readLittleEndianFloat(); position.z=readLittleEndianFloat(); 4401 count=varint.decode(_buffer, &_index); 4402 } 4403 4404 public static pure nothrow @safe SpawnExperienceOrb fromBuffer(bool readId=true)(ubyte[] buffer) { 4405 SpawnExperienceOrb ret = new SpawnExperienceOrb(); 4406 ret._buffer = buffer; 4407 ret.decode!readId(); 4408 return ret; 4409 } 4410 4411 public override string toString() { 4412 return "SpawnExperienceOrb(position: " ~ std.conv.to!string(this.position) ~ ", count: " ~ std.conv.to!string(this.count) ~ ")"; 4413 } 4414 4415 } 4416 4417 class ClientboundMapItemData : Buffer { 4418 4419 public enum uint ID = 67; 4420 4421 public enum bool CLIENTBOUND = true; 4422 public enum bool SERVERBOUND = false; 4423 4424 // update 4425 public enum uint TEXTURE = 2; 4426 public enum uint DECORATIONS = 4; 4427 public enum uint ENTITIES = 8; 4428 4429 public enum string[] FIELDS = ["mapId", "update", "scale", "size", "offset", "data", "decorations"]; 4430 4431 public long mapId; 4432 public uint update; 4433 public ubyte scale; 4434 public Tuple!(int, "x", int, "z") size; 4435 public Tuple!(int, "x", int, "z") offset; 4436 public ubyte[] data; 4437 public sul.protocol.bedrock160.types.Decoration[] decorations; 4438 4439 public pure nothrow @safe @nogc this() {} 4440 4441 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.bedrock160.types.Decoration[] decorations=(sul.protocol.bedrock160.types.Decoration[]).init) { 4442 this.mapId = mapId; 4443 this.update = update; 4444 this.scale = scale; 4445 this.size = size; 4446 this.offset = offset; 4447 this.data = data; 4448 this.decorations = decorations; 4449 } 4450 4451 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4452 _buffer.length = 0; 4453 static if(writeId){ writeBytes(varuint.encode(ID)); } 4454 writeBytes(varlong.encode(mapId)); 4455 writeBytes(varuint.encode(update)); 4456 if(update==2||update==4){ writeLittleEndianUbyte(scale); } 4457 if(update==2){ writeBytes(varint.encode(size.x)); writeBytes(varint.encode(size.z)); } 4458 if(update==2){ writeBytes(varint.encode(offset.x)); writeBytes(varint.encode(offset.z)); } 4459 if(update==2){ writeBytes(data); } 4460 if(update==4){ writeBytes(varuint.encode(cast(uint)decorations.length)); foreach(zvbjdlbm;decorations){ zvbjdlbm.encode(bufferInstance); } } 4461 return _buffer; 4462 } 4463 4464 public pure nothrow @safe void decode(bool readId=true)() { 4465 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4466 mapId=varlong.decode(_buffer, &_index); 4467 update=varuint.decode(_buffer, &_index); 4468 if(update==2||update==4){ scale=readLittleEndianUbyte(); } 4469 if(update==2){ size.x=varint.decode(_buffer, &_index); size.z=varint.decode(_buffer, &_index); } 4470 if(update==2){ offset.x=varint.decode(_buffer, &_index); offset.z=varint.decode(_buffer, &_index); } 4471 if(update==2){ data=_buffer[_index..$].dup; _index=_buffer.length; } 4472 if(update==4){ decorations.length=varuint.decode(_buffer, &_index); foreach(ref zvbjdlbm;decorations){ zvbjdlbm.decode(bufferInstance); } } 4473 } 4474 4475 public static pure nothrow @safe ClientboundMapItemData fromBuffer(bool readId=true)(ubyte[] buffer) { 4476 ClientboundMapItemData ret = new ClientboundMapItemData(); 4477 ret._buffer = buffer; 4478 ret.decode!readId(); 4479 return ret; 4480 } 4481 4482 public override string toString() { 4483 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) ~ ")"; 4484 } 4485 4486 } 4487 4488 class MapInfoRequest : Buffer { 4489 4490 public enum uint ID = 68; 4491 4492 public enum bool CLIENTBOUND = false; 4493 public enum bool SERVERBOUND = true; 4494 4495 public enum string[] FIELDS = ["mapId"]; 4496 4497 public long mapId; 4498 4499 public pure nothrow @safe @nogc this() {} 4500 4501 public pure nothrow @safe @nogc this(long mapId) { 4502 this.mapId = mapId; 4503 } 4504 4505 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4506 _buffer.length = 0; 4507 static if(writeId){ writeBytes(varuint.encode(ID)); } 4508 writeBytes(varlong.encode(mapId)); 4509 return _buffer; 4510 } 4511 4512 public pure nothrow @safe void decode(bool readId=true)() { 4513 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4514 mapId=varlong.decode(_buffer, &_index); 4515 } 4516 4517 public static pure nothrow @safe MapInfoRequest fromBuffer(bool readId=true)(ubyte[] buffer) { 4518 MapInfoRequest ret = new MapInfoRequest(); 4519 ret._buffer = buffer; 4520 ret.decode!readId(); 4521 return ret; 4522 } 4523 4524 public override string toString() { 4525 return "MapInfoRequest(mapId: " ~ std.conv.to!string(this.mapId) ~ ")"; 4526 } 4527 4528 } 4529 4530 class RequestChunkRadius : Buffer { 4531 4532 public enum uint ID = 69; 4533 4534 public enum bool CLIENTBOUND = false; 4535 public enum bool SERVERBOUND = true; 4536 4537 public enum string[] FIELDS = ["radius"]; 4538 4539 public int radius; 4540 4541 public pure nothrow @safe @nogc this() {} 4542 4543 public pure nothrow @safe @nogc this(int radius) { 4544 this.radius = radius; 4545 } 4546 4547 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4548 _buffer.length = 0; 4549 static if(writeId){ writeBytes(varuint.encode(ID)); } 4550 writeBytes(varint.encode(radius)); 4551 return _buffer; 4552 } 4553 4554 public pure nothrow @safe void decode(bool readId=true)() { 4555 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4556 radius=varint.decode(_buffer, &_index); 4557 } 4558 4559 public static pure nothrow @safe RequestChunkRadius fromBuffer(bool readId=true)(ubyte[] buffer) { 4560 RequestChunkRadius ret = new RequestChunkRadius(); 4561 ret._buffer = buffer; 4562 ret.decode!readId(); 4563 return ret; 4564 } 4565 4566 public override string toString() { 4567 return "RequestChunkRadius(radius: " ~ std.conv.to!string(this.radius) ~ ")"; 4568 } 4569 4570 } 4571 4572 class ChunkRadiusUpdated : Buffer { 4573 4574 public enum uint ID = 70; 4575 4576 public enum bool CLIENTBOUND = true; 4577 public enum bool SERVERBOUND = false; 4578 4579 public enum string[] FIELDS = ["radius"]; 4580 4581 public int radius; 4582 4583 public pure nothrow @safe @nogc this() {} 4584 4585 public pure nothrow @safe @nogc this(int radius) { 4586 this.radius = radius; 4587 } 4588 4589 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4590 _buffer.length = 0; 4591 static if(writeId){ writeBytes(varuint.encode(ID)); } 4592 writeBytes(varint.encode(radius)); 4593 return _buffer; 4594 } 4595 4596 public pure nothrow @safe void decode(bool readId=true)() { 4597 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4598 radius=varint.decode(_buffer, &_index); 4599 } 4600 4601 public static pure nothrow @safe ChunkRadiusUpdated fromBuffer(bool readId=true)(ubyte[] buffer) { 4602 ChunkRadiusUpdated ret = new ChunkRadiusUpdated(); 4603 ret._buffer = buffer; 4604 ret.decode!readId(); 4605 return ret; 4606 } 4607 4608 public override string toString() { 4609 return "ChunkRadiusUpdated(radius: " ~ std.conv.to!string(this.radius) ~ ")"; 4610 } 4611 4612 } 4613 4614 class ItemFrameDropItem : Buffer { 4615 4616 public enum uint ID = 71; 4617 4618 public enum bool CLIENTBOUND = true; 4619 public enum bool SERVERBOUND = false; 4620 4621 public enum string[] FIELDS = ["position", "item"]; 4622 4623 public sul.protocol.bedrock160.types.BlockPosition position; 4624 public sul.protocol.bedrock160.types.Slot item; 4625 4626 public pure nothrow @safe @nogc this() {} 4627 4628 public pure nothrow @safe @nogc this(sul.protocol.bedrock160.types.BlockPosition position, sul.protocol.bedrock160.types.Slot item=sul.protocol.bedrock160.types.Slot.init) { 4629 this.position = position; 4630 this.item = item; 4631 } 4632 4633 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4634 _buffer.length = 0; 4635 static if(writeId){ writeBytes(varuint.encode(ID)); } 4636 position.encode(bufferInstance); 4637 item.encode(bufferInstance); 4638 return _buffer; 4639 } 4640 4641 public pure nothrow @safe void decode(bool readId=true)() { 4642 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4643 position.decode(bufferInstance); 4644 item.decode(bufferInstance); 4645 } 4646 4647 public static pure nothrow @safe ItemFrameDropItem fromBuffer(bool readId=true)(ubyte[] buffer) { 4648 ItemFrameDropItem ret = new ItemFrameDropItem(); 4649 ret._buffer = buffer; 4650 ret.decode!readId(); 4651 return ret; 4652 } 4653 4654 public override string toString() { 4655 return "ItemFrameDropItem(position: " ~ std.conv.to!string(this.position) ~ ", item: " ~ std.conv.to!string(this.item) ~ ")"; 4656 } 4657 4658 } 4659 4660 class GameRulesChanged : Buffer { 4661 4662 public enum uint ID = 72; 4663 4664 public enum bool CLIENTBOUND = true; 4665 public enum bool SERVERBOUND = false; 4666 4667 public enum string[] FIELDS = ["rules"]; 4668 4669 public sul.protocol.bedrock160.types.Rule[] rules; 4670 4671 public pure nothrow @safe @nogc this() {} 4672 4673 public pure nothrow @safe @nogc this(sul.protocol.bedrock160.types.Rule[] rules) { 4674 this.rules = rules; 4675 } 4676 4677 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4678 _buffer.length = 0; 4679 static if(writeId){ writeBytes(varuint.encode(ID)); } 4680 writeBytes(varuint.encode(cast(uint)rules.length)); foreach(cvzm;rules){ cvzm.encode(bufferInstance); } 4681 return _buffer; 4682 } 4683 4684 public pure nothrow @safe void decode(bool readId=true)() { 4685 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4686 rules.length=varuint.decode(_buffer, &_index); foreach(ref cvzm;rules){ cvzm.decode(bufferInstance); } 4687 } 4688 4689 public static pure nothrow @safe GameRulesChanged fromBuffer(bool readId=true)(ubyte[] buffer) { 4690 GameRulesChanged ret = new GameRulesChanged(); 4691 ret._buffer = buffer; 4692 ret.decode!readId(); 4693 return ret; 4694 } 4695 4696 public override string toString() { 4697 return "GameRulesChanged(rules: " ~ std.conv.to!string(this.rules) ~ ")"; 4698 } 4699 4700 } 4701 4702 class Camera : Buffer { 4703 4704 public enum uint ID = 73; 4705 4706 public enum bool CLIENTBOUND = true; 4707 public enum bool SERVERBOUND = false; 4708 4709 public enum string[] FIELDS = ["unknown0", "unknown1"]; 4710 4711 public long unknown0; 4712 public long unknown1; 4713 4714 public pure nothrow @safe @nogc this() {} 4715 4716 public pure nothrow @safe @nogc this(long unknown0, long unknown1=long.init) { 4717 this.unknown0 = unknown0; 4718 this.unknown1 = unknown1; 4719 } 4720 4721 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4722 _buffer.length = 0; 4723 static if(writeId){ writeBytes(varuint.encode(ID)); } 4724 writeBytes(varlong.encode(unknown0)); 4725 writeBytes(varlong.encode(unknown1)); 4726 return _buffer; 4727 } 4728 4729 public pure nothrow @safe void decode(bool readId=true)() { 4730 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4731 unknown0=varlong.decode(_buffer, &_index); 4732 unknown1=varlong.decode(_buffer, &_index); 4733 } 4734 4735 public static pure nothrow @safe Camera fromBuffer(bool readId=true)(ubyte[] buffer) { 4736 Camera ret = new Camera(); 4737 ret._buffer = buffer; 4738 ret.decode!readId(); 4739 return ret; 4740 } 4741 4742 public override string toString() { 4743 return "Camera(unknown0: " ~ std.conv.to!string(this.unknown0) ~ ", unknown1: " ~ std.conv.to!string(this.unknown1) ~ ")"; 4744 } 4745 4746 } 4747 4748 class BossEvent : Buffer { 4749 4750 public enum uint ID = 74; 4751 4752 public enum bool CLIENTBOUND = true; 4753 public enum bool SERVERBOUND = false; 4754 4755 // event id 4756 public enum uint ADD = 0; 4757 public enum uint UPDATE = 1; 4758 public enum uint REMOVE = 2; 4759 4760 public enum string[] FIELDS = ["entityId", "eventId"]; 4761 4762 public long entityId; 4763 public uint eventId; 4764 4765 public pure nothrow @safe @nogc this() {} 4766 4767 public pure nothrow @safe @nogc this(long entityId, uint eventId=uint.init) { 4768 this.entityId = entityId; 4769 this.eventId = eventId; 4770 } 4771 4772 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4773 _buffer.length = 0; 4774 static if(writeId){ writeBytes(varuint.encode(ID)); } 4775 writeBytes(varlong.encode(entityId)); 4776 writeBytes(varuint.encode(eventId)); 4777 return _buffer; 4778 } 4779 4780 public pure nothrow @safe void decode(bool readId=true)() { 4781 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4782 entityId=varlong.decode(_buffer, &_index); 4783 eventId=varuint.decode(_buffer, &_index); 4784 } 4785 4786 public static pure nothrow @safe BossEvent fromBuffer(bool readId=true)(ubyte[] buffer) { 4787 BossEvent ret = new BossEvent(); 4788 ret._buffer = buffer; 4789 ret.decode!readId(); 4790 return ret; 4791 } 4792 4793 public override string toString() { 4794 return "BossEvent(entityId: " ~ std.conv.to!string(this.entityId) ~ ", eventId: " ~ std.conv.to!string(this.eventId) ~ ")"; 4795 } 4796 4797 } 4798 4799 class ShowCredits : Buffer { 4800 4801 public enum uint ID = 75; 4802 4803 public enum bool CLIENTBOUND = true; 4804 public enum bool SERVERBOUND = true; 4805 4806 // status 4807 public enum int START = 0; 4808 public enum int END = 1; 4809 4810 public enum string[] FIELDS = ["entityId", "status"]; 4811 4812 public long entityId; 4813 public int status; 4814 4815 public pure nothrow @safe @nogc this() {} 4816 4817 public pure nothrow @safe @nogc this(long entityId, int status=int.init) { 4818 this.entityId = entityId; 4819 this.status = status; 4820 } 4821 4822 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4823 _buffer.length = 0; 4824 static if(writeId){ writeBytes(varuint.encode(ID)); } 4825 writeBytes(varlong.encode(entityId)); 4826 writeBytes(varint.encode(status)); 4827 return _buffer; 4828 } 4829 4830 public pure nothrow @safe void decode(bool readId=true)() { 4831 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4832 entityId=varlong.decode(_buffer, &_index); 4833 status=varint.decode(_buffer, &_index); 4834 } 4835 4836 public static pure nothrow @safe ShowCredits fromBuffer(bool readId=true)(ubyte[] buffer) { 4837 ShowCredits ret = new ShowCredits(); 4838 ret._buffer = buffer; 4839 ret.decode!readId(); 4840 return ret; 4841 } 4842 4843 public override string toString() { 4844 return "ShowCredits(entityId: " ~ std.conv.to!string(this.entityId) ~ ", status: " ~ std.conv.to!string(this.status) ~ ")"; 4845 } 4846 4847 } 4848 4849 class AvailableCommands : Buffer { 4850 4851 public enum uint ID = 76; 4852 4853 public enum bool CLIENTBOUND = true; 4854 public enum bool SERVERBOUND = false; 4855 4856 public enum string[] FIELDS = ["enumValues", "unknown1", "enums", "commands"]; 4857 4858 public string[] enumValues; 4859 public string[] unknown1; 4860 public sul.protocol.bedrock160.types.Enum[] enums; 4861 public sul.protocol.bedrock160.types.Command[] commands; 4862 4863 public pure nothrow @safe @nogc this() {} 4864 4865 public pure nothrow @safe @nogc this(string[] enumValues, string[] unknown1=(string[]).init, sul.protocol.bedrock160.types.Enum[] enums=(sul.protocol.bedrock160.types.Enum[]).init, sul.protocol.bedrock160.types.Command[] commands=(sul.protocol.bedrock160.types.Command[]).init) { 4866 this.enumValues = enumValues; 4867 this.unknown1 = unknown1; 4868 this.enums = enums; 4869 this.commands = commands; 4870 } 4871 4872 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4873 _buffer.length = 0; 4874 static if(writeId){ writeBytes(varuint.encode(ID)); } 4875 writeBytes(varuint.encode(cast(uint)enumValues.length)); foreach(z5bzbvc;enumValues){ writeBytes(varuint.encode(cast(uint)z5bzbvc.length)); writeString(z5bzbvc); } 4876 writeBytes(varuint.encode(cast(uint)unknown1.length)); foreach(d5b9be;unknown1){ writeBytes(varuint.encode(cast(uint)d5b9be.length)); writeString(d5b9be); } 4877 writeBytes(varuint.encode(cast(uint)enums.length)); foreach(z5bm;enums){ z5bm.encode(bufferInstance); } 4878 writeBytes(varuint.encode(cast(uint)commands.length)); foreach(y9bfzm;commands){ y9bfzm.encode(bufferInstance); } 4879 return _buffer; 4880 } 4881 4882 public pure nothrow @safe void decode(bool readId=true)() { 4883 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4884 enumValues.length=varuint.decode(_buffer, &_index); foreach(ref z5bzbvc;enumValues){ uint evejy=varuint.decode(_buffer, &_index); z5bzbvc=readString(evejy); } 4885 unknown1.length=varuint.decode(_buffer, &_index); foreach(ref d5b9be;unknown1){ uint zvoj=varuint.decode(_buffer, &_index); d5b9be=readString(zvoj); } 4886 enums.length=varuint.decode(_buffer, &_index); foreach(ref z5bm;enums){ z5bm.decode(bufferInstance); } 4887 commands.length=varuint.decode(_buffer, &_index); foreach(ref y9bfzm;commands){ y9bfzm.decode(bufferInstance); } 4888 } 4889 4890 public static pure nothrow @safe AvailableCommands fromBuffer(bool readId=true)(ubyte[] buffer) { 4891 AvailableCommands ret = new AvailableCommands(); 4892 ret._buffer = buffer; 4893 ret.decode!readId(); 4894 return ret; 4895 } 4896 4897 public override string toString() { 4898 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) ~ ")"; 4899 } 4900 4901 } 4902 4903 class CommandRequest : Buffer { 4904 4905 public enum uint ID = 77; 4906 4907 public enum bool CLIENTBOUND = false; 4908 public enum bool SERVERBOUND = true; 4909 4910 // type 4911 public enum uint PLAYER = 0; 4912 public enum uint COMMAND_BLOCK = 1; 4913 public enum uint MINECART_COMMAND_BLOCK = 2; 4914 public enum uint DEV_CONSOLE = 3; 4915 4916 public enum string[] FIELDS = ["command", "type", "uuid", "requestId", "playerId", "internal"]; 4917 4918 public string command; 4919 public uint type; 4920 public sul.protocol.bedrock160.types.McpeUuid uuid; 4921 public string requestId; 4922 public int playerId; 4923 public bool internal; 4924 4925 public pure nothrow @safe @nogc this() {} 4926 4927 public pure nothrow @safe @nogc this(string command, uint type=uint.init, sul.protocol.bedrock160.types.McpeUuid uuid=sul.protocol.bedrock160.types.McpeUuid.init, string requestId=string.init, int playerId=int.init, bool internal=bool.init) { 4928 this.command = command; 4929 this.type = type; 4930 this.uuid = uuid; 4931 this.requestId = requestId; 4932 this.playerId = playerId; 4933 this.internal = internal; 4934 } 4935 4936 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 4937 _buffer.length = 0; 4938 static if(writeId){ writeBytes(varuint.encode(ID)); } 4939 writeBytes(varuint.encode(cast(uint)command.length)); writeString(command); 4940 writeBytes(varuint.encode(type)); 4941 uuid.encode(bufferInstance); 4942 writeBytes(varuint.encode(cast(uint)requestId.length)); writeString(requestId); 4943 if(type==3){ writeBytes(varint.encode(playerId)); } 4944 writeLittleEndianBool(internal); 4945 return _buffer; 4946 } 4947 4948 public pure nothrow @safe void decode(bool readId=true)() { 4949 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 4950 uint y9bfz=varuint.decode(_buffer, &_index); command=readString(y9bfz); 4951 type=varuint.decode(_buffer, &_index); 4952 uuid.decode(bufferInstance); 4953 uint cvdvdl=varuint.decode(_buffer, &_index); requestId=readString(cvdvdl); 4954 if(type==3){ playerId=varint.decode(_buffer, &_index); } 4955 internal=readLittleEndianBool(); 4956 } 4957 4958 public static pure nothrow @safe CommandRequest fromBuffer(bool readId=true)(ubyte[] buffer) { 4959 CommandRequest ret = new CommandRequest(); 4960 ret._buffer = buffer; 4961 ret.decode!readId(); 4962 return ret; 4963 } 4964 4965 public override string toString() { 4966 return "CommandRequest(command: " ~ std.conv.to!string(this.command) ~ ", type: " ~ std.conv.to!string(this.type) ~ ", uuid: " ~ std.conv.to!string(this.uuid) ~ ", requestId: " ~ std.conv.to!string(this.requestId) ~ ", playerId: " ~ std.conv.to!string(this.playerId) ~ ", internal: " ~ std.conv.to!string(this.internal) ~ ")"; 4967 } 4968 4969 } 4970 4971 class CommandBlockUpdate : Buffer { 4972 4973 public enum uint ID = 78; 4974 4975 public enum bool CLIENTBOUND = true; 4976 public enum bool SERVERBOUND = true; 4977 4978 public enum string[] FIELDS = ["updateBlock", "position", "mode", "redstoneMode", "conditional", "minecart", "command", "lastOutput", "hover", "trackOutput"]; 4979 4980 public bool updateBlock; 4981 public sul.protocol.bedrock160.types.BlockPosition position; 4982 public uint mode; 4983 public bool redstoneMode; 4984 public bool conditional; 4985 public long minecart; 4986 public string command; 4987 public string lastOutput; 4988 public string hover; 4989 public bool trackOutput; 4990 4991 public pure nothrow @safe @nogc this() {} 4992 4993 public pure nothrow @safe @nogc this(bool updateBlock, sul.protocol.bedrock160.types.BlockPosition position=sul.protocol.bedrock160.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) { 4994 this.updateBlock = updateBlock; 4995 this.position = position; 4996 this.mode = mode; 4997 this.redstoneMode = redstoneMode; 4998 this.conditional = conditional; 4999 this.minecart = minecart; 5000 this.command = command; 5001 this.lastOutput = lastOutput; 5002 this.hover = hover; 5003 this.trackOutput = trackOutput; 5004 } 5005 5006 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5007 _buffer.length = 0; 5008 static if(writeId){ writeBytes(varuint.encode(ID)); } 5009 writeLittleEndianBool(updateBlock); 5010 if(updateBlock==true){ position.encode(bufferInstance); } 5011 if(updateBlock==true){ writeBytes(varuint.encode(mode)); } 5012 if(updateBlock==true){ writeLittleEndianBool(redstoneMode); } 5013 if(updateBlock==true){ writeLittleEndianBool(conditional); } 5014 if(updateBlock==false){ writeBytes(varlong.encode(minecart)); } 5015 writeBytes(varuint.encode(cast(uint)command.length)); writeString(command); 5016 writeBytes(varuint.encode(cast(uint)lastOutput.length)); writeString(lastOutput); 5017 writeBytes(varuint.encode(cast(uint)hover.length)); writeString(hover); 5018 writeLittleEndianBool(trackOutput); 5019 return _buffer; 5020 } 5021 5022 public pure nothrow @safe void decode(bool readId=true)() { 5023 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5024 updateBlock=readLittleEndianBool(); 5025 if(updateBlock==true){ position.decode(bufferInstance); } 5026 if(updateBlock==true){ mode=varuint.decode(_buffer, &_index); } 5027 if(updateBlock==true){ redstoneMode=readLittleEndianBool(); } 5028 if(updateBlock==true){ conditional=readLittleEndianBool(); } 5029 if(updateBlock==false){ minecart=varlong.decode(_buffer, &_index); } 5030 uint y9bfz=varuint.decode(_buffer, &_index); command=readString(y9bfz); 5031 uint bfd9dbd=varuint.decode(_buffer, &_index); lastOutput=readString(bfd9dbd); 5032 uint a9zi=varuint.decode(_buffer, &_index); hover=readString(a9zi); 5033 trackOutput=readLittleEndianBool(); 5034 } 5035 5036 public static pure nothrow @safe CommandBlockUpdate fromBuffer(bool readId=true)(ubyte[] buffer) { 5037 CommandBlockUpdate ret = new CommandBlockUpdate(); 5038 ret._buffer = buffer; 5039 ret.decode!readId(); 5040 return ret; 5041 } 5042 5043 public override string toString() { 5044 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) ~ ")"; 5045 } 5046 5047 } 5048 5049 class UpdateTrade : Buffer { 5050 5051 public enum uint ID = 80; 5052 5053 public enum bool CLIENTBOUND = true; 5054 public enum bool SERVERBOUND = false; 5055 5056 public enum string[] FIELDS = ["window", "windowType", "unknown2", "unknown3", "willing", "trader", "player", "displayName", "offers"]; 5057 5058 public ubyte window; 5059 public ubyte windowType = 15; 5060 public int unknown2; 5061 public int unknown3; 5062 public bool willing; 5063 public long trader; 5064 public long player; 5065 public string displayName; 5066 public ubyte[] offers; 5067 5068 public pure nothrow @safe @nogc this() {} 5069 5070 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) { 5071 this.window = window; 5072 this.windowType = windowType; 5073 this.unknown2 = unknown2; 5074 this.unknown3 = unknown3; 5075 this.willing = willing; 5076 this.trader = trader; 5077 this.player = player; 5078 this.displayName = displayName; 5079 this.offers = offers; 5080 } 5081 5082 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5083 _buffer.length = 0; 5084 static if(writeId){ writeBytes(varuint.encode(ID)); } 5085 writeLittleEndianUbyte(window); 5086 writeLittleEndianUbyte(windowType); 5087 writeBytes(varint.encode(unknown2)); 5088 writeBytes(varint.encode(unknown3)); 5089 writeLittleEndianBool(willing); 5090 writeBytes(varlong.encode(trader)); 5091 writeBytes(varlong.encode(player)); 5092 writeBytes(varuint.encode(cast(uint)displayName.length)); writeString(displayName); 5093 writeBytes(offers); 5094 return _buffer; 5095 } 5096 5097 public pure nothrow @safe void decode(bool readId=true)() { 5098 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5099 window=readLittleEndianUbyte(); 5100 windowType=readLittleEndianUbyte(); 5101 unknown2=varint.decode(_buffer, &_index); 5102 unknown3=varint.decode(_buffer, &_index); 5103 willing=readLittleEndianBool(); 5104 trader=varlong.decode(_buffer, &_index); 5105 player=varlong.decode(_buffer, &_index); 5106 uint zlcxe5bu=varuint.decode(_buffer, &_index); displayName=readString(zlcxe5bu); 5107 offers=_buffer[_index..$].dup; _index=_buffer.length; 5108 } 5109 5110 public static pure nothrow @safe UpdateTrade fromBuffer(bool readId=true)(ubyte[] buffer) { 5111 UpdateTrade ret = new UpdateTrade(); 5112 ret._buffer = buffer; 5113 ret.decode!readId(); 5114 return ret; 5115 } 5116 5117 public override string toString() { 5118 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) ~ ")"; 5119 } 5120 5121 } 5122 5123 class UpdateEquip : Buffer { 5124 5125 public enum uint ID = 81; 5126 5127 public enum bool CLIENTBOUND = true; 5128 public enum bool SERVERBOUND = false; 5129 5130 public enum string[] FIELDS = []; 5131 5132 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5133 _buffer.length = 0; 5134 static if(writeId){ writeBytes(varuint.encode(ID)); } 5135 return _buffer; 5136 } 5137 5138 public pure nothrow @safe void decode(bool readId=true)() { 5139 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5140 } 5141 5142 public static pure nothrow @safe UpdateEquip fromBuffer(bool readId=true)(ubyte[] buffer) { 5143 UpdateEquip ret = new UpdateEquip(); 5144 ret._buffer = buffer; 5145 ret.decode!readId(); 5146 return ret; 5147 } 5148 5149 public override string toString() { 5150 return "UpdateEquip()"; 5151 } 5152 5153 } 5154 5155 class ResourcePackDataInfo : Buffer { 5156 5157 public enum uint ID = 82; 5158 5159 public enum bool CLIENTBOUND = true; 5160 public enum bool SERVERBOUND = false; 5161 5162 public enum string[] FIELDS = ["id", "maxChunkSize", "chunkCount", "compressedPackSize", "sha256"]; 5163 5164 public string id; 5165 public uint maxChunkSize; 5166 public uint chunkCount; 5167 public ulong compressedPackSize; 5168 public string sha256; 5169 5170 public pure nothrow @safe @nogc this() {} 5171 5172 public pure nothrow @safe @nogc this(string id, uint maxChunkSize=uint.init, uint chunkCount=uint.init, ulong compressedPackSize=ulong.init, string sha256=string.init) { 5173 this.id = id; 5174 this.maxChunkSize = maxChunkSize; 5175 this.chunkCount = chunkCount; 5176 this.compressedPackSize = compressedPackSize; 5177 this.sha256 = sha256; 5178 } 5179 5180 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5181 _buffer.length = 0; 5182 static if(writeId){ writeBytes(varuint.encode(ID)); } 5183 writeBytes(varuint.encode(cast(uint)id.length)); writeString(id); 5184 writeLittleEndianUint(maxChunkSize); 5185 writeLittleEndianUint(chunkCount); 5186 writeLittleEndianUlong(compressedPackSize); 5187 writeBytes(varuint.encode(cast(uint)sha256.length)); writeString(sha256); 5188 return _buffer; 5189 } 5190 5191 public pure nothrow @safe void decode(bool readId=true)() { 5192 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5193 uint aq=varuint.decode(_buffer, &_index); id=readString(aq); 5194 maxChunkSize=readLittleEndianUint(); 5195 chunkCount=readLittleEndianUint(); 5196 compressedPackSize=readLittleEndianUlong(); 5197 uint chmu=varuint.decode(_buffer, &_index); sha256=readString(chmu); 5198 } 5199 5200 public static pure nothrow @safe ResourcePackDataInfo fromBuffer(bool readId=true)(ubyte[] buffer) { 5201 ResourcePackDataInfo ret = new ResourcePackDataInfo(); 5202 ret._buffer = buffer; 5203 ret.decode!readId(); 5204 return ret; 5205 } 5206 5207 public override string toString() { 5208 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) ~ ")"; 5209 } 5210 5211 } 5212 5213 class ResourcePackChunkData : Buffer { 5214 5215 public enum uint ID = 83; 5216 5217 public enum bool CLIENTBOUND = true; 5218 public enum bool SERVERBOUND = false; 5219 5220 public enum string[] FIELDS = ["id", "chunkIndex", "progress", "data"]; 5221 5222 public string id; 5223 public uint chunkIndex; 5224 public ulong progress; 5225 public ubyte[] data; 5226 5227 public pure nothrow @safe @nogc this() {} 5228 5229 public pure nothrow @safe @nogc this(string id, uint chunkIndex=uint.init, ulong progress=ulong.init, ubyte[] data=(ubyte[]).init) { 5230 this.id = id; 5231 this.chunkIndex = chunkIndex; 5232 this.progress = progress; 5233 this.data = data; 5234 } 5235 5236 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5237 _buffer.length = 0; 5238 static if(writeId){ writeBytes(varuint.encode(ID)); } 5239 writeBytes(varuint.encode(cast(uint)id.length)); writeString(id); 5240 writeLittleEndianUint(chunkIndex); 5241 writeLittleEndianUlong(progress); 5242 writeLittleEndianUint(cast(uint)data.length); writeBytes(data); 5243 return _buffer; 5244 } 5245 5246 public pure nothrow @safe void decode(bool readId=true)() { 5247 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5248 uint aq=varuint.decode(_buffer, &_index); id=readString(aq); 5249 chunkIndex=readLittleEndianUint(); 5250 progress=readLittleEndianUlong(); 5251 data.length=readLittleEndianUint(); if(_buffer.length>=_index+data.length){ data=_buffer[_index.._index+data.length].dup; _index+=data.length; } 5252 } 5253 5254 public static pure nothrow @safe ResourcePackChunkData fromBuffer(bool readId=true)(ubyte[] buffer) { 5255 ResourcePackChunkData ret = new ResourcePackChunkData(); 5256 ret._buffer = buffer; 5257 ret.decode!readId(); 5258 return ret; 5259 } 5260 5261 public override string toString() { 5262 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) ~ ")"; 5263 } 5264 5265 } 5266 5267 class ResourcePackChunkRequest : Buffer { 5268 5269 public enum uint ID = 84; 5270 5271 public enum bool CLIENTBOUND = false; 5272 public enum bool SERVERBOUND = true; 5273 5274 public enum string[] FIELDS = ["id", "chunkIndex"]; 5275 5276 public string id; 5277 public uint chunkIndex; 5278 5279 public pure nothrow @safe @nogc this() {} 5280 5281 public pure nothrow @safe @nogc this(string id, uint chunkIndex=uint.init) { 5282 this.id = id; 5283 this.chunkIndex = chunkIndex; 5284 } 5285 5286 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5287 _buffer.length = 0; 5288 static if(writeId){ writeBytes(varuint.encode(ID)); } 5289 writeBytes(varuint.encode(cast(uint)id.length)); writeString(id); 5290 writeLittleEndianUint(chunkIndex); 5291 return _buffer; 5292 } 5293 5294 public pure nothrow @safe void decode(bool readId=true)() { 5295 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5296 uint aq=varuint.decode(_buffer, &_index); id=readString(aq); 5297 chunkIndex=readLittleEndianUint(); 5298 } 5299 5300 public static pure nothrow @safe ResourcePackChunkRequest fromBuffer(bool readId=true)(ubyte[] buffer) { 5301 ResourcePackChunkRequest ret = new ResourcePackChunkRequest(); 5302 ret._buffer = buffer; 5303 ret.decode!readId(); 5304 return ret; 5305 } 5306 5307 public override string toString() { 5308 return "ResourcePackChunkRequest(id: " ~ std.conv.to!string(this.id) ~ ", chunkIndex: " ~ std.conv.to!string(this.chunkIndex) ~ ")"; 5309 } 5310 5311 } 5312 5313 class Transfer : Buffer { 5314 5315 public enum uint ID = 85; 5316 5317 public enum bool CLIENTBOUND = true; 5318 public enum bool SERVERBOUND = false; 5319 5320 public enum string[] FIELDS = ["ip", "port"]; 5321 5322 public string ip; 5323 public ushort port = 19132; 5324 5325 public pure nothrow @safe @nogc this() {} 5326 5327 public pure nothrow @safe @nogc this(string ip, ushort port=19132) { 5328 this.ip = ip; 5329 this.port = port; 5330 } 5331 5332 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5333 _buffer.length = 0; 5334 static if(writeId){ writeBytes(varuint.encode(ID)); } 5335 writeBytes(varuint.encode(cast(uint)ip.length)); writeString(ip); 5336 writeLittleEndianUshort(port); 5337 return _buffer; 5338 } 5339 5340 public pure nothrow @safe void decode(bool readId=true)() { 5341 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5342 uint aa=varuint.decode(_buffer, &_index); ip=readString(aa); 5343 port=readLittleEndianUshort(); 5344 } 5345 5346 public static pure nothrow @safe Transfer fromBuffer(bool readId=true)(ubyte[] buffer) { 5347 Transfer ret = new Transfer(); 5348 ret._buffer = buffer; 5349 ret.decode!readId(); 5350 return ret; 5351 } 5352 5353 public override string toString() { 5354 return "Transfer(ip: " ~ std.conv.to!string(this.ip) ~ ", port: " ~ std.conv.to!string(this.port) ~ ")"; 5355 } 5356 5357 } 5358 5359 class PlaySound : Buffer { 5360 5361 public enum uint ID = 86; 5362 5363 public enum bool CLIENTBOUND = true; 5364 public enum bool SERVERBOUND = false; 5365 5366 public enum string[] FIELDS = ["name", "position", "volume", "pitch"]; 5367 5368 public string name; 5369 public sul.protocol.bedrock160.types.BlockPosition position; 5370 public float volume; 5371 public float pitch; 5372 5373 public pure nothrow @safe @nogc this() {} 5374 5375 public pure nothrow @safe @nogc this(string name, sul.protocol.bedrock160.types.BlockPosition position=sul.protocol.bedrock160.types.BlockPosition.init, float volume=float.init, float pitch=float.init) { 5376 this.name = name; 5377 this.position = position; 5378 this.volume = volume; 5379 this.pitch = pitch; 5380 } 5381 5382 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5383 _buffer.length = 0; 5384 static if(writeId){ writeBytes(varuint.encode(ID)); } 5385 writeBytes(varuint.encode(cast(uint)name.length)); writeString(name); 5386 position.encode(bufferInstance); 5387 writeLittleEndianFloat(volume); 5388 writeLittleEndianFloat(pitch); 5389 return _buffer; 5390 } 5391 5392 public pure nothrow @safe void decode(bool readId=true)() { 5393 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5394 uint bfz=varuint.decode(_buffer, &_index); name=readString(bfz); 5395 position.decode(bufferInstance); 5396 volume=readLittleEndianFloat(); 5397 pitch=readLittleEndianFloat(); 5398 } 5399 5400 public static pure nothrow @safe PlaySound fromBuffer(bool readId=true)(ubyte[] buffer) { 5401 PlaySound ret = new PlaySound(); 5402 ret._buffer = buffer; 5403 ret.decode!readId(); 5404 return ret; 5405 } 5406 5407 public override string toString() { 5408 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) ~ ")"; 5409 } 5410 5411 } 5412 5413 class StopSound : Buffer { 5414 5415 public enum uint ID = 87; 5416 5417 public enum bool CLIENTBOUND = true; 5418 public enum bool SERVERBOUND = false; 5419 5420 public enum string[] FIELDS = ["name", "stopAll"]; 5421 5422 public string name; 5423 public bool stopAll; 5424 5425 public pure nothrow @safe @nogc this() {} 5426 5427 public pure nothrow @safe @nogc this(string name, bool stopAll=bool.init) { 5428 this.name = name; 5429 this.stopAll = stopAll; 5430 } 5431 5432 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5433 _buffer.length = 0; 5434 static if(writeId){ writeBytes(varuint.encode(ID)); } 5435 writeBytes(varuint.encode(cast(uint)name.length)); writeString(name); 5436 writeLittleEndianBool(stopAll); 5437 return _buffer; 5438 } 5439 5440 public pure nothrow @safe void decode(bool readId=true)() { 5441 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5442 uint bfz=varuint.decode(_buffer, &_index); name=readString(bfz); 5443 stopAll=readLittleEndianBool(); 5444 } 5445 5446 public static pure nothrow @safe StopSound fromBuffer(bool readId=true)(ubyte[] buffer) { 5447 StopSound ret = new StopSound(); 5448 ret._buffer = buffer; 5449 ret.decode!readId(); 5450 return ret; 5451 } 5452 5453 public override string toString() { 5454 return "StopSound(name: " ~ std.conv.to!string(this.name) ~ ", stopAll: " ~ std.conv.to!string(this.stopAll) ~ ")"; 5455 } 5456 5457 } 5458 5459 class SetTitle : Buffer { 5460 5461 public enum uint ID = 88; 5462 5463 public enum bool CLIENTBOUND = true; 5464 public enum bool SERVERBOUND = false; 5465 5466 // action 5467 public enum int HIDE = 0; 5468 public enum int RESET = 1; 5469 public enum int SET_TITLE = 2; 5470 public enum int SET_SUBTITLE = 3; 5471 public enum int SET_ACTION_BAR = 4; 5472 public enum int SET_TIMINGS = 5; 5473 5474 public enum string[] FIELDS = ["action", "text", "fadeIn", "stay", "fadeOut"]; 5475 5476 public int action; 5477 public string text; 5478 public int fadeIn; 5479 public int stay; 5480 public int fadeOut; 5481 5482 public pure nothrow @safe @nogc this() {} 5483 5484 public pure nothrow @safe @nogc this(int action, string text=string.init, int fadeIn=int.init, int stay=int.init, int fadeOut=int.init) { 5485 this.action = action; 5486 this.text = text; 5487 this.fadeIn = fadeIn; 5488 this.stay = stay; 5489 this.fadeOut = fadeOut; 5490 } 5491 5492 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5493 _buffer.length = 0; 5494 static if(writeId){ writeBytes(varuint.encode(ID)); } 5495 writeBytes(varint.encode(action)); 5496 writeBytes(varuint.encode(cast(uint)text.length)); writeString(text); 5497 writeBytes(varint.encode(fadeIn)); 5498 writeBytes(varint.encode(stay)); 5499 writeBytes(varint.encode(fadeOut)); 5500 return _buffer; 5501 } 5502 5503 public pure nothrow @safe void decode(bool readId=true)() { 5504 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5505 action=varint.decode(_buffer, &_index); 5506 uint dvd=varuint.decode(_buffer, &_index); text=readString(dvd); 5507 fadeIn=varint.decode(_buffer, &_index); 5508 stay=varint.decode(_buffer, &_index); 5509 fadeOut=varint.decode(_buffer, &_index); 5510 } 5511 5512 public static pure nothrow @safe SetTitle fromBuffer(bool readId=true)(ubyte[] buffer) { 5513 SetTitle ret = new SetTitle(); 5514 ret._buffer = buffer; 5515 ret.decode!readId(); 5516 return ret; 5517 } 5518 5519 public override string toString() { 5520 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) ~ ")"; 5521 } 5522 5523 } 5524 5525 class AddBehaviorTree : Buffer { 5526 5527 public enum uint ID = 89; 5528 5529 public enum bool CLIENTBOUND = true; 5530 public enum bool SERVERBOUND = false; 5531 5532 public enum string[] FIELDS = ["unknown0"]; 5533 5534 public string unknown0; 5535 5536 public pure nothrow @safe @nogc this() {} 5537 5538 public pure nothrow @safe @nogc this(string unknown0) { 5539 this.unknown0 = unknown0; 5540 } 5541 5542 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5543 _buffer.length = 0; 5544 static if(writeId){ writeBytes(varuint.encode(ID)); } 5545 writeBytes(varuint.encode(cast(uint)unknown0.length)); writeString(unknown0); 5546 return _buffer; 5547 } 5548 5549 public pure nothrow @safe void decode(bool readId=true)() { 5550 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5551 uint d5b9ba=varuint.decode(_buffer, &_index); unknown0=readString(d5b9ba); 5552 } 5553 5554 public static pure nothrow @safe AddBehaviorTree fromBuffer(bool readId=true)(ubyte[] buffer) { 5555 AddBehaviorTree ret = new AddBehaviorTree(); 5556 ret._buffer = buffer; 5557 ret.decode!readId(); 5558 return ret; 5559 } 5560 5561 public override string toString() { 5562 return "AddBehaviorTree(unknown0: " ~ std.conv.to!string(this.unknown0) ~ ")"; 5563 } 5564 5565 } 5566 5567 class StructureBlockUpdate : Buffer { 5568 5569 public enum uint ID = 90; 5570 5571 public enum bool CLIENTBOUND = true; 5572 public enum bool SERVERBOUND = false; 5573 5574 public enum string[] FIELDS = []; 5575 5576 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5577 _buffer.length = 0; 5578 static if(writeId){ writeBytes(varuint.encode(ID)); } 5579 return _buffer; 5580 } 5581 5582 public pure nothrow @safe void decode(bool readId=true)() { 5583 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5584 } 5585 5586 public static pure nothrow @safe StructureBlockUpdate fromBuffer(bool readId=true)(ubyte[] buffer) { 5587 StructureBlockUpdate ret = new StructureBlockUpdate(); 5588 ret._buffer = buffer; 5589 ret.decode!readId(); 5590 return ret; 5591 } 5592 5593 public override string toString() { 5594 return "StructureBlockUpdate()"; 5595 } 5596 5597 } 5598 5599 class ShowStoreOffer : Buffer { 5600 5601 public enum uint ID = 91; 5602 5603 public enum bool CLIENTBOUND = true; 5604 public enum bool SERVERBOUND = false; 5605 5606 public enum string[] FIELDS = ["unknown0", "unknown1", "unknown2"]; 5607 5608 public string unknown0; 5609 public bool unknown1; 5610 public string unknown2; 5611 5612 public pure nothrow @safe @nogc this() {} 5613 5614 public pure nothrow @safe @nogc this(string unknown0, bool unknown1=bool.init, string unknown2=string.init) { 5615 this.unknown0 = unknown0; 5616 this.unknown1 = unknown1; 5617 this.unknown2 = unknown2; 5618 } 5619 5620 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5621 _buffer.length = 0; 5622 static if(writeId){ writeBytes(varuint.encode(ID)); } 5623 writeBytes(varuint.encode(cast(uint)unknown0.length)); writeString(unknown0); 5624 writeLittleEndianBool(unknown1); 5625 writeBytes(varuint.encode(cast(uint)unknown2.length)); writeString(unknown2); 5626 return _buffer; 5627 } 5628 5629 public pure nothrow @safe void decode(bool readId=true)() { 5630 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5631 uint d5b9ba=varuint.decode(_buffer, &_index); unknown0=readString(d5b9ba); 5632 unknown1=readLittleEndianBool(); 5633 uint d5b9bi=varuint.decode(_buffer, &_index); unknown2=readString(d5b9bi); 5634 } 5635 5636 public static pure nothrow @safe ShowStoreOffer fromBuffer(bool readId=true)(ubyte[] buffer) { 5637 ShowStoreOffer ret = new ShowStoreOffer(); 5638 ret._buffer = buffer; 5639 ret.decode!readId(); 5640 return ret; 5641 } 5642 5643 public override string toString() { 5644 return "ShowStoreOffer(unknown0: " ~ std.conv.to!string(this.unknown0) ~ ", unknown1: " ~ std.conv.to!string(this.unknown1) ~ ", unknown2: " ~ std.conv.to!string(this.unknown2) ~ ")"; 5645 } 5646 5647 } 5648 5649 class PurchaseReceipt : Buffer { 5650 5651 public enum uint ID = 92; 5652 5653 public enum bool CLIENTBOUND = false; 5654 public enum bool SERVERBOUND = true; 5655 5656 public enum string[] FIELDS = ["unknown0"]; 5657 5658 public string[] unknown0; 5659 5660 public pure nothrow @safe @nogc this() {} 5661 5662 public pure nothrow @safe @nogc this(string[] unknown0) { 5663 this.unknown0 = unknown0; 5664 } 5665 5666 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5667 _buffer.length = 0; 5668 static if(writeId){ writeBytes(varuint.encode(ID)); } 5669 writeBytes(varuint.encode(cast(uint)unknown0.length)); foreach(d5b9ba;unknown0){ writeBytes(varuint.encode(cast(uint)d5b9ba.length)); writeString(d5b9ba); } 5670 return _buffer; 5671 } 5672 5673 public pure nothrow @safe void decode(bool readId=true)() { 5674 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5675 unknown0.length=varuint.decode(_buffer, &_index); foreach(ref d5b9ba;unknown0){ uint zvoj=varuint.decode(_buffer, &_index); d5b9ba=readString(zvoj); } 5676 } 5677 5678 public static pure nothrow @safe PurchaseReceipt fromBuffer(bool readId=true)(ubyte[] buffer) { 5679 PurchaseReceipt ret = new PurchaseReceipt(); 5680 ret._buffer = buffer; 5681 ret.decode!readId(); 5682 return ret; 5683 } 5684 5685 public override string toString() { 5686 return "PurchaseReceipt(unknown0: " ~ std.conv.to!string(this.unknown0) ~ ")"; 5687 } 5688 5689 } 5690 5691 class PlayerSkin : Buffer { 5692 5693 public enum uint ID = 93; 5694 5695 public enum bool CLIENTBOUND = true; 5696 public enum bool SERVERBOUND = false; 5697 5698 public enum string[] FIELDS = ["uuid", "skinId", "skinName", "unknown3", "skinData", "capeData", "geometryModel", "geometryData"]; 5699 5700 public sul.protocol.bedrock160.types.McpeUuid uuid; 5701 public string skinId; 5702 public string skinName; 5703 public string unknown3; 5704 public ubyte[] skinData; 5705 public ubyte[] capeData; 5706 public string geometryModel; 5707 public ubyte[] geometryData; 5708 5709 public pure nothrow @safe @nogc this() {} 5710 5711 public pure nothrow @safe @nogc this(sul.protocol.bedrock160.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) { 5712 this.uuid = uuid; 5713 this.skinId = skinId; 5714 this.skinName = skinName; 5715 this.unknown3 = unknown3; 5716 this.skinData = skinData; 5717 this.capeData = capeData; 5718 this.geometryModel = geometryModel; 5719 this.geometryData = geometryData; 5720 } 5721 5722 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5723 _buffer.length = 0; 5724 static if(writeId){ writeBytes(varuint.encode(ID)); } 5725 uuid.encode(bufferInstance); 5726 writeBytes(varuint.encode(cast(uint)skinId.length)); writeString(skinId); 5727 writeBytes(varuint.encode(cast(uint)skinName.length)); writeString(skinName); 5728 writeBytes(varuint.encode(cast(uint)unknown3.length)); writeString(unknown3); 5729 writeBytes(varuint.encode(cast(uint)skinData.length)); writeBytes(skinData); 5730 writeBytes(varuint.encode(cast(uint)capeData.length)); writeBytes(capeData); 5731 writeBytes(varuint.encode(cast(uint)geometryModel.length)); writeString(geometryModel); 5732 writeBytes(varuint.encode(cast(uint)geometryData.length)); writeBytes(geometryData); 5733 return _buffer; 5734 } 5735 5736 public pure nothrow @safe void decode(bool readId=true)() { 5737 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5738 uuid.decode(bufferInstance); 5739 uint ctbl=varuint.decode(_buffer, &_index); skinId=readString(ctbl); 5740 uint ctb5bu=varuint.decode(_buffer, &_index); skinName=readString(ctb5bu); 5741 uint d5b9bm=varuint.decode(_buffer, &_index); unknown3=readString(d5b9bm); 5742 skinData.length=varuint.decode(_buffer, &_index); if(_buffer.length>=_index+skinData.length){ skinData=_buffer[_index.._index+skinData.length].dup; _index+=skinData.length; } 5743 capeData.length=varuint.decode(_buffer, &_index); if(_buffer.length>=_index+capeData.length){ capeData=_buffer[_index.._index+capeData.length].dup; _index+=capeData.length; } 5744 uint zvbvclbr=varuint.decode(_buffer, &_index); geometryModel=readString(zvbvclbr); 5745 geometryData.length=varuint.decode(_buffer, &_index); if(_buffer.length>=_index+geometryData.length){ geometryData=_buffer[_index.._index+geometryData.length].dup; _index+=geometryData.length; } 5746 } 5747 5748 public static pure nothrow @safe PlayerSkin fromBuffer(bool readId=true)(ubyte[] buffer) { 5749 PlayerSkin ret = new PlayerSkin(); 5750 ret._buffer = buffer; 5751 ret.decode!readId(); 5752 return ret; 5753 } 5754 5755 public override string toString() { 5756 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) ~ ")"; 5757 } 5758 5759 } 5760 5761 class SubClientLogin : Buffer { 5762 5763 public enum uint ID = 94; 5764 5765 public enum bool CLIENTBOUND = true; 5766 public enum bool SERVERBOUND = false; 5767 5768 public enum string[] FIELDS = []; 5769 5770 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5771 _buffer.length = 0; 5772 static if(writeId){ writeBytes(varuint.encode(ID)); } 5773 return _buffer; 5774 } 5775 5776 public pure nothrow @safe void decode(bool readId=true)() { 5777 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5778 } 5779 5780 public static pure nothrow @safe SubClientLogin fromBuffer(bool readId=true)(ubyte[] buffer) { 5781 SubClientLogin ret = new SubClientLogin(); 5782 ret._buffer = buffer; 5783 ret.decode!readId(); 5784 return ret; 5785 } 5786 5787 public override string toString() { 5788 return "SubClientLogin()"; 5789 } 5790 5791 } 5792 5793 class InitiateWebSocketConnection : Buffer { 5794 5795 public enum uint ID = 95; 5796 5797 public enum bool CLIENTBOUND = false; 5798 public enum bool SERVERBOUND = false; 5799 5800 public enum string[] FIELDS = ["unknown0"]; 5801 5802 public string unknown0; 5803 5804 public pure nothrow @safe @nogc this() {} 5805 5806 public pure nothrow @safe @nogc this(string unknown0) { 5807 this.unknown0 = unknown0; 5808 } 5809 5810 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5811 _buffer.length = 0; 5812 static if(writeId){ writeBytes(varuint.encode(ID)); } 5813 writeBytes(varuint.encode(cast(uint)unknown0.length)); writeString(unknown0); 5814 return _buffer; 5815 } 5816 5817 public pure nothrow @safe void decode(bool readId=true)() { 5818 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5819 uint d5b9ba=varuint.decode(_buffer, &_index); unknown0=readString(d5b9ba); 5820 } 5821 5822 public static pure nothrow @safe InitiateWebSocketConnection fromBuffer(bool readId=true)(ubyte[] buffer) { 5823 InitiateWebSocketConnection ret = new InitiateWebSocketConnection(); 5824 ret._buffer = buffer; 5825 ret.decode!readId(); 5826 return ret; 5827 } 5828 5829 public override string toString() { 5830 return "InitiateWebSocketConnection(unknown0: " ~ std.conv.to!string(this.unknown0) ~ ")"; 5831 } 5832 5833 } 5834 5835 class SetLastHurtBy : Buffer { 5836 5837 public enum uint ID = 96; 5838 5839 public enum bool CLIENTBOUND = true; 5840 public enum bool SERVERBOUND = false; 5841 5842 public enum string[] FIELDS = ["unknown0"]; 5843 5844 public int unknown0; 5845 5846 public pure nothrow @safe @nogc this() {} 5847 5848 public pure nothrow @safe @nogc this(int unknown0) { 5849 this.unknown0 = unknown0; 5850 } 5851 5852 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5853 _buffer.length = 0; 5854 static if(writeId){ writeBytes(varuint.encode(ID)); } 5855 writeBytes(varint.encode(unknown0)); 5856 return _buffer; 5857 } 5858 5859 public pure nothrow @safe void decode(bool readId=true)() { 5860 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5861 unknown0=varint.decode(_buffer, &_index); 5862 } 5863 5864 public static pure nothrow @safe SetLastHurtBy fromBuffer(bool readId=true)(ubyte[] buffer) { 5865 SetLastHurtBy ret = new SetLastHurtBy(); 5866 ret._buffer = buffer; 5867 ret.decode!readId(); 5868 return ret; 5869 } 5870 5871 public override string toString() { 5872 return "SetLastHurtBy(unknown0: " ~ std.conv.to!string(this.unknown0) ~ ")"; 5873 } 5874 5875 } 5876 5877 class BookEdit : Buffer { 5878 5879 public enum uint ID = 97; 5880 5881 public enum bool CLIENTBOUND = true; 5882 public enum bool SERVERBOUND = true; 5883 5884 public enum string[] FIELDS = ["type", "slot"]; 5885 5886 public ubyte type; 5887 public ubyte slot; 5888 5889 public pure nothrow @safe @nogc this() {} 5890 5891 public pure nothrow @safe @nogc this(ubyte type, ubyte slot=ubyte.init) { 5892 this.type = type; 5893 this.slot = slot; 5894 } 5895 5896 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5897 _buffer.length = 0; 5898 static if(writeId){ writeBytes(varuint.encode(ID)); } 5899 writeLittleEndianUbyte(type); 5900 writeLittleEndianUbyte(slot); 5901 return _buffer; 5902 } 5903 5904 public pure nothrow @safe void decode(bool readId=true)() { 5905 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 5906 type=readLittleEndianUbyte(); 5907 slot=readLittleEndianUbyte(); 5908 } 5909 5910 public static pure nothrow @safe BookEdit fromBuffer(bool readId=true)(ubyte[] buffer) { 5911 BookEdit ret = new BookEdit(); 5912 ret._buffer = buffer; 5913 ret.decode!readId(); 5914 return ret; 5915 } 5916 5917 public override string toString() { 5918 return "BookEdit(type: " ~ std.conv.to!string(this.type) ~ ", slot: " ~ std.conv.to!string(this.slot) ~ ")"; 5919 } 5920 5921 alias _encode = encode; 5922 5923 enum string variantField = "type"; 5924 5925 alias Variants = TypeTuple!(ReplacePage, AddPage, DeletePage, SwapPages, Sign); 5926 5927 public class ReplacePage { 5928 5929 public enum typeof(type) TYPE = 0; 5930 5931 public enum string[] FIELDS = ["pageNumber", "unknown1", "unknown2"]; 5932 5933 public ubyte pageNumber; 5934 public string unknown1; 5935 public string unknown2; 5936 5937 public pure nothrow @safe @nogc this() {} 5938 5939 public pure nothrow @safe @nogc this(ubyte pageNumber, string unknown1=string.init, string unknown2=string.init) { 5940 this.pageNumber = pageNumber; 5941 this.unknown1 = unknown1; 5942 this.unknown2 = unknown2; 5943 } 5944 5945 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5946 type = 0; 5947 _encode!writeId(); 5948 writeLittleEndianUbyte(pageNumber); 5949 writeBytes(varuint.encode(cast(uint)unknown1.length)); writeString(unknown1); 5950 writeBytes(varuint.encode(cast(uint)unknown2.length)); writeString(unknown2); 5951 return _buffer; 5952 } 5953 5954 public pure nothrow @safe void decode() { 5955 pageNumber=readLittleEndianUbyte(); 5956 uint d5b9be=varuint.decode(_buffer, &_index); unknown1=readString(d5b9be); 5957 uint d5b9bi=varuint.decode(_buffer, &_index); unknown2=readString(d5b9bi); 5958 } 5959 5960 public override string toString() { 5961 return "BookEdit.ReplacePage(pageNumber: " ~ std.conv.to!string(this.pageNumber) ~ ", unknown1: " ~ std.conv.to!string(this.unknown1) ~ ", unknown2: " ~ std.conv.to!string(this.unknown2) ~ ")"; 5962 } 5963 5964 } 5965 5966 public class AddPage { 5967 5968 public enum typeof(type) TYPE = 1; 5969 5970 public enum string[] FIELDS = ["pageNumber", "unknown1", "unknown2"]; 5971 5972 public ubyte pageNumber; 5973 public string unknown1; 5974 public string unknown2; 5975 5976 public pure nothrow @safe @nogc this() {} 5977 5978 public pure nothrow @safe @nogc this(ubyte pageNumber, string unknown1=string.init, string unknown2=string.init) { 5979 this.pageNumber = pageNumber; 5980 this.unknown1 = unknown1; 5981 this.unknown2 = unknown2; 5982 } 5983 5984 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 5985 type = 1; 5986 _encode!writeId(); 5987 writeLittleEndianUbyte(pageNumber); 5988 writeBytes(varuint.encode(cast(uint)unknown1.length)); writeString(unknown1); 5989 writeBytes(varuint.encode(cast(uint)unknown2.length)); writeString(unknown2); 5990 return _buffer; 5991 } 5992 5993 public pure nothrow @safe void decode() { 5994 pageNumber=readLittleEndianUbyte(); 5995 uint d5b9be=varuint.decode(_buffer, &_index); unknown1=readString(d5b9be); 5996 uint d5b9bi=varuint.decode(_buffer, &_index); unknown2=readString(d5b9bi); 5997 } 5998 5999 public override string toString() { 6000 return "BookEdit.AddPage(pageNumber: " ~ std.conv.to!string(this.pageNumber) ~ ", unknown1: " ~ std.conv.to!string(this.unknown1) ~ ", unknown2: " ~ std.conv.to!string(this.unknown2) ~ ")"; 6001 } 6002 6003 } 6004 6005 public class DeletePage { 6006 6007 public enum typeof(type) TYPE = 2; 6008 6009 public enum string[] FIELDS = ["pageNumber"]; 6010 6011 public ubyte pageNumber; 6012 6013 public pure nothrow @safe @nogc this() {} 6014 6015 public pure nothrow @safe @nogc this(ubyte pageNumber) { 6016 this.pageNumber = pageNumber; 6017 } 6018 6019 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 6020 type = 2; 6021 _encode!writeId(); 6022 writeLittleEndianUbyte(pageNumber); 6023 return _buffer; 6024 } 6025 6026 public pure nothrow @safe void decode() { 6027 pageNumber=readLittleEndianUbyte(); 6028 } 6029 6030 public override string toString() { 6031 return "BookEdit.DeletePage(pageNumber: " ~ std.conv.to!string(this.pageNumber) ~ ")"; 6032 } 6033 6034 } 6035 6036 public class SwapPages { 6037 6038 public enum typeof(type) TYPE = 3; 6039 6040 public enum string[] FIELDS = ["page1", "page2"]; 6041 6042 public ubyte page1; 6043 public ubyte page2; 6044 6045 public pure nothrow @safe @nogc this() {} 6046 6047 public pure nothrow @safe @nogc this(ubyte page1, ubyte page2=ubyte.init) { 6048 this.page1 = page1; 6049 this.page2 = page2; 6050 } 6051 6052 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 6053 type = 3; 6054 _encode!writeId(); 6055 writeLittleEndianUbyte(page1); 6056 writeLittleEndianUbyte(page2); 6057 return _buffer; 6058 } 6059 6060 public pure nothrow @safe void decode() { 6061 page1=readLittleEndianUbyte(); 6062 page2=readLittleEndianUbyte(); 6063 } 6064 6065 public override string toString() { 6066 return "BookEdit.SwapPages(page1: " ~ std.conv.to!string(this.page1) ~ ", page2: " ~ std.conv.to!string(this.page2) ~ ")"; 6067 } 6068 6069 } 6070 6071 public class Sign { 6072 6073 public enum typeof(type) TYPE = 4; 6074 6075 public enum string[] FIELDS = ["title", "author"]; 6076 6077 public string title; 6078 public string author; 6079 6080 public pure nothrow @safe @nogc this() {} 6081 6082 public pure nothrow @safe @nogc this(string title, string author=string.init) { 6083 this.title = title; 6084 this.author = author; 6085 } 6086 6087 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 6088 type = 4; 6089 _encode!writeId(); 6090 writeBytes(varuint.encode(cast(uint)title.length)); writeString(title); 6091 writeBytes(varuint.encode(cast(uint)author.length)); writeString(author); 6092 return _buffer; 6093 } 6094 6095 public pure nothrow @safe void decode() { 6096 uint dlbu=varuint.decode(_buffer, &_index); title=readString(dlbu); 6097 uint yva9=varuint.decode(_buffer, &_index); author=readString(yva9); 6098 } 6099 6100 public override string toString() { 6101 return "BookEdit.Sign(title: " ~ std.conv.to!string(this.title) ~ ", author: " ~ std.conv.to!string(this.author) ~ ")"; 6102 } 6103 6104 } 6105 6106 } 6107 6108 class NpcRequest : Buffer { 6109 6110 public enum uint ID = 98; 6111 6112 public enum bool CLIENTBOUND = false; 6113 public enum bool SERVERBOUND = true; 6114 6115 public enum string[] FIELDS = ["entityId", "requestType", "command", "actionType"]; 6116 6117 public long entityId; 6118 public ubyte requestType; 6119 public string command; 6120 public ubyte actionType; 6121 6122 public pure nothrow @safe @nogc this() {} 6123 6124 public pure nothrow @safe @nogc this(long entityId, ubyte requestType=ubyte.init, string command=string.init, ubyte actionType=ubyte.init) { 6125 this.entityId = entityId; 6126 this.requestType = requestType; 6127 this.command = command; 6128 this.actionType = actionType; 6129 } 6130 6131 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 6132 _buffer.length = 0; 6133 static if(writeId){ writeBytes(varuint.encode(ID)); } 6134 writeBytes(varlong.encode(entityId)); 6135 writeLittleEndianUbyte(requestType); 6136 writeBytes(varuint.encode(cast(uint)command.length)); writeString(command); 6137 writeLittleEndianUbyte(actionType); 6138 return _buffer; 6139 } 6140 6141 public pure nothrow @safe void decode(bool readId=true)() { 6142 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 6143 entityId=varlong.decode(_buffer, &_index); 6144 requestType=readLittleEndianUbyte(); 6145 uint y9bfz=varuint.decode(_buffer, &_index); command=readString(y9bfz); 6146 actionType=readLittleEndianUbyte(); 6147 } 6148 6149 public static pure nothrow @safe NpcRequest fromBuffer(bool readId=true)(ubyte[] buffer) { 6150 NpcRequest ret = new NpcRequest(); 6151 ret._buffer = buffer; 6152 ret.decode!readId(); 6153 return ret; 6154 } 6155 6156 public override string toString() { 6157 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) ~ ")"; 6158 } 6159 6160 } 6161 6162 class PhotoTransfer : Buffer { 6163 6164 public enum uint ID = 99; 6165 6166 public enum bool CLIENTBOUND = false; 6167 public enum bool SERVERBOUND = true; 6168 6169 public enum string[] FIELDS = ["unknown0", "unknown1", "unknown2"]; 6170 6171 public string unknown0; 6172 public string unknown1; 6173 public string unknown2; 6174 6175 public pure nothrow @safe @nogc this() {} 6176 6177 public pure nothrow @safe @nogc this(string unknown0, string unknown1=string.init, string unknown2=string.init) { 6178 this.unknown0 = unknown0; 6179 this.unknown1 = unknown1; 6180 this.unknown2 = unknown2; 6181 } 6182 6183 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 6184 _buffer.length = 0; 6185 static if(writeId){ writeBytes(varuint.encode(ID)); } 6186 writeBytes(varuint.encode(cast(uint)unknown0.length)); writeString(unknown0); 6187 writeBytes(varuint.encode(cast(uint)unknown1.length)); writeString(unknown1); 6188 writeBytes(varuint.encode(cast(uint)unknown2.length)); writeString(unknown2); 6189 return _buffer; 6190 } 6191 6192 public pure nothrow @safe void decode(bool readId=true)() { 6193 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 6194 uint d5b9ba=varuint.decode(_buffer, &_index); unknown0=readString(d5b9ba); 6195 uint d5b9be=varuint.decode(_buffer, &_index); unknown1=readString(d5b9be); 6196 uint d5b9bi=varuint.decode(_buffer, &_index); unknown2=readString(d5b9bi); 6197 } 6198 6199 public static pure nothrow @safe PhotoTransfer fromBuffer(bool readId=true)(ubyte[] buffer) { 6200 PhotoTransfer ret = new PhotoTransfer(); 6201 ret._buffer = buffer; 6202 ret.decode!readId(); 6203 return ret; 6204 } 6205 6206 public override string toString() { 6207 return "PhotoTransfer(unknown0: " ~ std.conv.to!string(this.unknown0) ~ ", unknown1: " ~ std.conv.to!string(this.unknown1) ~ ", unknown2: " ~ std.conv.to!string(this.unknown2) ~ ")"; 6208 } 6209 6210 } 6211 6212 class ModalFormRequest : Buffer { 6213 6214 public enum uint ID = 100; 6215 6216 public enum bool CLIENTBOUND = true; 6217 public enum bool SERVERBOUND = false; 6218 6219 public enum string[] FIELDS = ["formId", "data"]; 6220 6221 public uint formId; 6222 public string data; 6223 6224 public pure nothrow @safe @nogc this() {} 6225 6226 public pure nothrow @safe @nogc this(uint formId, string data=string.init) { 6227 this.formId = formId; 6228 this.data = data; 6229 } 6230 6231 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 6232 _buffer.length = 0; 6233 static if(writeId){ writeBytes(varuint.encode(ID)); } 6234 writeBytes(varuint.encode(formId)); 6235 writeBytes(varuint.encode(cast(uint)data.length)); writeString(data); 6236 return _buffer; 6237 } 6238 6239 public pure nothrow @safe void decode(bool readId=true)() { 6240 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 6241 formId=varuint.decode(_buffer, &_index); 6242 uint zfy=varuint.decode(_buffer, &_index); data=readString(zfy); 6243 } 6244 6245 public static pure nothrow @safe ModalFormRequest fromBuffer(bool readId=true)(ubyte[] buffer) { 6246 ModalFormRequest ret = new ModalFormRequest(); 6247 ret._buffer = buffer; 6248 ret.decode!readId(); 6249 return ret; 6250 } 6251 6252 public override string toString() { 6253 return "ModalFormRequest(formId: " ~ std.conv.to!string(this.formId) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")"; 6254 } 6255 6256 } 6257 6258 class ModalFormResponse : Buffer { 6259 6260 public enum uint ID = 101; 6261 6262 public enum bool CLIENTBOUND = true; 6263 public enum bool SERVERBOUND = false; 6264 6265 public enum string[] FIELDS = ["formId", "data"]; 6266 6267 public uint formId; 6268 public string data; 6269 6270 public pure nothrow @safe @nogc this() {} 6271 6272 public pure nothrow @safe @nogc this(uint formId, string data=string.init) { 6273 this.formId = formId; 6274 this.data = data; 6275 } 6276 6277 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 6278 _buffer.length = 0; 6279 static if(writeId){ writeBytes(varuint.encode(ID)); } 6280 writeBytes(varuint.encode(formId)); 6281 writeBytes(varuint.encode(cast(uint)data.length)); writeString(data); 6282 return _buffer; 6283 } 6284 6285 public pure nothrow @safe void decode(bool readId=true)() { 6286 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 6287 formId=varuint.decode(_buffer, &_index); 6288 uint zfy=varuint.decode(_buffer, &_index); data=readString(zfy); 6289 } 6290 6291 public static pure nothrow @safe ModalFormResponse fromBuffer(bool readId=true)(ubyte[] buffer) { 6292 ModalFormResponse ret = new ModalFormResponse(); 6293 ret._buffer = buffer; 6294 ret.decode!readId(); 6295 return ret; 6296 } 6297 6298 public override string toString() { 6299 return "ModalFormResponse(formId: " ~ std.conv.to!string(this.formId) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")"; 6300 } 6301 6302 } 6303 6304 class ServerSettingsRequest : Buffer { 6305 6306 public enum uint ID = 102; 6307 6308 public enum bool CLIENTBOUND = false; 6309 public enum bool SERVERBOUND = true; 6310 6311 public enum string[] FIELDS = []; 6312 6313 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 6314 _buffer.length = 0; 6315 static if(writeId){ writeBytes(varuint.encode(ID)); } 6316 return _buffer; 6317 } 6318 6319 public pure nothrow @safe void decode(bool readId=true)() { 6320 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 6321 } 6322 6323 public static pure nothrow @safe ServerSettingsRequest fromBuffer(bool readId=true)(ubyte[] buffer) { 6324 ServerSettingsRequest ret = new ServerSettingsRequest(); 6325 ret._buffer = buffer; 6326 ret.decode!readId(); 6327 return ret; 6328 } 6329 6330 public override string toString() { 6331 return "ServerSettingsRequest()"; 6332 } 6333 6334 } 6335 6336 class ServerSettingsResponse : Buffer { 6337 6338 public enum uint ID = 103; 6339 6340 public enum bool CLIENTBOUND = true; 6341 public enum bool SERVERBOUND = false; 6342 6343 public enum string[] FIELDS = ["formId", "data"]; 6344 6345 public uint formId; 6346 public string data; 6347 6348 public pure nothrow @safe @nogc this() {} 6349 6350 public pure nothrow @safe @nogc this(uint formId, string data=string.init) { 6351 this.formId = formId; 6352 this.data = data; 6353 } 6354 6355 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 6356 _buffer.length = 0; 6357 static if(writeId){ writeBytes(varuint.encode(ID)); } 6358 writeBytes(varuint.encode(formId)); 6359 writeBytes(varuint.encode(cast(uint)data.length)); writeString(data); 6360 return _buffer; 6361 } 6362 6363 public pure nothrow @safe void decode(bool readId=true)() { 6364 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 6365 formId=varuint.decode(_buffer, &_index); 6366 uint zfy=varuint.decode(_buffer, &_index); data=readString(zfy); 6367 } 6368 6369 public static pure nothrow @safe ServerSettingsResponse fromBuffer(bool readId=true)(ubyte[] buffer) { 6370 ServerSettingsResponse ret = new ServerSettingsResponse(); 6371 ret._buffer = buffer; 6372 ret.decode!readId(); 6373 return ret; 6374 } 6375 6376 public override string toString() { 6377 return "ServerSettingsResponse(formId: " ~ std.conv.to!string(this.formId) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")"; 6378 } 6379 6380 } 6381 6382 class ShowProfile : Buffer { 6383 6384 public enum uint ID = 104; 6385 6386 public enum bool CLIENTBOUND = true; 6387 public enum bool SERVERBOUND = false; 6388 6389 public enum string[] FIELDS = []; 6390 6391 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 6392 _buffer.length = 0; 6393 static if(writeId){ writeBytes(varuint.encode(ID)); } 6394 return _buffer; 6395 } 6396 6397 public pure nothrow @safe void decode(bool readId=true)() { 6398 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 6399 } 6400 6401 public static pure nothrow @safe ShowProfile fromBuffer(bool readId=true)(ubyte[] buffer) { 6402 ShowProfile ret = new ShowProfile(); 6403 ret._buffer = buffer; 6404 ret.decode!readId(); 6405 return ret; 6406 } 6407 6408 public override string toString() { 6409 return "ShowProfile()"; 6410 } 6411 6412 } 6413 6414 class SetDefaultGameType : Buffer { 6415 6416 public enum uint ID = 105; 6417 6418 public enum bool CLIENTBOUND = true; 6419 public enum bool SERVERBOUND = false; 6420 6421 // game type 6422 public enum uint SURVIVAL = 0; 6423 public enum uint CREATIVE = 1; 6424 public enum uint ADVENTURE = 2; 6425 6426 public enum string[] FIELDS = ["gameType"]; 6427 6428 public uint gameType; 6429 6430 public pure nothrow @safe @nogc this() {} 6431 6432 public pure nothrow @safe @nogc this(uint gameType) { 6433 this.gameType = gameType; 6434 } 6435 6436 public pure nothrow @safe ubyte[] encode(bool writeId=true)() { 6437 _buffer.length = 0; 6438 static if(writeId){ writeBytes(varuint.encode(ID)); } 6439 writeBytes(varuint.encode(gameType)); 6440 return _buffer; 6441 } 6442 6443 public pure nothrow @safe void decode(bool readId=true)() { 6444 static if(readId){ uint _id; _id=varuint.decode(_buffer, &_index); } 6445 gameType=varuint.decode(_buffer, &_index); 6446 } 6447 6448 public static pure nothrow @safe SetDefaultGameType fromBuffer(bool readId=true)(ubyte[] buffer) { 6449 SetDefaultGameType ret = new SetDefaultGameType(); 6450 ret._buffer = buffer; 6451 ret.decode!readId(); 6452 return ret; 6453 } 6454 6455 public override string toString() { 6456 return "SetDefaultGameType(gameType: " ~ std.conv.to!string(this.gameType) ~ ")"; 6457 } 6458 6459 } 6460