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