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