1 /* 2 * This file has been automatically generated by Soupply and released under the MIT license. 3 * Generated from data/bedrock282.xml 4 */ 5 module soupply.bedrock282.types; 6 7 static import std.conv; 8 import xpacket; 9 10 import xserial.serial : EndianType, serializeLength, deserializeLength; 11 12 import xbuffer.memory : xalloc, xfree; 13 14 import soupply.util; 15 import soupply.bedrock282.metadata; 16 17 struct PackWithSize 18 { 19 20 enum string[] __fields = ["id", "version_", "size", "unknown3", "unknown4"]; 21 22 string id; 23 string version_; 24 ulong size; 25 string unknown3; 26 string unknown4; 27 28 mixin Make!(Endian.littleEndian, varuint); 29 30 string toString() 31 { 32 return "PackWithSize(id: " ~ std.conv.to!string(this.id) ~ ", version_: " ~ std.conv.to!string(this.version_) ~ ", size: " ~ std.conv.to!string(this.size) ~ ", unknown3: " ~ std.conv.to!string(this.unknown3) ~ ", unknown4: " ~ std.conv.to!string(this.unknown4) ~ ")"; 33 } 34 35 } 36 37 struct Pack 38 { 39 40 enum string[] __fields = ["id", "version_", "unknown2"]; 41 42 string id; 43 string version_; 44 string unknown2; 45 46 mixin Make!(Endian.littleEndian, varuint); 47 48 string toString() 49 { 50 return "Pack(id: " ~ std.conv.to!string(this.id) ~ ", version_: " ~ std.conv.to!string(this.version_) ~ ", unknown2: " ~ std.conv.to!string(this.unknown2) ~ ")"; 51 } 52 53 } 54 55 struct Slot 56 { 57 58 enum string[] __fields = ["id", "metaAndCount", "nbt", "canPlaceOn", "canDestroy"]; 59 60 @Var int id; 61 @Condition("id>0") @Var int metaAndCount; 62 @Condition("id>0") @Length!ushort ubyte[] nbt; 63 string[] canPlaceOn; 64 string[] canDestroy; 65 66 mixin Make!(Endian.littleEndian, varuint); 67 68 string toString() 69 { 70 return "Slot(id: " ~ std.conv.to!string(this.id) ~ ", metaAndCount: " ~ std.conv.to!string(this.metaAndCount) ~ ", nbt: " ~ std.conv.to!string(this.nbt) ~ ", canPlaceOn: " ~ std.conv.to!string(this.canPlaceOn) ~ ", canDestroy: " ~ std.conv.to!string(this.canDestroy) ~ ")"; 71 } 72 73 } 74 75 struct Attribute 76 { 77 78 enum string[] __fields = ["min", "max", "value", "default_", "name"]; 79 80 float min; 81 float max; 82 float value; 83 float default_; 84 string name; 85 86 mixin Make!(Endian.littleEndian, varuint); 87 88 string toString() 89 { 90 return "Attribute(min: " ~ std.conv.to!string(this.min) ~ ", max: " ~ std.conv.to!string(this.max) ~ ", value: " ~ std.conv.to!string(this.value) ~ ", default_: " ~ std.conv.to!string(this.default_) ~ ", name: " ~ std.conv.to!string(this.name) ~ ")"; 91 } 92 93 } 94 95 struct BlockPosition 96 { 97 98 enum string[] __fields = ["x", "y", "z"]; 99 100 @Var int x; 101 @Var uint y; 102 @Var int z; 103 104 mixin Make!(Endian.littleEndian, varuint); 105 106 string toString() 107 { 108 return "BlockPosition(x: " ~ std.conv.to!string(this.x) ~ ", y: " ~ std.conv.to!string(this.y) ~ ", z: " ~ std.conv.to!string(this.z) ~ ")"; 109 } 110 111 } 112 113 struct McpeUuid 114 { 115 116 enum string[] __fields = ["mostSignificantBits", "leastSignificantBits"]; 117 118 long mostSignificantBits; 119 long leastSignificantBits; 120 121 mixin Make!(Endian.littleEndian, varuint); 122 123 string toString() 124 { 125 return "McpeUuid(mostSignificantBits: " ~ std.conv.to!string(this.mostSignificantBits) ~ ", leastSignificantBits: " ~ std.conv.to!string(this.leastSignificantBits) ~ ")"; 126 } 127 128 } 129 130 struct Link 131 { 132 133 // action 134 enum ubyte ADD = 0; 135 enum ubyte RIDE = 1; 136 enum ubyte REMOVE = 2; 137 138 enum string[] __fields = ["from", "to", "action", "unknown3"]; 139 140 @Var long from; 141 @Var long to; 142 ubyte action; 143 ubyte unknown3; 144 145 mixin Make!(Endian.littleEndian, varuint); 146 147 string toString() 148 { 149 return "Link(from: " ~ std.conv.to!string(this.from) ~ ", to: " ~ std.conv.to!string(this.to) ~ ", action: " ~ std.conv.to!string(this.action) ~ ", unknown3: " ~ std.conv.to!string(this.unknown3) ~ ")"; 150 } 151 152 } 153 154 struct Rule 155 { 156 157 // name 158 enum string COMMAND_BLOCK_OUTPUT = "commandblockoutput"; 159 enum string DO_DAYLIGHT_CYCLE = "dodaylightcycle"; 160 enum string DO_ENTITY_DROPS = "doentitydrops"; 161 enum string DO_FIRE_TICK = "dofiretick"; 162 enum string DO_MOB_LOOT = "domobloot"; 163 enum string DO_MOB_SPAWNING = "domobspawning"; 164 enum string DO_TILE_DROPS = "dotiledrops"; 165 enum string DO_WEATHER_CYCLE = "doweathercycle"; 166 enum string DROWNING_DAMAGE = "drowningdamage"; 167 enum string FALL_DAMAGE = "falldamage"; 168 enum string FIRE_DAMAGE = "firedamage"; 169 enum string KEEP_INVENTORY = "keepinventory"; 170 enum string MOB_GRIEFING = "mobgriefing"; 171 enum string PVP = "pvp"; 172 enum string SEND_COMMAND_FEEDBACK = "sendcommandfeedback"; 173 174 // type 175 enum ubyte BOOLEAN = 1; 176 enum ubyte INTEGER = 2; 177 enum ubyte FLOATING = 3; 178 179 enum string[] __fields = ["name", "type", "booleanValue", "integerValue", "floatingValue"]; 180 181 string name; 182 ubyte type; 183 @Condition("type==1") bool booleanValue; 184 @Condition("type==2") @Var uint integerValue; 185 @Condition("type==3") float floatingValue; 186 187 mixin Make!(Endian.littleEndian, varuint); 188 189 string toString() 190 { 191 return "Rule(name: " ~ std.conv.to!string(this.name) ~ ", type: " ~ std.conv.to!string(this.type) ~ ", booleanValue: " ~ std.conv.to!string(this.booleanValue) ~ ", integerValue: " ~ std.conv.to!string(this.integerValue) ~ ", floatingValue: " ~ std.conv.to!string(this.floatingValue) ~ ")"; 192 } 193 194 } 195 196 struct LoginBody 197 { 198 199 private struct Container 200 { 201 202 enum string[] __fields = ["chain", "clientData"]; 203 204 @Length!uint ubyte[] chain; 205 @Length!uint ubyte[] clientData; 206 207 mixin Make!(Endian.littleEndian, varuint); 208 209 } 210 211 enum string[] __fields = Container.__fields; 212 213 Container _container; 214 215 alias _container this; 216 217 void serialize(Buffer buffer) 218 { 219 Buffer _buffer = xalloc!Buffer(Container.sizeof + 4); 220 _container.encodeBody(_buffer); 221 serializeLength!(EndianType.var, uint)(buffer, _buffer.data!ubyte.length); 222 buffer.writeData(_buffer.data!ubyte); 223 xfree(_buffer); 224 } 225 226 void deserialize(Buffer buffer) 227 { 228 Buffer _buffer = xalloc!Buffer(cast(ubyte[])buffer.readData(deserializeLength!(EndianType.var, uint)(buffer))); 229 _container.decodeBody(_buffer); 230 xfree(_buffer); 231 } 232 233 string toString() 234 { 235 return "LoginBody(chain: " ~ std.conv.to!string(this.chain) ~ ", clientData: " ~ std.conv.to!string(this.clientData) ~ ")"; 236 } 237 238 } 239 240 struct Varulong 241 { 242 243 enum string[] __fields = ["name", "data"]; 244 245 string name; 246 ushort data; 247 248 mixin Make!(Endian.littleEndian, varuint); 249 250 string toString() 251 { 252 return "Varulong(name: " ~ std.conv.to!string(this.name) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")"; 253 } 254 255 } 256 257 struct InventoryAction 258 { 259 260 // source 261 enum uint CONTAINER = 0; 262 enum uint WORLD = 2; 263 enum uint CREATIVE = 3; 264 265 enum string[] __fields = ["source", "container", "unknown2", "slot", "oldItem", "newItem"]; 266 267 @Var uint source; 268 @Condition("source==0") @Var int container = -1; 269 @Condition("source==2") @Var uint unknown2; 270 @Var uint slot; 271 soupply.bedrock282.types.Slot oldItem; 272 soupply.bedrock282.types.Slot newItem; 273 274 mixin Make!(Endian.littleEndian, varuint); 275 276 string toString() 277 { 278 return "InventoryAction(source: " ~ std.conv.to!string(this.source) ~ ", container: " ~ std.conv.to!string(this.container) ~ ", unknown2: " ~ std.conv.to!string(this.unknown2) ~ ", slot: " ~ std.conv.to!string(this.slot) ~ ", oldItem: " ~ std.conv.to!string(this.oldItem) ~ ", newItem: " ~ std.conv.to!string(this.newItem) ~ ")"; 279 } 280 281 } 282 283 struct Recipe 284 { 285 286 // type 287 enum int SHAPELESS = 0; 288 enum int SHAPED = 1; 289 enum int FURNACE = 2; 290 enum int FURNACE_DATA = 3; 291 enum int MULTI = 4; 292 293 enum string[] __fields = ["type", "data"]; 294 295 @Var int type; 296 @NoLength ubyte[] data; 297 298 mixin Make!(Endian.littleEndian, varuint); 299 300 string toString() 301 { 302 return "Recipe(type: " ~ std.conv.to!string(this.type) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")"; 303 } 304 305 } 306 307 struct Section 308 { 309 310 enum string[] __fields = ["storageVersion", "blockIds", "blockMetas"]; 311 312 ubyte storageVersion = 0; 313 ubyte[4096] blockIds; 314 ubyte[2048] blockMetas; 315 316 mixin Make!(Endian.littleEndian, varuint); 317 318 string toString() 319 { 320 return "Section(storageVersion: " ~ std.conv.to!string(this.storageVersion) ~ ", blockIds: " ~ std.conv.to!string(this.blockIds) ~ ", blockMetas: " ~ std.conv.to!string(this.blockMetas) ~ ")"; 321 } 322 323 } 324 325 struct ExtraData 326 { 327 328 enum string[] __fields = ["key", "value"]; 329 330 @Var uint key; 331 ushort value; 332 333 mixin Make!(Endian.littleEndian, varuint); 334 335 string toString() 336 { 337 return "ExtraData(key: " ~ std.conv.to!string(this.key) ~ ", value: " ~ std.conv.to!string(this.value) ~ ")"; 338 } 339 340 } 341 342 struct ChunkData 343 { 344 345 private struct Container 346 { 347 348 enum string[] __fields = ["sections", "heights", "biomes", "borders", "extraData", "blockEntities"]; 349 350 soupply.bedrock282.types.Section[] sections; 351 ushort[256] heights; 352 ubyte[256] biomes; 353 ubyte[] borders; 354 soupply.bedrock282.types.ExtraData[] extraData; 355 @NoLength ubyte[] blockEntities; 356 357 mixin Make!(Endian.littleEndian, varuint); 358 359 } 360 361 enum string[] __fields = Container.__fields; 362 363 Container _container; 364 365 alias _container this; 366 367 void serialize(Buffer buffer) 368 { 369 Buffer _buffer = xalloc!Buffer(Container.sizeof + 4); 370 _container.encodeBody(_buffer); 371 serializeLength!(EndianType.var, uint)(buffer, _buffer.data!ubyte.length); 372 buffer.writeData(_buffer.data!ubyte); 373 xfree(_buffer); 374 } 375 376 void deserialize(Buffer buffer) 377 { 378 Buffer _buffer = xalloc!Buffer(cast(ubyte[])buffer.readData(deserializeLength!(EndianType.var, uint)(buffer))); 379 _container.decodeBody(_buffer); 380 xfree(_buffer); 381 } 382 383 string toString() 384 { 385 return "ChunkData(sections: " ~ std.conv.to!string(this.sections) ~ ", heights: " ~ std.conv.to!string(this.heights) ~ ", biomes: " ~ std.conv.to!string(this.biomes) ~ ", borders: " ~ std.conv.to!string(this.borders) ~ ", extraData: " ~ std.conv.to!string(this.extraData) ~ ", blockEntities: " ~ std.conv.to!string(this.blockEntities) ~ ")"; 386 } 387 388 } 389 390 struct Skin 391 { 392 393 enum string[] __fields = ["name", "data", "capeData", "geometryName", "geometryData"]; 394 395 string name; 396 ubyte[] data; 397 ubyte[] capeData; 398 string geometryName; 399 ubyte[] geometryData; 400 401 mixin Make!(Endian.littleEndian, varuint); 402 403 string toString() 404 { 405 return "Skin(name: " ~ std.conv.to!string(this.name) ~ ", data: " ~ std.conv.to!string(this.data) ~ ", capeData: " ~ std.conv.to!string(this.capeData) ~ ", geometryName: " ~ std.conv.to!string(this.geometryName) ~ ", geometryData: " ~ std.conv.to!string(this.geometryData) ~ ")"; 406 } 407 408 } 409 410 struct PlayerList 411 { 412 413 enum string[] __fields = ["uuid", "entityId", "displayName", "skin", "unknown4"]; 414 415 soupply.bedrock282.types.McpeUuid uuid; 416 @Var long entityId; 417 string displayName; 418 soupply.bedrock282.types.Skin skin; 419 string unknown4; 420 421 mixin Make!(Endian.littleEndian, varuint); 422 423 string toString() 424 { 425 return "PlayerList(uuid: " ~ std.conv.to!string(this.uuid) ~ ", entityId: " ~ std.conv.to!string(this.entityId) ~ ", displayName: " ~ std.conv.to!string(this.displayName) ~ ", skin: " ~ std.conv.to!string(this.skin) ~ ", unknown4: " ~ std.conv.to!string(this.unknown4) ~ ")"; 426 } 427 428 } 429 430 struct Decoration 431 { 432 433 enum string[] __fields = ["rotationAndIcon", "position", "label", "color"]; 434 435 @Var int rotationAndIcon; 436 Vector!(ubyte, "xz") position; 437 string label; 438 uint color; 439 440 mixin Make!(Endian.littleEndian, varuint); 441 442 string toString() 443 { 444 return "Decoration(rotationAndIcon: " ~ std.conv.to!string(this.rotationAndIcon) ~ ", position: " ~ std.conv.to!string(this.position) ~ ", label: " ~ std.conv.to!string(this.label) ~ ", color: " ~ std.conv.to!string(this.color) ~ ")"; 445 } 446 447 } 448 449 struct Enum 450 { 451 452 enum string[] __fields = ["name", "valuesIndexes"]; 453 454 string name; 455 ushort[] valuesIndexes; 456 457 mixin Make!(Endian.littleEndian, varuint); 458 459 string toString() 460 { 461 return "Enum(name: " ~ std.conv.to!string(this.name) ~ ", valuesIndexes: " ~ std.conv.to!string(this.valuesIndexes) ~ ")"; 462 } 463 464 } 465 466 struct Parameter 467 { 468 469 // type 470 enum uint VALID = 1048576; 471 enum uint INT = 1; 472 enum uint FLOAT = 2; 473 enum uint VALUE = 3; 474 enum uint WILDCARD_INT = 4; 475 enum uint TARGET = 5; 476 enum uint WILDCARD_TARGET = 6; 477 enum uint STRING = 15; 478 enum uint POSITION = 16; 479 enum uint MESSAGE = 19; 480 enum uint RAWTEXT = 21; 481 enum uint JSON = 24; 482 enum uint COMMAND = 30; 483 enum uint ENUM = 2097152; 484 enum uint TEMPLATE = 16777216; 485 486 enum string[] __fields = ["name", "type", "optional"]; 487 488 string name; 489 uint type; 490 bool optional; 491 492 mixin Make!(Endian.littleEndian, varuint); 493 494 string toString() 495 { 496 return "Parameter(name: " ~ std.conv.to!string(this.name) ~ ", type: " ~ std.conv.to!string(this.type) ~ ", optional: " ~ std.conv.to!string(this.optional) ~ ")"; 497 } 498 499 } 500 501 struct Overload 502 { 503 504 enum string[] __fields = ["parameters"]; 505 506 soupply.bedrock282.types.Parameter[] parameters; 507 508 mixin Make!(Endian.littleEndian, varuint); 509 510 string toString() 511 { 512 return "Overload(parameters: " ~ std.conv.to!string(this.parameters) ~ ")"; 513 } 514 515 } 516 517 struct Command 518 { 519 520 enum string[] __fields = ["name", "description", "unknown2", "permissionLevel", "aliasesEnum", "overloads"]; 521 522 string name; 523 string description; 524 ubyte unknown2; 525 ubyte permissionLevel; 526 int aliasesEnum = -1; 527 soupply.bedrock282.types.Overload[] overloads; 528 529 mixin Make!(Endian.littleEndian, varuint); 530 531 string toString() 532 { 533 return "Command(name: " ~ std.conv.to!string(this.name) ~ ", description: " ~ std.conv.to!string(this.description) ~ ", unknown2: " ~ std.conv.to!string(this.unknown2) ~ ", permissionLevel: " ~ std.conv.to!string(this.permissionLevel) ~ ", aliasesEnum: " ~ std.conv.to!string(this.aliasesEnum) ~ ", overloads: " ~ std.conv.to!string(this.overloads) ~ ")"; 534 } 535 536 } 537 538 struct CommandOriginData 539 { 540 541 // type 542 enum uint PLAYER = 0; 543 enum uint BLOCK = 1; 544 enum uint MINECART_BLOCK = 2; 545 enum uint DEV_CONSOLE = 3; 546 enum uint TEST = 4; 547 enum uint AUTOMATION_PLAYER = 5; 548 enum uint CLIENT_AUTOMATION = 6; 549 enum uint DEDICATED_SERVER = 7; 550 enum uint ENTITY = 8; 551 enum uint VIRTUAL = 9; 552 enum uint GAME_ARGUMENT = 10; 553 enum uint ENTITY_SERVER = 11; 554 555 enum string[] __fields = ["type", "uuid", "requestId", "unknown3"]; 556 557 @Var uint type; 558 UUID uuid; 559 string requestId; 560 @Condition("type==3||type==4") @Var long unknown3; 561 562 mixin Make!(Endian.littleEndian, varuint); 563 564 string toString() 565 { 566 return "CommandOriginData(type: " ~ std.conv.to!string(this.type) ~ ", uuid: " ~ std.conv.to!string(this.uuid) ~ ", requestId: " ~ std.conv.to!string(this.requestId) ~ ", unknown3: " ~ std.conv.to!string(this.unknown3) ~ ")"; 567 } 568 569 } 570 571 struct CommandMessage 572 { 573 574 enum string[] __fields = ["isInternal", "messageId", "parameters"]; 575 576 bool isInternal; 577 string messageId; 578 string[] parameters; 579 580 mixin Make!(Endian.littleEndian, varuint); 581 582 string toString() 583 { 584 return "CommandMessage(isInternal: " ~ std.conv.to!string(this.isInternal) ~ ", messageId: " ~ std.conv.to!string(this.messageId) ~ ", parameters: " ~ std.conv.to!string(this.parameters) ~ ")"; 585 } 586 587 } 588 589 struct Score 590 { 591 592 enum string[] __fields = ["uuid", "objectiveName", "score"]; 593 594 UUID uuid; 595 string objectiveName; 596 int score; 597 598 mixin Make!(Endian.littleEndian, varuint); 599 600 string toString() 601 { 602 return "Score(uuid: " ~ std.conv.to!string(this.uuid) ~ ", objectiveName: " ~ std.conv.to!string(this.objectiveName) ~ ", score: " ~ std.conv.to!string(this.score) ~ ")"; 603 } 604 605 } 606 607 struct RegisterEntry 608 { 609 610 enum string[] __fields = ["scoreboardId", "uuid"]; 611 612 @Var long scoreboardId; 613 UUID uuid; 614 615 mixin Make!(Endian.littleEndian, varuint); 616 617 string toString() 618 { 619 return "RegisterEntry(scoreboardId: " ~ std.conv.to!string(this.scoreboardId) ~ ", uuid: " ~ std.conv.to!string(this.uuid) ~ ")"; 620 } 621 622 }