1 /* 2 * This file has been automatically generated by Soupply and released under the MIT license. 3 * Generated from data/bedrock261.xml 4 */ 5 module soupply.bedrock261.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.bedrock261.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 InventoryAction 241 { 242 243 // source 244 enum uint CONTAINER = 0; 245 enum uint WORLD = 2; 246 enum uint CREATIVE = 3; 247 248 enum string[] __fields = ["source", "container", "unknown2", "slot", "oldItem", "newItem"]; 249 250 @Var uint source; 251 @Condition("source==0") @Var int container = -1; 252 @Condition("source==2") @Var uint unknown2; 253 @Var uint slot; 254 soupply.bedrock261.types.Slot oldItem; 255 soupply.bedrock261.types.Slot newItem; 256 257 mixin Make!(Endian.littleEndian, varuint); 258 259 string toString() 260 { 261 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) ~ ")"; 262 } 263 264 } 265 266 struct Recipe 267 { 268 269 // type 270 enum int SHAPELESS = 0; 271 enum int SHAPED = 1; 272 enum int FURNACE = 2; 273 enum int FURNACE_DATA = 3; 274 enum int MULTI = 4; 275 276 enum string[] __fields = ["type", "data"]; 277 278 @Var int type; 279 @NoLength ubyte[] data; 280 281 mixin Make!(Endian.littleEndian, varuint); 282 283 string toString() 284 { 285 return "Recipe(type: " ~ std.conv.to!string(this.type) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")"; 286 } 287 288 } 289 290 struct Section 291 { 292 293 enum string[] __fields = ["storageVersion", "blockIds", "blockMetas"]; 294 295 ubyte storageVersion = 0; 296 ubyte[4096] blockIds; 297 ubyte[2048] blockMetas; 298 299 mixin Make!(Endian.littleEndian, varuint); 300 301 string toString() 302 { 303 return "Section(storageVersion: " ~ std.conv.to!string(this.storageVersion) ~ ", blockIds: " ~ std.conv.to!string(this.blockIds) ~ ", blockMetas: " ~ std.conv.to!string(this.blockMetas) ~ ")"; 304 } 305 306 } 307 308 struct ExtraData 309 { 310 311 enum string[] __fields = ["key", "value"]; 312 313 @Var uint key; 314 ushort value; 315 316 mixin Make!(Endian.littleEndian, varuint); 317 318 string toString() 319 { 320 return "ExtraData(key: " ~ std.conv.to!string(this.key) ~ ", value: " ~ std.conv.to!string(this.value) ~ ")"; 321 } 322 323 } 324 325 struct ChunkData 326 { 327 328 private struct Container 329 { 330 331 enum string[] __fields = ["sections", "heights", "biomes", "borders", "extraData", "blockEntities"]; 332 333 soupply.bedrock261.types.Section[] sections; 334 ushort[256] heights; 335 ubyte[256] biomes; 336 ubyte[] borders; 337 soupply.bedrock261.types.ExtraData[] extraData; 338 @NoLength ubyte[] blockEntities; 339 340 mixin Make!(Endian.littleEndian, varuint); 341 342 } 343 344 enum string[] __fields = Container.__fields; 345 346 Container _container; 347 348 alias _container this; 349 350 void serialize(Buffer buffer) 351 { 352 Buffer _buffer = xalloc!Buffer(Container.sizeof + 4); 353 _container.encodeBody(_buffer); 354 serializeLength!(EndianType.var, uint)(buffer, _buffer.data!ubyte.length); 355 buffer.writeData(_buffer.data!ubyte); 356 xfree(_buffer); 357 } 358 359 void deserialize(Buffer buffer) 360 { 361 Buffer _buffer = xalloc!Buffer(cast(ubyte[])buffer.readData(deserializeLength!(EndianType.var, uint)(buffer))); 362 _container.decodeBody(_buffer); 363 xfree(_buffer); 364 } 365 366 string toString() 367 { 368 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) ~ ")"; 369 } 370 371 } 372 373 struct Skin 374 { 375 376 enum string[] __fields = ["name", "data", "capeData", "geometryName", "geometryData"]; 377 378 string name; 379 ubyte[] data; 380 ubyte[] capeData; 381 string geometryName; 382 ubyte[] geometryData; 383 384 mixin Make!(Endian.littleEndian, varuint); 385 386 string toString() 387 { 388 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) ~ ")"; 389 } 390 391 } 392 393 struct PlayerList 394 { 395 396 enum string[] __fields = ["uuid", "entityId", "displayName", "skin", "unknown4"]; 397 398 soupply.bedrock261.types.McpeUuid uuid; 399 @Var long entityId; 400 string displayName; 401 soupply.bedrock261.types.Skin skin; 402 string unknown4; 403 404 mixin Make!(Endian.littleEndian, varuint); 405 406 string toString() 407 { 408 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) ~ ")"; 409 } 410 411 } 412 413 struct Decoration 414 { 415 416 enum string[] __fields = ["rotationAndIcon", "position", "label", "color"]; 417 418 @Var int rotationAndIcon; 419 Vector!(ubyte, "xz") position; 420 string label; 421 uint color; 422 423 mixin Make!(Endian.littleEndian, varuint); 424 425 string toString() 426 { 427 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) ~ ")"; 428 } 429 430 } 431 432 struct Enum 433 { 434 435 enum string[] __fields = ["name", "valuesIndexes"]; 436 437 string name; 438 ushort[] valuesIndexes; 439 440 mixin Make!(Endian.littleEndian, varuint); 441 442 string toString() 443 { 444 return "Enum(name: " ~ std.conv.to!string(this.name) ~ ", valuesIndexes: " ~ std.conv.to!string(this.valuesIndexes) ~ ")"; 445 } 446 447 } 448 449 struct Parameter 450 { 451 452 // type 453 enum uint VALID = 1048576; 454 enum uint INT = 1; 455 enum uint FLOAT = 2; 456 enum uint VALUE = 3; 457 enum uint WILDCARD_INT = 4; 458 enum uint TARGET = 5; 459 enum uint WILDCARD_TARGET = 6; 460 enum uint STRING = 15; 461 enum uint POSITION = 16; 462 enum uint MESSAGE = 19; 463 enum uint RAWTEXT = 21; 464 enum uint JSON = 24; 465 enum uint COMMAND = 30; 466 enum uint ENUM = 2097152; 467 enum uint TEMPLATE = 16777216; 468 469 enum string[] __fields = ["name", "type", "optional"]; 470 471 string name; 472 uint type; 473 bool optional; 474 475 mixin Make!(Endian.littleEndian, varuint); 476 477 string toString() 478 { 479 return "Parameter(name: " ~ std.conv.to!string(this.name) ~ ", type: " ~ std.conv.to!string(this.type) ~ ", optional: " ~ std.conv.to!string(this.optional) ~ ")"; 480 } 481 482 } 483 484 struct Overload 485 { 486 487 enum string[] __fields = ["parameters"]; 488 489 soupply.bedrock261.types.Parameter[] parameters; 490 491 mixin Make!(Endian.littleEndian, varuint); 492 493 string toString() 494 { 495 return "Overload(parameters: " ~ std.conv.to!string(this.parameters) ~ ")"; 496 } 497 498 } 499 500 struct Command 501 { 502 503 enum string[] __fields = ["name", "description", "unknown2", "permissionLevel", "aliasesEnum", "overloads"]; 504 505 string name; 506 string description; 507 ubyte unknown2; 508 ubyte permissionLevel; 509 int aliasesEnum = -1; 510 soupply.bedrock261.types.Overload[] overloads; 511 512 mixin Make!(Endian.littleEndian, varuint); 513 514 string toString() 515 { 516 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) ~ ")"; 517 } 518 519 } 520 521 struct CommandOriginData 522 { 523 524 // type 525 enum uint PLAYER = 0; 526 enum uint BLOCK = 1; 527 enum uint MINECART_BLOCK = 2; 528 enum uint DEV_CONSOLE = 3; 529 enum uint TEST = 4; 530 enum uint AUTOMATION_PLAYER = 5; 531 enum uint CLIENT_AUTOMATION = 6; 532 enum uint DEDICATED_SERVER = 7; 533 enum uint ENTITY = 8; 534 enum uint VIRTUAL = 9; 535 enum uint GAME_ARGUMENT = 10; 536 enum uint ENTITY_SERVER = 11; 537 538 enum string[] __fields = ["type", "uuid", "requestId", "unknown3"]; 539 540 @Var uint type; 541 UUID uuid; 542 string requestId; 543 @Condition("type==3||type==4") @Var long unknown3; 544 545 mixin Make!(Endian.littleEndian, varuint); 546 547 string toString() 548 { 549 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) ~ ")"; 550 } 551 552 } 553 554 struct CommandMessage 555 { 556 557 enum string[] __fields = ["isInternal", "messageId", "parameters"]; 558 559 bool isInternal; 560 string messageId; 561 string[] parameters; 562 563 mixin Make!(Endian.littleEndian, varuint); 564 565 string toString() 566 { 567 return "CommandMessage(isInternal: " ~ std.conv.to!string(this.isInternal) ~ ", messageId: " ~ std.conv.to!string(this.messageId) ~ ", parameters: " ~ std.conv.to!string(this.parameters) ~ ")"; 568 } 569 570 } 571 572 struct Score 573 { 574 575 enum string[] __fields = ["uuid", "objectiveName", "score"]; 576 577 UUID uuid; 578 string objectiveName; 579 int score; 580 581 mixin Make!(Endian.littleEndian, varuint); 582 583 string toString() 584 { 585 return "Score(uuid: " ~ std.conv.to!string(this.uuid) ~ ", objectiveName: " ~ std.conv.to!string(this.objectiveName) ~ ", score: " ~ std.conv.to!string(this.score) ~ ")"; 586 } 587 588 }