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