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