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