Created
August 8, 2020 00:34
-
-
Save nickelpro/81cedbbd45e06014858a17c0a2a02562 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This file was generated by mcd2cpp.py | |
It should not be edited by hand. | |
*/ | |
#include "proto_1_16_1.hpp" | |
namespace mcd { | |
const char* serverbound_handshaking_cstrings[] = { | |
"ServerboundSetProtocol" | |
}; | |
const char* clientbound_status_cstrings[] = { | |
"ClientboundServerInfo", | |
"ClientboundPing" | |
}; | |
const char* serverbound_status_cstrings[] = { | |
"ServerboundPingStart", | |
"ServerboundPing" | |
}; | |
const char* clientbound_login_cstrings[] = { | |
"ClientboundDisconnect", | |
"ClientboundEncryptionBegin", | |
"ClientboundSuccess", | |
"ClientboundCompress", | |
"ClientboundLoginPluginRequest" | |
}; | |
const char* serverbound_login_cstrings[] = { | |
"ServerboundLoginStart", | |
"ServerboundEncryptionBegin", | |
"ServerboundLoginPluginResponse" | |
}; | |
const char* clientbound_play_cstrings[] = { | |
"ClientboundSpawnEntity", | |
"ClientboundSpawnEntityExperienceOrb", | |
"ClientboundSpawnEntityLiving", | |
"ClientboundSpawnEntityPainting", | |
"ClientboundNamedEntitySpawn", | |
"ClientboundAnimation", | |
"ClientboundStatistics", | |
"ClientboundAcknowledgePlayerDigging", | |
"ClientboundBlockBreakAnimation", | |
"ClientboundTileEntityData", | |
"ClientboundBlockAction", | |
"ClientboundBlockChange", | |
"ClientboundBossBar", | |
"ClientboundDifficulty", | |
"ClientboundChat", | |
"ClientboundMultiBlockChange", | |
"ClientboundTabComplete", | |
"ClientboundDeclareCommands", | |
"ClientboundTransaction", | |
"ClientboundCloseWindow", | |
"ClientboundWindowItems", | |
"ClientboundCraftProgressBar", | |
"ClientboundSetSlot", | |
"ClientboundSetCooldown", | |
"ClientboundCustomPayload", | |
"ClientboundNamedSoundEffect", | |
"ClientboundKickDisconnect", | |
"ClientboundEntityStatus", | |
"ClientboundExplosion", | |
"ClientboundUnloadChunk", | |
"ClientboundGameStateChange", | |
"ClientboundOpenHorseWindow", | |
"ClientboundKeepAlive", | |
"ClientboundMapChunk", | |
"ClientboundWorldEvent", | |
"ClientboundWorldParticles", | |
"ClientboundUpdateLight", | |
"ClientboundLogin", | |
"ClientboundMap", | |
"ClientboundTradeList", | |
"ClientboundRelEntityMove", | |
"ClientboundEntityMoveLook", | |
"ClientboundEntityLook", | |
"ClientboundEntity", | |
"ClientboundVehicleMove", | |
"ClientboundOpenBook", | |
"ClientboundOpenWindow", | |
"ClientboundOpenSignEntity", | |
"ClientboundCraftRecipeResponse", | |
"ClientboundAbilities", | |
"ClientboundCombatEvent", | |
"ClientboundPlayerInfo", | |
"ClientboundFacePlayer", | |
"ClientboundPosition", | |
"ClientboundUnlockRecipes", | |
"ClientboundEntityDestroy", | |
"ClientboundRemoveEntityEffect", | |
"ClientboundResourcePackSend", | |
"ClientboundRespawn", | |
"ClientboundEntityHeadRotation", | |
"ClientboundSelectAdvancementTab", | |
"ClientboundWorldBorder", | |
"ClientboundCamera", | |
"ClientboundHeldItemSlot", | |
"ClientboundUpdateViewPosition", | |
"ClientboundUpdateViewDistance", | |
"ClientboundSpawnPosition", | |
"ClientboundScoreboardDisplayObjective", | |
"ClientboundEntityMetadata", | |
"ClientboundAttachEntity", | |
"ClientboundEntityVelocity", | |
"ClientboundEntityEquipment", | |
"ClientboundExperience", | |
"ClientboundUpdateHealth", | |
"ClientboundScoreboardObjective", | |
"ClientboundSetPassengers", | |
"ClientboundTeams", | |
"ClientboundScoreboardScore", | |
"ClientboundUpdateTime", | |
"ClientboundTitle", | |
"ClientboundEntitySoundEffect", | |
"ClientboundSoundEffect", | |
"ClientboundStopSound", | |
"ClientboundPlayerlistHeader", | |
"ClientboundNbtQueryResponse", | |
"ClientboundCollect", | |
"ClientboundEntityTeleport", | |
"ClientboundAdvancements", | |
"ClientboundEntityUpdateAttributes", | |
"ClientboundEntityEffect", | |
"ClientboundDeclareRecipes", | |
"ClientboundTags" | |
}; | |
const char* serverbound_play_cstrings[] = { | |
"ServerboundTeleportConfirm", | |
"ServerboundQueryBlockNbt", | |
"ServerboundSetDifficulty", | |
"ServerboundChat", | |
"ServerboundClientCommand", | |
"ServerboundSettings", | |
"ServerboundTabComplete", | |
"ServerboundTransaction", | |
"ServerboundEnchantItem", | |
"ServerboundWindowClick", | |
"ServerboundCloseWindow", | |
"ServerboundCustomPayload", | |
"ServerboundEditBook", | |
"ServerboundQueryEntityNbt", | |
"ServerboundUseEntity", | |
"ServerboundGenerateStructure", | |
"ServerboundKeepAlive", | |
"ServerboundLockDifficulty", | |
"ServerboundPosition", | |
"ServerboundPositionLook", | |
"ServerboundLook", | |
"ServerboundFlying", | |
"ServerboundVehicleMove", | |
"ServerboundSteerBoat", | |
"ServerboundPickItem", | |
"ServerboundCraftRecipeRequest", | |
"ServerboundAbilities", | |
"ServerboundBlockDig", | |
"ServerboundEntityAction", | |
"ServerboundSteerVehicle", | |
"ServerboundCraftingBookData", | |
"ServerboundNameItem", | |
"ServerboundResourcePackReceive", | |
"ServerboundAdvancementTab", | |
"ServerboundSelectTrade", | |
"ServerboundSetBeaconEffect", | |
"ServerboundHeldItemSlot", | |
"ServerboundUpdateCommandBlock", | |
"ServerboundUpdateCommandBlockMinecart", | |
"ServerboundSetCreativeSlot", | |
"ServerboundUpdateJigsawBlock", | |
"ServerboundUpdateStructureBlock", | |
"ServerboundUpdateSign", | |
"ServerboundArmAnimation", | |
"ServerboundSpectate", | |
"ServerboundBlockPlace", | |
"ServerboundUseItem" | |
}; | |
const char **protocol_cstrings[STATE_MAX][DIRECTION_MAX] = { | |
{serverbound_handshaking_cstrings}, | |
{serverbound_status_cstrings, clientbound_status_cstrings}, | |
{serverbound_login_cstrings, clientbound_login_cstrings}, | |
{serverbound_play_cstrings, clientbound_play_cstrings} | |
}; | |
const int protocol_max_ids[STATE_MAX][DIRECTION_MAX] = { | |
{SERVERBOUND_HANDSHAKING_MAX, CLIENTBOUND_HANDSHAKING_MAX}, | |
{SERVERBOUND_STATUS_MAX, CLIENTBOUND_STATUS_MAX}, | |
{SERVERBOUND_LOGIN_MAX, CLIENTBOUND_LOGIN_MAX}, | |
{SERVERBOUND_PLAY_MAX, CLIENTBOUND_PLAY_MAX} | |
}; | |
ServerboundSetProtocol::ServerboundSetProtocol() : | |
Packet(HANDSHAKING, SERVERBOUND, SB_HS_SET_PROTOCOL, | |
"ServerboundSetProtocol") {} | |
void ServerboundSetProtocol::encode(std::ostream &dest) const { | |
enc_varint(dest, protocolVersion); | |
enc_string(dest, serverHost); | |
enc_be16(dest, serverPort); | |
enc_varint(dest, nextState); | |
} | |
void ServerboundSetProtocol::decode(std::istream &src) { | |
protocolVersion = dec_varint(src); | |
serverHost = dec_string(src); | |
serverPort = dec_be16(src); | |
nextState = dec_varint(src); | |
} | |
ServerboundLegacyServerListPing::ServerboundLegacyServerListPing() : | |
Packet(HANDSHAKING, SERVERBOUND, 254, | |
"ServerboundLegacyServerListPing") {} | |
void ServerboundLegacyServerListPing::encode(std::ostream &dest) const { | |
enc_byte(dest, payload); | |
} | |
void ServerboundLegacyServerListPing::decode(std::istream &src) { | |
payload = dec_byte(src); | |
} | |
ClientboundServerInfo::ClientboundServerInfo() : | |
Packet(STATUS, CLIENTBOUND, CB_ST_SERVER_INFO, | |
"ClientboundServerInfo") {} | |
void ClientboundServerInfo::encode(std::ostream &dest) const { | |
enc_string(dest, response); | |
} | |
void ClientboundServerInfo::decode(std::istream &src) { | |
response = dec_string(src); | |
} | |
ClientboundPing::ClientboundPing() : | |
Packet(STATUS, CLIENTBOUND, CB_ST_PING, | |
"ClientboundPing") {} | |
void ClientboundPing::encode(std::ostream &dest) const { | |
enc_be64(dest, time); | |
} | |
void ClientboundPing::decode(std::istream &src) { | |
time = dec_be64(src); | |
} | |
ServerboundPingStart::ServerboundPingStart() : | |
Packet(STATUS, SERVERBOUND, SB_ST_PING_START, | |
"ServerboundPingStart") {} | |
void ServerboundPingStart::encode(std::ostream &dest) const { | |
} | |
void ServerboundPingStart::decode(std::istream &src) { | |
} | |
ServerboundPing::ServerboundPing() : | |
Packet(STATUS, SERVERBOUND, SB_ST_PING, | |
"ServerboundPing") {} | |
void ServerboundPing::encode(std::ostream &dest) const { | |
enc_be64(dest, time); | |
} | |
void ServerboundPing::decode(std::istream &src) { | |
time = dec_be64(src); | |
} | |
ClientboundDisconnect::ClientboundDisconnect() : | |
Packet(LOGIN, CLIENTBOUND, CB_LG_DISCONNECT, | |
"ClientboundDisconnect") {} | |
void ClientboundDisconnect::encode(std::ostream &dest) const { | |
enc_string(dest, reason); | |
} | |
void ClientboundDisconnect::decode(std::istream &src) { | |
reason = dec_string(src); | |
} | |
ClientboundEncryptionBegin::ClientboundEncryptionBegin() : | |
Packet(LOGIN, CLIENTBOUND, CB_LG_ENCRYPTION_BEGIN, | |
"ClientboundEncryptionBegin") {} | |
void ClientboundEncryptionBegin::encode(std::ostream &dest) const { | |
enc_string(dest, serverId); | |
enc_varint(dest, publicKey.size()); | |
enc_buffer(dest, publicKey); | |
enc_varint(dest, verifyToken.size()); | |
enc_buffer(dest, verifyToken); | |
} | |
void ClientboundEncryptionBegin::decode(std::istream &src) { | |
serverId = dec_string(src); | |
publicKey = dec_buffer(src, dec_varint(src)); | |
verifyToken = dec_buffer(src, dec_varint(src)); | |
} | |
ClientboundSuccess::ClientboundSuccess() : | |
Packet(LOGIN, CLIENTBOUND, CB_LG_SUCCESS, | |
"ClientboundSuccess") {} | |
void ClientboundSuccess::encode(std::ostream &dest) const { | |
enc_uuid(dest, uuid); | |
enc_string(dest, username); | |
} | |
void ClientboundSuccess::decode(std::istream &src) { | |
uuid = dec_uuid(src); | |
username = dec_string(src); | |
} | |
ClientboundCompress::ClientboundCompress() : | |
Packet(LOGIN, CLIENTBOUND, CB_LG_COMPRESS, | |
"ClientboundCompress") {} | |
void ClientboundCompress::encode(std::ostream &dest) const { | |
enc_varint(dest, threshold); | |
} | |
void ClientboundCompress::decode(std::istream &src) { | |
threshold = dec_varint(src); | |
} | |
ClientboundLoginPluginRequest::ClientboundLoginPluginRequest() : | |
Packet(LOGIN, CLIENTBOUND, CB_LG_LOGIN_PLUGIN_REQUEST, | |
"ClientboundLoginPluginRequest") {} | |
void ClientboundLoginPluginRequest::encode(std::ostream &dest) const { | |
enc_varint(dest, messageId); | |
enc_string(dest, channel); | |
dest.write(data.data(), data.size()); | |
} | |
void ClientboundLoginPluginRequest::decode(std::istream &src) { | |
messageId = dec_varint(src); | |
channel = dec_string(src); | |
data = std::vector<char>(std::istreambuf_iterator<char>(src), | |
std::istreambuf_iterator<char>()); | |
} | |
ServerboundLoginStart::ServerboundLoginStart() : | |
Packet(LOGIN, SERVERBOUND, SB_LG_LOGIN_START, | |
"ServerboundLoginStart") {} | |
void ServerboundLoginStart::encode(std::ostream &dest) const { | |
enc_string(dest, username); | |
} | |
void ServerboundLoginStart::decode(std::istream &src) { | |
username = dec_string(src); | |
} | |
ServerboundEncryptionBegin::ServerboundEncryptionBegin() : | |
Packet(LOGIN, SERVERBOUND, SB_LG_ENCRYPTION_BEGIN, | |
"ServerboundEncryptionBegin") {} | |
void ServerboundEncryptionBegin::encode(std::ostream &dest) const { | |
enc_varint(dest, sharedSecret.size()); | |
enc_buffer(dest, sharedSecret); | |
enc_varint(dest, verifyToken.size()); | |
enc_buffer(dest, verifyToken); | |
} | |
void ServerboundEncryptionBegin::decode(std::istream &src) { | |
sharedSecret = dec_buffer(src, dec_varint(src)); | |
verifyToken = dec_buffer(src, dec_varint(src)); | |
} | |
ServerboundLoginPluginResponse::ServerboundLoginPluginResponse() : | |
Packet(LOGIN, SERVERBOUND, SB_LG_LOGIN_PLUGIN_RESPONSE, | |
"ServerboundLoginPluginResponse") {} | |
void ServerboundLoginPluginResponse::encode(std::ostream &dest) const { | |
enc_varint(dest, messageId); | |
enc_byte(dest, data.has_value()); | |
if(data.has_value()) { | |
dest.write(data.value().data(), data.value().size()); | |
} | |
} | |
void ServerboundLoginPluginResponse::decode(std::istream &src) { | |
messageId = dec_varint(src); | |
if(dec_byte(src)) { | |
data = std::vector<char>(std::istreambuf_iterator<char>(src), | |
std::istreambuf_iterator<char>()); | |
} | |
} | |
ClientboundSpawnEntity::ClientboundSpawnEntity() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_SPAWN_ENTITY, | |
"ClientboundSpawnEntity") {} | |
void ClientboundSpawnEntity::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_uuid(dest, objectUUID); | |
enc_varint(dest, type); | |
enc_bef64(dest, x); | |
enc_bef64(dest, y); | |
enc_bef64(dest, z); | |
enc_byte(dest, pitch); | |
enc_byte(dest, yaw); | |
enc_be32(dest, objectData); | |
enc_be16(dest, velocityX); | |
enc_be16(dest, velocityY); | |
enc_be16(dest, velocityZ); | |
} | |
void ClientboundSpawnEntity::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
objectUUID = dec_uuid(src); | |
type = dec_varint(src); | |
x = dec_bef64(src); | |
y = dec_bef64(src); | |
z = dec_bef64(src); | |
pitch = dec_byte(src); | |
yaw = dec_byte(src); | |
objectData = dec_be32(src); | |
velocityX = dec_be16(src); | |
velocityY = dec_be16(src); | |
velocityZ = dec_be16(src); | |
} | |
ClientboundSpawnEntityExperienceOrb::ClientboundSpawnEntityExperienceOrb() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_SPAWN_ENTITY_EXPERIENCE_ORB, | |
"ClientboundSpawnEntityExperienceOrb") {} | |
void ClientboundSpawnEntityExperienceOrb::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_bef64(dest, x); | |
enc_bef64(dest, y); | |
enc_bef64(dest, z); | |
enc_be16(dest, count); | |
} | |
void ClientboundSpawnEntityExperienceOrb::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
x = dec_bef64(src); | |
y = dec_bef64(src); | |
z = dec_bef64(src); | |
count = dec_be16(src); | |
} | |
ClientboundSpawnEntityLiving::ClientboundSpawnEntityLiving() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_SPAWN_ENTITY_LIVING, | |
"ClientboundSpawnEntityLiving") {} | |
void ClientboundSpawnEntityLiving::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_uuid(dest, entityUUID); | |
enc_varint(dest, type); | |
enc_bef64(dest, x); | |
enc_bef64(dest, y); | |
enc_bef64(dest, z); | |
enc_byte(dest, yaw); | |
enc_byte(dest, pitch); | |
enc_byte(dest, headPitch); | |
enc_be16(dest, velocityX); | |
enc_be16(dest, velocityY); | |
enc_be16(dest, velocityZ); | |
} | |
void ClientboundSpawnEntityLiving::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
entityUUID = dec_uuid(src); | |
type = dec_varint(src); | |
x = dec_bef64(src); | |
y = dec_bef64(src); | |
z = dec_bef64(src); | |
yaw = dec_byte(src); | |
pitch = dec_byte(src); | |
headPitch = dec_byte(src); | |
velocityX = dec_be16(src); | |
velocityY = dec_be16(src); | |
velocityZ = dec_be16(src); | |
} | |
ClientboundSpawnEntityPainting::ClientboundSpawnEntityPainting() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_SPAWN_ENTITY_PAINTING, | |
"ClientboundSpawnEntityPainting") {} | |
void ClientboundSpawnEntityPainting::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_uuid(dest, entityUUID); | |
enc_varint(dest, title); | |
enc_position(dest, location); | |
enc_byte(dest, direction); | |
} | |
void ClientboundSpawnEntityPainting::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
entityUUID = dec_uuid(src); | |
title = dec_varint(src); | |
location = dec_position(src); | |
direction = dec_byte(src); | |
} | |
ClientboundNamedEntitySpawn::ClientboundNamedEntitySpawn() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_NAMED_ENTITY_SPAWN, | |
"ClientboundNamedEntitySpawn") {} | |
void ClientboundNamedEntitySpawn::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_uuid(dest, playerUUID); | |
enc_bef64(dest, x); | |
enc_bef64(dest, y); | |
enc_bef64(dest, z); | |
enc_byte(dest, yaw); | |
enc_byte(dest, pitch); | |
} | |
void ClientboundNamedEntitySpawn::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
playerUUID = dec_uuid(src); | |
x = dec_bef64(src); | |
y = dec_bef64(src); | |
z = dec_bef64(src); | |
yaw = dec_byte(src); | |
pitch = dec_byte(src); | |
} | |
ClientboundAnimation::ClientboundAnimation() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ANIMATION, | |
"ClientboundAnimation") {} | |
void ClientboundAnimation::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_byte(dest, animation); | |
} | |
void ClientboundAnimation::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
animation = dec_byte(src); | |
} | |
ClientboundStatistics::ClientboundStatistics() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_STATISTICS, | |
"ClientboundStatistics") {} | |
void ClientboundStatistics::encode(std::ostream &dest) const { | |
enc_varint(dest, entries.size()); | |
for(auto &el0 : entries) { | |
enc_varint(dest, el0.categoryId); | |
enc_varint(dest, el0.statisticId); | |
enc_varint(dest, el0.value); | |
} | |
} | |
void ClientboundStatistics::decode(std::istream &src) { | |
entries.resize(dec_varint(src)); | |
for(auto &el0 : entries) { | |
el0.categoryId = dec_varint(src); | |
el0.statisticId = dec_varint(src); | |
el0.value = dec_varint(src); | |
} | |
} | |
ClientboundAcknowledgePlayerDigging::ClientboundAcknowledgePlayerDigging() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ACKNOWLEDGE_PLAYER_DIGGING, | |
"ClientboundAcknowledgePlayerDigging") {} | |
void ClientboundAcknowledgePlayerDigging::encode(std::ostream &dest) const { | |
enc_position(dest, location); | |
enc_varint(dest, block); | |
enc_varint(dest, status); | |
enc_byte(dest, successful); | |
} | |
void ClientboundAcknowledgePlayerDigging::decode(std::istream &src) { | |
location = dec_position(src); | |
block = dec_varint(src); | |
status = dec_varint(src); | |
successful = dec_byte(src); | |
} | |
ClientboundBlockBreakAnimation::ClientboundBlockBreakAnimation() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_BLOCK_BREAK_ANIMATION, | |
"ClientboundBlockBreakAnimation") {} | |
void ClientboundBlockBreakAnimation::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_position(dest, location); | |
enc_byte(dest, destroyStage); | |
} | |
void ClientboundBlockBreakAnimation::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
location = dec_position(src); | |
destroyStage = dec_byte(src); | |
} | |
ClientboundTileEntityData::ClientboundTileEntityData() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_TILE_ENTITY_DATA, | |
"ClientboundTileEntityData") {} | |
void ClientboundTileEntityData::encode(std::ostream &dest) const { | |
enc_position(dest, location); | |
enc_byte(dest, action); | |
if(nbtData.has_value()) | |
nbtData.value().encode_full(dest); | |
else | |
enc_byte(dest, nbt::TAG_END); | |
} | |
void ClientboundTileEntityData::decode(std::istream &src) { | |
location = dec_position(src); | |
action = dec_byte(src); | |
if(dec_byte(src) == nbt::TAG_COMPOUND) | |
nbtData.emplace(src, nbt::read_string(src)); | |
} | |
ClientboundBlockAction::ClientboundBlockAction() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_BLOCK_ACTION, | |
"ClientboundBlockAction") {} | |
void ClientboundBlockAction::encode(std::ostream &dest) const { | |
enc_position(dest, location); | |
enc_byte(dest, byte1); | |
enc_byte(dest, byte2); | |
enc_varint(dest, blockId); | |
} | |
void ClientboundBlockAction::decode(std::istream &src) { | |
location = dec_position(src); | |
byte1 = dec_byte(src); | |
byte2 = dec_byte(src); | |
blockId = dec_varint(src); | |
} | |
ClientboundBlockChange::ClientboundBlockChange() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_BLOCK_CHANGE, | |
"ClientboundBlockChange") {} | |
void ClientboundBlockChange::encode(std::ostream &dest) const { | |
enc_position(dest, location); | |
enc_varint(dest, type); | |
} | |
void ClientboundBlockChange::decode(std::istream &src) { | |
location = dec_position(src); | |
type = dec_varint(src); | |
} | |
ClientboundBossBar::ClientboundBossBar() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_BOSS_BAR, | |
"ClientboundBossBar") {} | |
void ClientboundBossBar::encode(std::ostream &dest) const { | |
enc_uuid(dest, entityUUID); | |
enc_varint(dest, action); | |
switch(action) { | |
case 0: | |
enc_string(dest, title); | |
enc_bef32(dest, health); | |
enc_varint(dest, color); | |
enc_varint(dest, dividers); | |
enc_byte(dest, flags); | |
break; | |
case 2: | |
enc_bef32(dest, health); | |
break; | |
case 3: | |
enc_string(dest, title); | |
break; | |
case 4: | |
enc_varint(dest, color); | |
enc_varint(dest, dividers); | |
break; | |
case 5: | |
enc_byte(dest, flags); | |
break; | |
} | |
} | |
void ClientboundBossBar::decode(std::istream &src) { | |
entityUUID = dec_uuid(src); | |
action = dec_varint(src); | |
switch(action) { | |
case 0: | |
title = dec_string(src); | |
health = dec_bef32(src); | |
color = dec_varint(src); | |
dividers = dec_varint(src); | |
flags = dec_byte(src); | |
break; | |
case 2: | |
health = dec_bef32(src); | |
break; | |
case 3: | |
title = dec_string(src); | |
break; | |
case 4: | |
color = dec_varint(src); | |
dividers = dec_varint(src); | |
break; | |
case 5: | |
flags = dec_byte(src); | |
break; | |
} | |
} | |
ClientboundDifficulty::ClientboundDifficulty() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_DIFFICULTY, | |
"ClientboundDifficulty") {} | |
void ClientboundDifficulty::encode(std::ostream &dest) const { | |
enc_byte(dest, difficulty); | |
enc_byte(dest, difficultyLocked); | |
} | |
void ClientboundDifficulty::decode(std::istream &src) { | |
difficulty = dec_byte(src); | |
difficultyLocked = dec_byte(src); | |
} | |
ClientboundChat::ClientboundChat() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_CHAT, | |
"ClientboundChat") {} | |
void ClientboundChat::encode(std::ostream &dest) const { | |
enc_string(dest, message); | |
enc_byte(dest, position); | |
enc_uuid(dest, sender); | |
} | |
void ClientboundChat::decode(std::istream &src) { | |
message = dec_string(src); | |
position = dec_byte(src); | |
sender = dec_uuid(src); | |
} | |
ClientboundMultiBlockChange::ClientboundMultiBlockChange() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_MULTI_BLOCK_CHANGE, | |
"ClientboundMultiBlockChange") {} | |
void ClientboundMultiBlockChange::encode(std::ostream &dest) const { | |
enc_be32(dest, chunkX); | |
enc_be32(dest, chunkZ); | |
enc_varint(dest, records.size()); | |
for(auto &el0 : records) { | |
enc_byte(dest, el0.horizontalPos); | |
enc_byte(dest, el0.y); | |
enc_varint(dest, el0.blockId); | |
} | |
} | |
void ClientboundMultiBlockChange::decode(std::istream &src) { | |
chunkX = dec_be32(src); | |
chunkZ = dec_be32(src); | |
records.resize(dec_varint(src)); | |
for(auto &el0 : records) { | |
el0.horizontalPos = dec_byte(src); | |
el0.y = dec_byte(src); | |
el0.blockId = dec_varint(src); | |
} | |
} | |
ClientboundTabComplete::ClientboundTabComplete() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_TAB_COMPLETE, | |
"ClientboundTabComplete") {} | |
void ClientboundTabComplete::encode(std::ostream &dest) const { | |
enc_varint(dest, transactionId); | |
enc_varint(dest, start); | |
enc_varint(dest, length); | |
enc_varint(dest, matches.size()); | |
for(auto &el0 : matches) { | |
enc_string(dest, el0.match); | |
enc_byte(dest, el0.tooltip.has_value()); | |
if(el0.tooltip.has_value()) { | |
enc_string(dest, el0.tooltip.value()); | |
} | |
} | |
} | |
void ClientboundTabComplete::decode(std::istream &src) { | |
transactionId = dec_varint(src); | |
start = dec_varint(src); | |
length = dec_varint(src); | |
matches.resize(dec_varint(src)); | |
for(auto &el0 : matches) { | |
el0.match = dec_string(src); | |
if(dec_byte(src)) { | |
el0.tooltip = dec_string(src); | |
} | |
} | |
} | |
ClientboundDeclareCommands::ClientboundDeclareCommands() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_DECLARE_COMMANDS, | |
"ClientboundDeclareCommands") {} | |
void ClientboundDeclareCommands::encode(std::ostream &dest) const { | |
enc_varint(dest, nodes.size()); | |
for(auto &el0 : nodes) { | |
std::uint8_t flags = 0; | |
flags |= (el0.flags.has_custom_suggestions&1)<<4; | |
flags |= (el0.flags.has_redirect_node&1)<<3; | |
flags |= (el0.flags.has_command&1)<<2; | |
flags |= (el0.flags.command_node_type&3); | |
enc_byte(dest, flags); | |
enc_varint(dest, el0.children.size()); | |
for(auto &el2 : el0.children) { | |
enc_varint(dest, el2); | |
} | |
if(el0.flags.has_redirect_node == 1) { | |
enc_varint(dest, el0.redirectNode); | |
} | |
switch(el0.flags.command_node_type) { | |
case 1: | |
enc_string(dest, el0.extraNodeData_1); | |
break; | |
case 2: | |
enc_string(dest, el0.extraNodeData_2.name); | |
enc_string(dest, el0.extraNodeData_2.parser); | |
if(!el0.extraNodeData_2.parser.compare("brigadier:double")) { | |
std::uint8_t flags = 0; | |
flags |= (el0.extraNodeData_2.brigadier_double.flags.max_present&1)<<1; | |
flags |= (el0.extraNodeData_2.brigadier_double.flags.min_present&1); | |
enc_byte(dest, flags); | |
if(el0.extraNodeData_2.brigadier_double.flags.min_present == 1) { | |
enc_bef64(dest, el0.extraNodeData_2.brigadier_double.min); | |
} | |
if(el0.extraNodeData_2.brigadier_double.flags.max_present == 1) { | |
enc_bef64(dest, el0.extraNodeData_2.brigadier_double.max); | |
} | |
} else if(!el0.extraNodeData_2.parser.compare("brigadier:float")) { | |
std::uint8_t flags = 0; | |
flags |= (el0.extraNodeData_2.brigadier_float.flags.max_present&1)<<1; | |
flags |= (el0.extraNodeData_2.brigadier_float.flags.min_present&1); | |
enc_byte(dest, flags); | |
if(el0.extraNodeData_2.brigadier_float.flags.min_present == 1) { | |
enc_bef32(dest, el0.extraNodeData_2.brigadier_float.min); | |
} | |
if(el0.extraNodeData_2.brigadier_float.flags.max_present == 1) { | |
enc_bef32(dest, el0.extraNodeData_2.brigadier_float.max); | |
} | |
} else if(!el0.extraNodeData_2.parser.compare("brigadier:integer")) { | |
std::uint8_t flags = 0; | |
flags |= (el0.extraNodeData_2.brigadier_integer.flags.max_present&1)<<1; | |
flags |= (el0.extraNodeData_2.brigadier_integer.flags.min_present&1); | |
enc_byte(dest, flags); | |
if(el0.extraNodeData_2.brigadier_integer.flags.min_present == 1) { | |
enc_be32(dest, el0.extraNodeData_2.brigadier_integer.min); | |
} | |
if(el0.extraNodeData_2.brigadier_integer.flags.max_present == 1) { | |
enc_be32(dest, el0.extraNodeData_2.brigadier_integer.max); | |
} | |
} else if(!el0.extraNodeData_2.parser.compare("brigadier:string")) { | |
enc_varint(dest, el0.extraNodeData_2.brigadier_string); | |
} else if(!el0.extraNodeData_2.parser.compare("minecraft:entity")) { | |
enc_byte(dest, el0.extraNodeData_2.minecraft_entity); | |
} else if(!el0.extraNodeData_2.parser.compare("minecraft:score_holder")) { | |
enc_byte(dest, el0.extraNodeData_2.minecraft_score_holder); | |
} | |
if(el0.flags.has_custom_suggestions == 1) { | |
enc_string(dest, el0.extraNodeData_2.suggests); | |
} | |
break; | |
} | |
} | |
enc_varint(dest, rootIndex); | |
} | |
void ClientboundDeclareCommands::decode(std::istream &src) { | |
nodes.resize(dec_varint(src)); | |
for(auto &el0 : nodes) { | |
std::uint8_t flags = dec_byte(src); | |
el0.flags.has_custom_suggestions = (flags>>4)&1; | |
el0.flags.has_redirect_node = (flags>>3)&1; | |
el0.flags.has_command = (flags>>2)&1; | |
el0.flags.command_node_type = (flags)&3; | |
el0.children.resize(dec_varint(src)); | |
for(auto &el2 : el0.children) { | |
el2 = dec_varint(src); | |
} | |
if(el0.flags.has_redirect_node == 1) { | |
el0.redirectNode = dec_varint(src); | |
} | |
switch(el0.flags.command_node_type) { | |
case 1: | |
el0.extraNodeData_1 = dec_string(src); | |
break; | |
case 2: | |
el0.extraNodeData_2.name = dec_string(src); | |
el0.extraNodeData_2.parser = dec_string(src); | |
if(!el0.extraNodeData_2.parser.compare("brigadier:double")) { | |
std::uint8_t flags = dec_byte(src); | |
el0.extraNodeData_2.brigadier_double.flags.max_present = (flags>>1)&1; | |
el0.extraNodeData_2.brigadier_double.flags.min_present = (flags)&1; | |
if(el0.extraNodeData_2.brigadier_double.flags.min_present == 1) { | |
el0.extraNodeData_2.brigadier_double.min = dec_bef64(src); | |
} | |
if(el0.extraNodeData_2.brigadier_double.flags.max_present == 1) { | |
el0.extraNodeData_2.brigadier_double.max = dec_bef64(src); | |
} | |
} else if(!el0.extraNodeData_2.parser.compare("brigadier:float")) { | |
std::uint8_t flags = dec_byte(src); | |
el0.extraNodeData_2.brigadier_float.flags.max_present = (flags>>1)&1; | |
el0.extraNodeData_2.brigadier_float.flags.min_present = (flags)&1; | |
if(el0.extraNodeData_2.brigadier_float.flags.min_present == 1) { | |
el0.extraNodeData_2.brigadier_float.min = dec_bef32(src); | |
} | |
if(el0.extraNodeData_2.brigadier_float.flags.max_present == 1) { | |
el0.extraNodeData_2.brigadier_float.max = dec_bef32(src); | |
} | |
} else if(!el0.extraNodeData_2.parser.compare("brigadier:integer")) { | |
std::uint8_t flags = dec_byte(src); | |
el0.extraNodeData_2.brigadier_integer.flags.max_present = (flags>>1)&1; | |
el0.extraNodeData_2.brigadier_integer.flags.min_present = (flags)&1; | |
if(el0.extraNodeData_2.brigadier_integer.flags.min_present == 1) { | |
el0.extraNodeData_2.brigadier_integer.min = dec_be32(src); | |
} | |
if(el0.extraNodeData_2.brigadier_integer.flags.max_present == 1) { | |
el0.extraNodeData_2.brigadier_integer.max = dec_be32(src); | |
} | |
} else if(!el0.extraNodeData_2.parser.compare("brigadier:string")) { | |
el0.extraNodeData_2.brigadier_string = dec_varint(src); | |
} else if(!el0.extraNodeData_2.parser.compare("minecraft:entity")) { | |
el0.extraNodeData_2.minecraft_entity = dec_byte(src); | |
} else if(!el0.extraNodeData_2.parser.compare("minecraft:score_holder")) { | |
el0.extraNodeData_2.minecraft_score_holder = dec_byte(src); | |
} | |
if(el0.flags.has_custom_suggestions == 1) { | |
el0.extraNodeData_2.suggests = dec_string(src); | |
} | |
break; | |
} | |
} | |
rootIndex = dec_varint(src); | |
} | |
ClientboundTransaction::ClientboundTransaction() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_TRANSACTION, | |
"ClientboundTransaction") {} | |
void ClientboundTransaction::encode(std::ostream &dest) const { | |
enc_byte(dest, windowId); | |
enc_be16(dest, action); | |
enc_byte(dest, accepted); | |
} | |
void ClientboundTransaction::decode(std::istream &src) { | |
windowId = dec_byte(src); | |
action = dec_be16(src); | |
accepted = dec_byte(src); | |
} | |
ClientboundCloseWindow::ClientboundCloseWindow() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_CLOSE_WINDOW, | |
"ClientboundCloseWindow") {} | |
void ClientboundCloseWindow::encode(std::ostream &dest) const { | |
enc_byte(dest, windowId); | |
} | |
void ClientboundCloseWindow::decode(std::istream &src) { | |
windowId = dec_byte(src); | |
} | |
ClientboundWindowItems::ClientboundWindowItems() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_WINDOW_ITEMS, | |
"ClientboundWindowItems") {} | |
void ClientboundWindowItems::encode(std::ostream &dest) const { | |
enc_byte(dest, windowId); | |
enc_be16(dest, items.size()); | |
for(auto &el0 : items) { | |
el0.encode(dest); | |
} | |
} | |
void ClientboundWindowItems::decode(std::istream &src) { | |
windowId = dec_byte(src); | |
items.resize(dec_be16(src)); | |
for(auto &el0 : items) { | |
el0.decode(src); | |
} | |
} | |
ClientboundCraftProgressBar::ClientboundCraftProgressBar() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_CRAFT_PROGRESS_BAR, | |
"ClientboundCraftProgressBar") {} | |
void ClientboundCraftProgressBar::encode(std::ostream &dest) const { | |
enc_byte(dest, windowId); | |
enc_be16(dest, property); | |
enc_be16(dest, value); | |
} | |
void ClientboundCraftProgressBar::decode(std::istream &src) { | |
windowId = dec_byte(src); | |
property = dec_be16(src); | |
value = dec_be16(src); | |
} | |
ClientboundSetSlot::ClientboundSetSlot() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_SET_SLOT, | |
"ClientboundSetSlot") {} | |
void ClientboundSetSlot::encode(std::ostream &dest) const { | |
enc_byte(dest, windowId); | |
enc_be16(dest, slot); | |
item.encode(dest); | |
} | |
void ClientboundSetSlot::decode(std::istream &src) { | |
windowId = dec_byte(src); | |
slot = dec_be16(src); | |
item.decode(src); | |
} | |
ClientboundSetCooldown::ClientboundSetCooldown() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_SET_COOLDOWN, | |
"ClientboundSetCooldown") {} | |
void ClientboundSetCooldown::encode(std::ostream &dest) const { | |
enc_varint(dest, itemID); | |
enc_varint(dest, cooldownTicks); | |
} | |
void ClientboundSetCooldown::decode(std::istream &src) { | |
itemID = dec_varint(src); | |
cooldownTicks = dec_varint(src); | |
} | |
ClientboundCustomPayload::ClientboundCustomPayload() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_CUSTOM_PAYLOAD, | |
"ClientboundCustomPayload") {} | |
void ClientboundCustomPayload::encode(std::ostream &dest) const { | |
enc_string(dest, channel); | |
dest.write(data.data(), data.size()); | |
} | |
void ClientboundCustomPayload::decode(std::istream &src) { | |
channel = dec_string(src); | |
data = std::vector<char>(std::istreambuf_iterator<char>(src), | |
std::istreambuf_iterator<char>()); | |
} | |
ClientboundNamedSoundEffect::ClientboundNamedSoundEffect() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_NAMED_SOUND_EFFECT, | |
"ClientboundNamedSoundEffect") {} | |
void ClientboundNamedSoundEffect::encode(std::ostream &dest) const { | |
enc_string(dest, soundName); | |
enc_varint(dest, soundCategory); | |
enc_be32(dest, x); | |
enc_be32(dest, y); | |
enc_be32(dest, z); | |
enc_bef32(dest, volume); | |
enc_bef32(dest, pitch); | |
} | |
void ClientboundNamedSoundEffect::decode(std::istream &src) { | |
soundName = dec_string(src); | |
soundCategory = dec_varint(src); | |
x = dec_be32(src); | |
y = dec_be32(src); | |
z = dec_be32(src); | |
volume = dec_bef32(src); | |
pitch = dec_bef32(src); | |
} | |
ClientboundKickDisconnect::ClientboundKickDisconnect() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_KICK_DISCONNECT, | |
"ClientboundKickDisconnect") {} | |
void ClientboundKickDisconnect::encode(std::ostream &dest) const { | |
enc_string(dest, reason); | |
} | |
void ClientboundKickDisconnect::decode(std::istream &src) { | |
reason = dec_string(src); | |
} | |
ClientboundEntityStatus::ClientboundEntityStatus() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ENTITY_STATUS, | |
"ClientboundEntityStatus") {} | |
void ClientboundEntityStatus::encode(std::ostream &dest) const { | |
enc_be32(dest, entityId); | |
enc_byte(dest, entityStatus); | |
} | |
void ClientboundEntityStatus::decode(std::istream &src) { | |
entityId = dec_be32(src); | |
entityStatus = dec_byte(src); | |
} | |
ClientboundExplosion::ClientboundExplosion() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_EXPLOSION, | |
"ClientboundExplosion") {} | |
void ClientboundExplosion::encode(std::ostream &dest) const { | |
enc_bef32(dest, x); | |
enc_bef32(dest, y); | |
enc_bef32(dest, z); | |
enc_bef32(dest, radius); | |
enc_be32(dest, affectedBlockOffsets.size()); | |
for(auto &el0 : affectedBlockOffsets) { | |
enc_byte(dest, el0.x); | |
enc_byte(dest, el0.y); | |
enc_byte(dest, el0.z); | |
} | |
enc_bef32(dest, playerMotionX); | |
enc_bef32(dest, playerMotionY); | |
enc_bef32(dest, playerMotionZ); | |
} | |
void ClientboundExplosion::decode(std::istream &src) { | |
x = dec_bef32(src); | |
y = dec_bef32(src); | |
z = dec_bef32(src); | |
radius = dec_bef32(src); | |
affectedBlockOffsets.resize(dec_be32(src)); | |
for(auto &el0 : affectedBlockOffsets) { | |
el0.x = dec_byte(src); | |
el0.y = dec_byte(src); | |
el0.z = dec_byte(src); | |
} | |
playerMotionX = dec_bef32(src); | |
playerMotionY = dec_bef32(src); | |
playerMotionZ = dec_bef32(src); | |
} | |
ClientboundUnloadChunk::ClientboundUnloadChunk() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_UNLOAD_CHUNK, | |
"ClientboundUnloadChunk") {} | |
void ClientboundUnloadChunk::encode(std::ostream &dest) const { | |
enc_be32(dest, chunkX); | |
enc_be32(dest, chunkZ); | |
} | |
void ClientboundUnloadChunk::decode(std::istream &src) { | |
chunkX = dec_be32(src); | |
chunkZ = dec_be32(src); | |
} | |
ClientboundGameStateChange::ClientboundGameStateChange() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_GAME_STATE_CHANGE, | |
"ClientboundGameStateChange") {} | |
void ClientboundGameStateChange::encode(std::ostream &dest) const { | |
enc_byte(dest, reason); | |
enc_bef32(dest, gameMode); | |
} | |
void ClientboundGameStateChange::decode(std::istream &src) { | |
reason = dec_byte(src); | |
gameMode = dec_bef32(src); | |
} | |
ClientboundOpenHorseWindow::ClientboundOpenHorseWindow() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_OPEN_HORSE_WINDOW, | |
"ClientboundOpenHorseWindow") {} | |
void ClientboundOpenHorseWindow::encode(std::ostream &dest) const { | |
enc_byte(dest, windowId); | |
enc_varint(dest, nbSlots); | |
enc_be32(dest, entityId); | |
} | |
void ClientboundOpenHorseWindow::decode(std::istream &src) { | |
windowId = dec_byte(src); | |
nbSlots = dec_varint(src); | |
entityId = dec_be32(src); | |
} | |
ClientboundKeepAlive::ClientboundKeepAlive() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_KEEP_ALIVE, | |
"ClientboundKeepAlive") {} | |
void ClientboundKeepAlive::encode(std::ostream &dest) const { | |
enc_be64(dest, keepAliveId); | |
} | |
void ClientboundKeepAlive::decode(std::istream &src) { | |
keepAliveId = dec_be64(src); | |
} | |
ClientboundMapChunk::ClientboundMapChunk() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_MAP_CHUNK, | |
"ClientboundMapChunk") {} | |
void ClientboundMapChunk::encode(std::ostream &dest) const { | |
enc_be32(dest, x); | |
enc_be32(dest, z); | |
enc_byte(dest, groundUp); | |
enc_byte(dest, ignoreOldData); | |
enc_varint(dest, bitMap); | |
heightmaps.encode_full(dest); | |
if(groundUp) { | |
for(auto &el1 : biomes) { | |
enc_be32(dest, el1); | |
} | |
} | |
enc_varint(dest, chunkData.size()); | |
enc_buffer(dest, chunkData); | |
enc_varint(dest, blockEntities.size()); | |
for(auto &el0 : blockEntities) { | |
el0.encode_full(dest); | |
} | |
} | |
void ClientboundMapChunk::decode(std::istream &src) { | |
x = dec_be32(src); | |
z = dec_be32(src); | |
groundUp = dec_byte(src); | |
ignoreOldData = dec_byte(src); | |
bitMap = dec_varint(src); | |
heightmaps.decode_full(src); | |
if(groundUp) { | |
for(auto &el1 : biomes) { | |
el1 = dec_be32(src); | |
} | |
} | |
chunkData = dec_buffer(src, dec_varint(src)); | |
blockEntities.resize(dec_varint(src)); | |
for(auto &el0 : blockEntities) { | |
el0.decode_full(src); | |
} | |
} | |
ClientboundWorldEvent::ClientboundWorldEvent() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_WORLD_EVENT, | |
"ClientboundWorldEvent") {} | |
void ClientboundWorldEvent::encode(std::ostream &dest) const { | |
enc_be32(dest, effectId); | |
enc_position(dest, location); | |
enc_be32(dest, data); | |
enc_byte(dest, global); | |
} | |
void ClientboundWorldEvent::decode(std::istream &src) { | |
effectId = dec_be32(src); | |
location = dec_position(src); | |
data = dec_be32(src); | |
global = dec_byte(src); | |
} | |
ClientboundWorldParticles::ClientboundWorldParticles() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_WORLD_PARTICLES, | |
"ClientboundWorldParticles") {} | |
void ClientboundWorldParticles::encode(std::ostream &dest) const { | |
enc_be32(dest, particleId); | |
enc_byte(dest, longDistance); | |
enc_bef64(dest, x); | |
enc_bef64(dest, y); | |
enc_bef64(dest, z); | |
enc_bef32(dest, offsetX); | |
enc_bef32(dest, offsetY); | |
enc_bef32(dest, offsetZ); | |
enc_bef32(dest, particleData); | |
enc_be32(dest, particles); | |
data.encode(dest); | |
} | |
void ClientboundWorldParticles::decode(std::istream &src) { | |
particleId = dec_be32(src); | |
longDistance = dec_byte(src); | |
x = dec_bef64(src); | |
y = dec_bef64(src); | |
z = dec_bef64(src); | |
offsetX = dec_bef32(src); | |
offsetY = dec_bef32(src); | |
offsetZ = dec_bef32(src); | |
particleData = dec_bef32(src); | |
particles = dec_be32(src); | |
data.decode(src, static_cast<particle_type>(particleId)); | |
} | |
ClientboundUpdateLight::ClientboundUpdateLight() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_UPDATE_LIGHT, | |
"ClientboundUpdateLight") {} | |
void ClientboundUpdateLight::encode(std::ostream &dest) const { | |
enc_varint(dest, chunkX); | |
enc_varint(dest, chunkZ); | |
enc_byte(dest, trustEdges); | |
enc_varint(dest, skyLightMask); | |
enc_varint(dest, blockLightMask); | |
enc_varint(dest, emptySkyLightMask); | |
enc_varint(dest, emptyBlockLightMask); | |
dest.write(data.data(), data.size()); | |
} | |
void ClientboundUpdateLight::decode(std::istream &src) { | |
chunkX = dec_varint(src); | |
chunkZ = dec_varint(src); | |
trustEdges = dec_byte(src); | |
skyLightMask = dec_varint(src); | |
blockLightMask = dec_varint(src); | |
emptySkyLightMask = dec_varint(src); | |
emptyBlockLightMask = dec_varint(src); | |
data = std::vector<char>(std::istreambuf_iterator<char>(src), | |
std::istreambuf_iterator<char>()); | |
} | |
ClientboundLogin::ClientboundLogin() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_LOGIN, | |
"ClientboundLogin") {} | |
void ClientboundLogin::encode(std::ostream &dest) const { | |
enc_be32(dest, entityId); | |
enc_byte(dest, gameMode); | |
enc_byte(dest, previousGameMode); | |
enc_varint(dest, worldNames.size()); | |
for(auto &el0 : worldNames) { | |
enc_string(dest, el0); | |
} | |
dimensionCodec.encode_full(dest); | |
enc_string(dest, dimension); | |
enc_string(dest, worldName); | |
enc_be64(dest, hashedSeed); | |
enc_byte(dest, maxPlayers); | |
enc_varint(dest, viewDistance); | |
enc_byte(dest, reducedDebugInfo); | |
enc_byte(dest, enableRespawnScreen); | |
enc_byte(dest, isDebug); | |
enc_byte(dest, isFlat); | |
} | |
void ClientboundLogin::decode(std::istream &src) { | |
entityId = dec_be32(src); | |
gameMode = dec_byte(src); | |
previousGameMode = dec_byte(src); | |
worldNames.resize(dec_varint(src)); | |
for(auto &el0 : worldNames) { | |
el0 = dec_string(src); | |
} | |
dimensionCodec.decode_full(src); | |
dimension = dec_string(src); | |
worldName = dec_string(src); | |
hashedSeed = dec_be64(src); | |
maxPlayers = dec_byte(src); | |
viewDistance = dec_varint(src); | |
reducedDebugInfo = dec_byte(src); | |
enableRespawnScreen = dec_byte(src); | |
isDebug = dec_byte(src); | |
isFlat = dec_byte(src); | |
} | |
ClientboundMap::ClientboundMap() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_MAP, | |
"ClientboundMap") {} | |
void ClientboundMap::encode(std::ostream &dest) const { | |
enc_varint(dest, itemDamage); | |
enc_byte(dest, scale); | |
enc_byte(dest, trackingPosition); | |
enc_byte(dest, locked); | |
enc_varint(dest, icons.size()); | |
for(auto &el0 : icons) { | |
enc_varint(dest, el0.type); | |
enc_byte(dest, el0.x); | |
enc_byte(dest, el0.y); | |
enc_byte(dest, el0.direction); | |
enc_byte(dest, el0.displayName.has_value()); | |
if(el0.displayName.has_value()) { | |
enc_string(dest, el0.displayName.value()); | |
} | |
} | |
enc_byte(dest, columns); | |
if(columns != 0) { | |
enc_byte(dest, rows); | |
enc_byte(dest, x); | |
enc_byte(dest, y); | |
enc_varint(dest, data.size()); | |
enc_buffer(dest, data); | |
} | |
} | |
void ClientboundMap::decode(std::istream &src) { | |
itemDamage = dec_varint(src); | |
scale = dec_byte(src); | |
trackingPosition = dec_byte(src); | |
locked = dec_byte(src); | |
icons.resize(dec_varint(src)); | |
for(auto &el0 : icons) { | |
el0.type = dec_varint(src); | |
el0.x = dec_byte(src); | |
el0.y = dec_byte(src); | |
el0.direction = dec_byte(src); | |
if(dec_byte(src)) { | |
el0.displayName = dec_string(src); | |
} | |
} | |
columns = dec_byte(src); | |
if(columns != 0) { | |
rows = dec_byte(src); | |
x = dec_byte(src); | |
y = dec_byte(src); | |
data = dec_buffer(src, dec_varint(src)); | |
} | |
} | |
ClientboundTradeList::ClientboundTradeList() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_TRADE_LIST, | |
"ClientboundTradeList") {} | |
void ClientboundTradeList::encode(std::ostream &dest) const { | |
enc_varint(dest, windowId); | |
enc_byte(dest, trades.size()); | |
for(auto &el0 : trades) { | |
el0.inputItem1.encode(dest); | |
el0.outputItem.encode(dest); | |
enc_byte(dest, el0.inputItem2.has_value()); | |
if(el0.inputItem2.has_value()) { | |
el0.inputItem2.value().encode(dest); | |
} | |
enc_byte(dest, el0.tradeDisabled); | |
enc_be32(dest, el0.nbTradeUses); | |
enc_be32(dest, el0.maximumNbTradeUses); | |
enc_be32(dest, el0.xp); | |
enc_be32(dest, el0.specialPrice); | |
enc_bef32(dest, el0.priceMultiplier); | |
enc_be32(dest, el0.demand); | |
} | |
enc_varint(dest, villagerLevel); | |
enc_varint(dest, experience); | |
enc_byte(dest, isRegularVillager); | |
enc_byte(dest, canRestock); | |
} | |
void ClientboundTradeList::decode(std::istream &src) { | |
windowId = dec_varint(src); | |
trades.resize(dec_byte(src)); | |
for(auto &el0 : trades) { | |
el0.inputItem1.decode(src); | |
el0.outputItem.decode(src); | |
if(dec_byte(src)) { | |
el0.inputItem2.emplace().decode(src); | |
} | |
el0.tradeDisabled = dec_byte(src); | |
el0.nbTradeUses = dec_be32(src); | |
el0.maximumNbTradeUses = dec_be32(src); | |
el0.xp = dec_be32(src); | |
el0.specialPrice = dec_be32(src); | |
el0.priceMultiplier = dec_bef32(src); | |
el0.demand = dec_be32(src); | |
} | |
villagerLevel = dec_varint(src); | |
experience = dec_varint(src); | |
isRegularVillager = dec_byte(src); | |
canRestock = dec_byte(src); | |
} | |
ClientboundRelEntityMove::ClientboundRelEntityMove() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_REL_ENTITY_MOVE, | |
"ClientboundRelEntityMove") {} | |
void ClientboundRelEntityMove::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_be16(dest, dX); | |
enc_be16(dest, dY); | |
enc_be16(dest, dZ); | |
enc_byte(dest, onGround); | |
} | |
void ClientboundRelEntityMove::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
dX = dec_be16(src); | |
dY = dec_be16(src); | |
dZ = dec_be16(src); | |
onGround = dec_byte(src); | |
} | |
ClientboundEntityMoveLook::ClientboundEntityMoveLook() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ENTITY_MOVE_LOOK, | |
"ClientboundEntityMoveLook") {} | |
void ClientboundEntityMoveLook::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_be16(dest, dX); | |
enc_be16(dest, dY); | |
enc_be16(dest, dZ); | |
enc_byte(dest, yaw); | |
enc_byte(dest, pitch); | |
enc_byte(dest, onGround); | |
} | |
void ClientboundEntityMoveLook::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
dX = dec_be16(src); | |
dY = dec_be16(src); | |
dZ = dec_be16(src); | |
yaw = dec_byte(src); | |
pitch = dec_byte(src); | |
onGround = dec_byte(src); | |
} | |
ClientboundEntityLook::ClientboundEntityLook() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ENTITY_LOOK, | |
"ClientboundEntityLook") {} | |
void ClientboundEntityLook::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_byte(dest, yaw); | |
enc_byte(dest, pitch); | |
enc_byte(dest, onGround); | |
} | |
void ClientboundEntityLook::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
yaw = dec_byte(src); | |
pitch = dec_byte(src); | |
onGround = dec_byte(src); | |
} | |
ClientboundEntity::ClientboundEntity() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ENTITY, | |
"ClientboundEntity") {} | |
void ClientboundEntity::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
} | |
void ClientboundEntity::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
} | |
ClientboundVehicleMove::ClientboundVehicleMove() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_VEHICLE_MOVE, | |
"ClientboundVehicleMove") {} | |
void ClientboundVehicleMove::encode(std::ostream &dest) const { | |
enc_bef64(dest, x); | |
enc_bef64(dest, y); | |
enc_bef64(dest, z); | |
enc_bef32(dest, yaw); | |
enc_bef32(dest, pitch); | |
} | |
void ClientboundVehicleMove::decode(std::istream &src) { | |
x = dec_bef64(src); | |
y = dec_bef64(src); | |
z = dec_bef64(src); | |
yaw = dec_bef32(src); | |
pitch = dec_bef32(src); | |
} | |
ClientboundOpenBook::ClientboundOpenBook() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_OPEN_BOOK, | |
"ClientboundOpenBook") {} | |
void ClientboundOpenBook::encode(std::ostream &dest) const { | |
enc_varint(dest, hand); | |
} | |
void ClientboundOpenBook::decode(std::istream &src) { | |
hand = dec_varint(src); | |
} | |
ClientboundOpenWindow::ClientboundOpenWindow() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_OPEN_WINDOW, | |
"ClientboundOpenWindow") {} | |
void ClientboundOpenWindow::encode(std::ostream &dest) const { | |
enc_varint(dest, windowId); | |
enc_varint(dest, inventoryType); | |
enc_string(dest, windowTitle); | |
} | |
void ClientboundOpenWindow::decode(std::istream &src) { | |
windowId = dec_varint(src); | |
inventoryType = dec_varint(src); | |
windowTitle = dec_string(src); | |
} | |
ClientboundOpenSignEntity::ClientboundOpenSignEntity() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_OPEN_SIGN_ENTITY, | |
"ClientboundOpenSignEntity") {} | |
void ClientboundOpenSignEntity::encode(std::ostream &dest) const { | |
enc_position(dest, location); | |
} | |
void ClientboundOpenSignEntity::decode(std::istream &src) { | |
location = dec_position(src); | |
} | |
ClientboundCraftRecipeResponse::ClientboundCraftRecipeResponse() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_CRAFT_RECIPE_RESPONSE, | |
"ClientboundCraftRecipeResponse") {} | |
void ClientboundCraftRecipeResponse::encode(std::ostream &dest) const { | |
enc_byte(dest, windowId); | |
enc_string(dest, recipe); | |
} | |
void ClientboundCraftRecipeResponse::decode(std::istream &src) { | |
windowId = dec_byte(src); | |
recipe = dec_string(src); | |
} | |
ClientboundAbilities::ClientboundAbilities() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ABILITIES, | |
"ClientboundAbilities") {} | |
void ClientboundAbilities::encode(std::ostream &dest) const { | |
enc_byte(dest, flags); | |
enc_bef32(dest, flyingSpeed); | |
enc_bef32(dest, walkingSpeed); | |
} | |
void ClientboundAbilities::decode(std::istream &src) { | |
flags = dec_byte(src); | |
flyingSpeed = dec_bef32(src); | |
walkingSpeed = dec_bef32(src); | |
} | |
ClientboundCombatEvent::ClientboundCombatEvent() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_COMBAT_EVENT, | |
"ClientboundCombatEvent") {} | |
void ClientboundCombatEvent::encode(std::ostream &dest) const { | |
enc_varint(dest, event); | |
switch(event) { | |
case 1: | |
enc_varint(dest, duration); | |
enc_be32(dest, entityId); | |
break; | |
case 2: | |
enc_varint(dest, playerId); | |
enc_be32(dest, entityId); | |
enc_string(dest, message); | |
break; | |
} | |
} | |
void ClientboundCombatEvent::decode(std::istream &src) { | |
event = dec_varint(src); | |
switch(event) { | |
case 1: | |
duration = dec_varint(src); | |
entityId = dec_be32(src); | |
break; | |
case 2: | |
playerId = dec_varint(src); | |
entityId = dec_be32(src); | |
message = dec_string(src); | |
break; | |
} | |
} | |
ClientboundPlayerInfo::ClientboundPlayerInfo() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_PLAYER_INFO, | |
"ClientboundPlayerInfo") {} | |
void ClientboundPlayerInfo::encode(std::ostream &dest) const { | |
enc_varint(dest, action); | |
enc_varint(dest, data.size()); | |
for(auto &el0 : data) { | |
enc_uuid(dest, el0.UUID); | |
switch(action) { | |
case 0: | |
enc_string(dest, el0.name); | |
enc_varint(dest, el0.properties.size()); | |
for(auto &el3 : el0.properties) { | |
enc_string(dest, el3.name); | |
enc_string(dest, el3.value); | |
enc_byte(dest, el3.signature.has_value()); | |
if(el3.signature.has_value()) { | |
enc_string(dest, el3.signature.value()); | |
} | |
} | |
enc_varint(dest, el0.gamemode); | |
enc_varint(dest, el0.ping); | |
enc_byte(dest, el0.displayName.has_value()); | |
if(el0.displayName.has_value()) { | |
enc_string(dest, el0.displayName.value()); | |
} | |
break; | |
case 1: | |
enc_varint(dest, el0.gamemode); | |
break; | |
case 2: | |
enc_varint(dest, el0.ping); | |
break; | |
case 3: | |
enc_byte(dest, el0.displayName.has_value()); | |
if(el0.displayName.has_value()) { | |
enc_string(dest, el0.displayName.value()); | |
} | |
break; | |
} | |
} | |
} | |
void ClientboundPlayerInfo::decode(std::istream &src) { | |
action = dec_varint(src); | |
data.resize(dec_varint(src)); | |
for(auto &el0 : data) { | |
el0.UUID = dec_uuid(src); | |
switch(action) { | |
case 0: | |
el0.name = dec_string(src); | |
el0.properties.resize(dec_varint(src)); | |
for(auto &el3 : el0.properties) { | |
el3.name = dec_string(src); | |
el3.value = dec_string(src); | |
if(dec_byte(src)) { | |
el3.signature = dec_string(src); | |
} | |
} | |
el0.gamemode = dec_varint(src); | |
el0.ping = dec_varint(src); | |
if(dec_byte(src)) { | |
el0.displayName = dec_string(src); | |
} | |
break; | |
case 1: | |
el0.gamemode = dec_varint(src); | |
break; | |
case 2: | |
el0.ping = dec_varint(src); | |
break; | |
case 3: | |
if(dec_byte(src)) { | |
el0.displayName = dec_string(src); | |
} | |
break; | |
} | |
} | |
} | |
ClientboundFacePlayer::ClientboundFacePlayer() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_FACE_PLAYER, | |
"ClientboundFacePlayer") {} | |
void ClientboundFacePlayer::encode(std::ostream &dest) const { | |
enc_varint(dest, feet_eyes); | |
enc_bef64(dest, x); | |
enc_bef64(dest, y); | |
enc_bef64(dest, z); | |
enc_byte(dest, isEntity); | |
if(isEntity) { | |
enc_varint(dest, entityId); | |
enc_string(dest, entity_feet_eyes); | |
} | |
} | |
void ClientboundFacePlayer::decode(std::istream &src) { | |
feet_eyes = dec_varint(src); | |
x = dec_bef64(src); | |
y = dec_bef64(src); | |
z = dec_bef64(src); | |
isEntity = dec_byte(src); | |
if(isEntity) { | |
entityId = dec_varint(src); | |
entity_feet_eyes = dec_string(src); | |
} | |
} | |
ClientboundPosition::ClientboundPosition() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_POSITION, | |
"ClientboundPosition") {} | |
void ClientboundPosition::encode(std::ostream &dest) const { | |
enc_bef64(dest, x); | |
enc_bef64(dest, y); | |
enc_bef64(dest, z); | |
enc_bef32(dest, yaw); | |
enc_bef32(dest, pitch); | |
enc_byte(dest, flags); | |
enc_varint(dest, teleportId); | |
} | |
void ClientboundPosition::decode(std::istream &src) { | |
x = dec_bef64(src); | |
y = dec_bef64(src); | |
z = dec_bef64(src); | |
yaw = dec_bef32(src); | |
pitch = dec_bef32(src); | |
flags = dec_byte(src); | |
teleportId = dec_varint(src); | |
} | |
ClientboundUnlockRecipes::ClientboundUnlockRecipes() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_UNLOCK_RECIPES, | |
"ClientboundUnlockRecipes") {} | |
void ClientboundUnlockRecipes::encode(std::ostream &dest) const { | |
enc_varint(dest, action); | |
enc_byte(dest, craftingBookOpen); | |
enc_byte(dest, filteringCraftable); | |
enc_byte(dest, smeltingBookOpen); | |
enc_byte(dest, filteringSmeltable); | |
enc_varint(dest, recipes1.size()); | |
for(auto &el0 : recipes1) { | |
enc_string(dest, el0); | |
} | |
if(action == 0) { | |
enc_varint(dest, recipes2.size()); | |
for(auto &el1 : recipes2) { | |
enc_string(dest, el1); | |
} | |
} | |
} | |
void ClientboundUnlockRecipes::decode(std::istream &src) { | |
action = dec_varint(src); | |
craftingBookOpen = dec_byte(src); | |
filteringCraftable = dec_byte(src); | |
smeltingBookOpen = dec_byte(src); | |
filteringSmeltable = dec_byte(src); | |
recipes1.resize(dec_varint(src)); | |
for(auto &el0 : recipes1) { | |
el0 = dec_string(src); | |
} | |
if(action == 0) { | |
recipes2.resize(dec_varint(src)); | |
for(auto &el1 : recipes2) { | |
el1 = dec_string(src); | |
} | |
} | |
} | |
ClientboundEntityDestroy::ClientboundEntityDestroy() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ENTITY_DESTROY, | |
"ClientboundEntityDestroy") {} | |
void ClientboundEntityDestroy::encode(std::ostream &dest) const { | |
enc_varint(dest, entityIds.size()); | |
for(auto &el0 : entityIds) { | |
enc_varint(dest, el0); | |
} | |
} | |
void ClientboundEntityDestroy::decode(std::istream &src) { | |
entityIds.resize(dec_varint(src)); | |
for(auto &el0 : entityIds) { | |
el0 = dec_varint(src); | |
} | |
} | |
ClientboundRemoveEntityEffect::ClientboundRemoveEntityEffect() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_REMOVE_ENTITY_EFFECT, | |
"ClientboundRemoveEntityEffect") {} | |
void ClientboundRemoveEntityEffect::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_byte(dest, effectId); | |
} | |
void ClientboundRemoveEntityEffect::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
effectId = dec_byte(src); | |
} | |
ClientboundResourcePackSend::ClientboundResourcePackSend() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_RESOURCE_PACK_SEND, | |
"ClientboundResourcePackSend") {} | |
void ClientboundResourcePackSend::encode(std::ostream &dest) const { | |
enc_string(dest, url); | |
enc_string(dest, hash); | |
} | |
void ClientboundResourcePackSend::decode(std::istream &src) { | |
url = dec_string(src); | |
hash = dec_string(src); | |
} | |
ClientboundRespawn::ClientboundRespawn() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_RESPAWN, | |
"ClientboundRespawn") {} | |
void ClientboundRespawn::encode(std::ostream &dest) const { | |
enc_string(dest, dimension); | |
enc_string(dest, worldName); | |
enc_be64(dest, hashedSeed); | |
enc_byte(dest, gamemode); | |
enc_byte(dest, previousGamemode); | |
enc_byte(dest, isDebug); | |
enc_byte(dest, isFlat); | |
enc_byte(dest, copyMetadata); | |
} | |
void ClientboundRespawn::decode(std::istream &src) { | |
dimension = dec_string(src); | |
worldName = dec_string(src); | |
hashedSeed = dec_be64(src); | |
gamemode = dec_byte(src); | |
previousGamemode = dec_byte(src); | |
isDebug = dec_byte(src); | |
isFlat = dec_byte(src); | |
copyMetadata = dec_byte(src); | |
} | |
ClientboundEntityHeadRotation::ClientboundEntityHeadRotation() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ENTITY_HEAD_ROTATION, | |
"ClientboundEntityHeadRotation") {} | |
void ClientboundEntityHeadRotation::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_byte(dest, headYaw); | |
} | |
void ClientboundEntityHeadRotation::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
headYaw = dec_byte(src); | |
} | |
ClientboundSelectAdvancementTab::ClientboundSelectAdvancementTab() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_SELECT_ADVANCEMENT_TAB, | |
"ClientboundSelectAdvancementTab") {} | |
void ClientboundSelectAdvancementTab::encode(std::ostream &dest) const { | |
enc_byte(dest, id.has_value()); | |
if(id.has_value()) { | |
enc_string(dest, id.value()); | |
} | |
} | |
void ClientboundSelectAdvancementTab::decode(std::istream &src) { | |
if(dec_byte(src)) { | |
id = dec_string(src); | |
} | |
} | |
ClientboundWorldBorder::ClientboundWorldBorder() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_WORLD_BORDER, | |
"ClientboundWorldBorder") {} | |
void ClientboundWorldBorder::encode(std::ostream &dest) const { | |
enc_varint(dest, action); | |
switch(action) { | |
case 0: | |
enc_bef64(dest, radius); | |
break; | |
case 1: | |
enc_bef64(dest, old_radius); | |
enc_bef64(dest, new_radius); | |
enc_varint(dest, speed); | |
break; | |
case 2: | |
enc_bef64(dest, x); | |
enc_bef64(dest, z); | |
break; | |
case 3: | |
enc_bef64(dest, x); | |
enc_bef64(dest, z); | |
enc_bef64(dest, old_radius); | |
enc_bef64(dest, new_radius); | |
enc_varint(dest, speed); | |
enc_varint(dest, portalBoundary); | |
enc_varint(dest, warning_time); | |
enc_varint(dest, warning_blocks); | |
break; | |
case 4: | |
enc_varint(dest, warning_time); | |
break; | |
case 5: | |
enc_varint(dest, warning_blocks); | |
break; | |
} | |
} | |
void ClientboundWorldBorder::decode(std::istream &src) { | |
action = dec_varint(src); | |
switch(action) { | |
case 0: | |
radius = dec_bef64(src); | |
break; | |
case 1: | |
old_radius = dec_bef64(src); | |
new_radius = dec_bef64(src); | |
speed = dec_varint(src); | |
break; | |
case 2: | |
x = dec_bef64(src); | |
z = dec_bef64(src); | |
break; | |
case 3: | |
x = dec_bef64(src); | |
z = dec_bef64(src); | |
old_radius = dec_bef64(src); | |
new_radius = dec_bef64(src); | |
speed = dec_varint(src); | |
portalBoundary = dec_varint(src); | |
warning_time = dec_varint(src); | |
warning_blocks = dec_varint(src); | |
break; | |
case 4: | |
warning_time = dec_varint(src); | |
break; | |
case 5: | |
warning_blocks = dec_varint(src); | |
break; | |
} | |
} | |
ClientboundCamera::ClientboundCamera() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_CAMERA, | |
"ClientboundCamera") {} | |
void ClientboundCamera::encode(std::ostream &dest) const { | |
enc_varint(dest, cameraId); | |
} | |
void ClientboundCamera::decode(std::istream &src) { | |
cameraId = dec_varint(src); | |
} | |
ClientboundHeldItemSlot::ClientboundHeldItemSlot() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_HELD_ITEM_SLOT, | |
"ClientboundHeldItemSlot") {} | |
void ClientboundHeldItemSlot::encode(std::ostream &dest) const { | |
enc_byte(dest, slot); | |
} | |
void ClientboundHeldItemSlot::decode(std::istream &src) { | |
slot = dec_byte(src); | |
} | |
ClientboundUpdateViewPosition::ClientboundUpdateViewPosition() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_UPDATE_VIEW_POSITION, | |
"ClientboundUpdateViewPosition") {} | |
void ClientboundUpdateViewPosition::encode(std::ostream &dest) const { | |
enc_varint(dest, chunkX); | |
enc_varint(dest, chunkZ); | |
} | |
void ClientboundUpdateViewPosition::decode(std::istream &src) { | |
chunkX = dec_varint(src); | |
chunkZ = dec_varint(src); | |
} | |
ClientboundUpdateViewDistance::ClientboundUpdateViewDistance() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_UPDATE_VIEW_DISTANCE, | |
"ClientboundUpdateViewDistance") {} | |
void ClientboundUpdateViewDistance::encode(std::ostream &dest) const { | |
enc_varint(dest, viewDistance); | |
} | |
void ClientboundUpdateViewDistance::decode(std::istream &src) { | |
viewDistance = dec_varint(src); | |
} | |
ClientboundSpawnPosition::ClientboundSpawnPosition() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_SPAWN_POSITION, | |
"ClientboundSpawnPosition") {} | |
void ClientboundSpawnPosition::encode(std::ostream &dest) const { | |
enc_position(dest, location); | |
} | |
void ClientboundSpawnPosition::decode(std::istream &src) { | |
location = dec_position(src); | |
} | |
ClientboundScoreboardDisplayObjective::ClientboundScoreboardDisplayObjective() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_SCOREBOARD_DISPLAY_OBJECTIVE, | |
"ClientboundScoreboardDisplayObjective") {} | |
void ClientboundScoreboardDisplayObjective::encode(std::ostream &dest) const { | |
enc_byte(dest, position); | |
enc_string(dest, name); | |
} | |
void ClientboundScoreboardDisplayObjective::decode(std::istream &src) { | |
position = dec_byte(src); | |
name = dec_string(src); | |
} | |
ClientboundEntityMetadata::ClientboundEntityMetadata() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ENTITY_METADATA, | |
"ClientboundEntityMetadata") {} | |
void ClientboundEntityMetadata::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
metadata.encode(dest); | |
} | |
void ClientboundEntityMetadata::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
metadata.decode(src); | |
} | |
ClientboundAttachEntity::ClientboundAttachEntity() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ATTACH_ENTITY, | |
"ClientboundAttachEntity") {} | |
void ClientboundAttachEntity::encode(std::ostream &dest) const { | |
enc_be32(dest, entityId); | |
enc_be32(dest, vehicleId); | |
} | |
void ClientboundAttachEntity::decode(std::istream &src) { | |
entityId = dec_be32(src); | |
vehicleId = dec_be32(src); | |
} | |
ClientboundEntityVelocity::ClientboundEntityVelocity() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ENTITY_VELOCITY, | |
"ClientboundEntityVelocity") {} | |
void ClientboundEntityVelocity::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_be16(dest, velocityX); | |
enc_be16(dest, velocityY); | |
enc_be16(dest, velocityZ); | |
} | |
void ClientboundEntityVelocity::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
velocityX = dec_be16(src); | |
velocityY = dec_be16(src); | |
velocityZ = dec_be16(src); | |
} | |
ClientboundEntityEquipment::ClientboundEntityEquipment() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ENTITY_EQUIPMENT, | |
"ClientboundEntityEquipment") {} | |
void ClientboundEntityEquipment::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
equipments.encode(dest); | |
} | |
void ClientboundEntityEquipment::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
equipments.decode(src); | |
} | |
ClientboundExperience::ClientboundExperience() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_EXPERIENCE, | |
"ClientboundExperience") {} | |
void ClientboundExperience::encode(std::ostream &dest) const { | |
enc_bef32(dest, experienceBar); | |
enc_varint(dest, level); | |
enc_varint(dest, totalExperience); | |
} | |
void ClientboundExperience::decode(std::istream &src) { | |
experienceBar = dec_bef32(src); | |
level = dec_varint(src); | |
totalExperience = dec_varint(src); | |
} | |
ClientboundUpdateHealth::ClientboundUpdateHealth() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_UPDATE_HEALTH, | |
"ClientboundUpdateHealth") {} | |
void ClientboundUpdateHealth::encode(std::ostream &dest) const { | |
enc_bef32(dest, health); | |
enc_varint(dest, food); | |
enc_bef32(dest, foodSaturation); | |
} | |
void ClientboundUpdateHealth::decode(std::istream &src) { | |
health = dec_bef32(src); | |
food = dec_varint(src); | |
foodSaturation = dec_bef32(src); | |
} | |
ClientboundScoreboardObjective::ClientboundScoreboardObjective() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_SCOREBOARD_OBJECTIVE, | |
"ClientboundScoreboardObjective") {} | |
void ClientboundScoreboardObjective::encode(std::ostream &dest) const { | |
enc_string(dest, name); | |
enc_byte(dest, action); | |
switch(action) { | |
case 0: | |
enc_string(dest, displayText); | |
enc_varint(dest, type); | |
break; | |
case 2: | |
enc_string(dest, displayText); | |
enc_varint(dest, type); | |
break; | |
} | |
} | |
void ClientboundScoreboardObjective::decode(std::istream &src) { | |
name = dec_string(src); | |
action = dec_byte(src); | |
switch(action) { | |
case 0: | |
displayText = dec_string(src); | |
type = dec_varint(src); | |
break; | |
case 2: | |
displayText = dec_string(src); | |
type = dec_varint(src); | |
break; | |
} | |
} | |
ClientboundSetPassengers::ClientboundSetPassengers() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_SET_PASSENGERS, | |
"ClientboundSetPassengers") {} | |
void ClientboundSetPassengers::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_varint(dest, passengers.size()); | |
for(auto &el0 : passengers) { | |
enc_varint(dest, el0); | |
} | |
} | |
void ClientboundSetPassengers::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
passengers.resize(dec_varint(src)); | |
for(auto &el0 : passengers) { | |
el0 = dec_varint(src); | |
} | |
} | |
ClientboundTeams::ClientboundTeams() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_TEAMS, | |
"ClientboundTeams") {} | |
void ClientboundTeams::encode(std::ostream &dest) const { | |
enc_string(dest, team); | |
enc_byte(dest, mode); | |
switch(mode) { | |
case 0: | |
enc_string(dest, name); | |
enc_byte(dest, friendlyFire); | |
enc_string(dest, nameTagVisibility); | |
enc_string(dest, collisionRule); | |
enc_varint(dest, formatting); | |
enc_string(dest, prefix); | |
enc_string(dest, suffix); | |
enc_varint(dest, players.size()); | |
for(auto &el1 : players) { | |
enc_string(dest, el1); | |
} | |
break; | |
case 2: | |
enc_string(dest, name); | |
enc_byte(dest, friendlyFire); | |
enc_string(dest, nameTagVisibility); | |
enc_string(dest, collisionRule); | |
enc_varint(dest, formatting); | |
enc_string(dest, prefix); | |
enc_string(dest, suffix); | |
break; | |
case 3: | |
enc_varint(dest, players.size()); | |
for(auto &el1 : players) { | |
enc_string(dest, el1); | |
} | |
break; | |
case 4: | |
enc_varint(dest, players.size()); | |
for(auto &el1 : players) { | |
enc_string(dest, el1); | |
} | |
break; | |
} | |
} | |
void ClientboundTeams::decode(std::istream &src) { | |
team = dec_string(src); | |
mode = dec_byte(src); | |
switch(mode) { | |
case 0: | |
name = dec_string(src); | |
friendlyFire = dec_byte(src); | |
nameTagVisibility = dec_string(src); | |
collisionRule = dec_string(src); | |
formatting = dec_varint(src); | |
prefix = dec_string(src); | |
suffix = dec_string(src); | |
players.resize(dec_varint(src)); | |
for(auto &el1 : players) { | |
el1 = dec_string(src); | |
} | |
break; | |
case 2: | |
name = dec_string(src); | |
friendlyFire = dec_byte(src); | |
nameTagVisibility = dec_string(src); | |
collisionRule = dec_string(src); | |
formatting = dec_varint(src); | |
prefix = dec_string(src); | |
suffix = dec_string(src); | |
break; | |
case 3: | |
players.resize(dec_varint(src)); | |
for(auto &el1 : players) { | |
el1 = dec_string(src); | |
} | |
break; | |
case 4: | |
players.resize(dec_varint(src)); | |
for(auto &el1 : players) { | |
el1 = dec_string(src); | |
} | |
break; | |
} | |
} | |
ClientboundScoreboardScore::ClientboundScoreboardScore() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_SCOREBOARD_SCORE, | |
"ClientboundScoreboardScore") {} | |
void ClientboundScoreboardScore::encode(std::ostream &dest) const { | |
enc_string(dest, itemName); | |
enc_byte(dest, action); | |
enc_string(dest, scoreName); | |
if(action != 1) { | |
enc_varint(dest, value); | |
} | |
} | |
void ClientboundScoreboardScore::decode(std::istream &src) { | |
itemName = dec_string(src); | |
action = dec_byte(src); | |
scoreName = dec_string(src); | |
if(action != 1) { | |
value = dec_varint(src); | |
} | |
} | |
ClientboundUpdateTime::ClientboundUpdateTime() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_UPDATE_TIME, | |
"ClientboundUpdateTime") {} | |
void ClientboundUpdateTime::encode(std::ostream &dest) const { | |
enc_be64(dest, age); | |
enc_be64(dest, time); | |
} | |
void ClientboundUpdateTime::decode(std::istream &src) { | |
age = dec_be64(src); | |
time = dec_be64(src); | |
} | |
ClientboundTitle::ClientboundTitle() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_TITLE, | |
"ClientboundTitle") {} | |
void ClientboundTitle::encode(std::ostream &dest) const { | |
enc_varint(dest, action); | |
switch(action) { | |
case 0: | |
enc_string(dest, text); | |
break; | |
case 1: | |
enc_string(dest, text); | |
break; | |
case 2: | |
enc_string(dest, text); | |
break; | |
case 3: | |
enc_be32(dest, fadeIn); | |
enc_be32(dest, stay); | |
enc_be32(dest, fadeOut); | |
break; | |
} | |
} | |
void ClientboundTitle::decode(std::istream &src) { | |
action = dec_varint(src); | |
switch(action) { | |
case 0: | |
text = dec_string(src); | |
break; | |
case 1: | |
text = dec_string(src); | |
break; | |
case 2: | |
text = dec_string(src); | |
break; | |
case 3: | |
fadeIn = dec_be32(src); | |
stay = dec_be32(src); | |
fadeOut = dec_be32(src); | |
break; | |
} | |
} | |
ClientboundEntitySoundEffect::ClientboundEntitySoundEffect() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ENTITY_SOUND_EFFECT, | |
"ClientboundEntitySoundEffect") {} | |
void ClientboundEntitySoundEffect::encode(std::ostream &dest) const { | |
enc_varint(dest, soundId); | |
enc_varint(dest, soundCategory); | |
enc_varint(dest, entityId); | |
enc_bef32(dest, volume); | |
enc_bef32(dest, pitch); | |
} | |
void ClientboundEntitySoundEffect::decode(std::istream &src) { | |
soundId = dec_varint(src); | |
soundCategory = dec_varint(src); | |
entityId = dec_varint(src); | |
volume = dec_bef32(src); | |
pitch = dec_bef32(src); | |
} | |
ClientboundSoundEffect::ClientboundSoundEffect() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_SOUND_EFFECT, | |
"ClientboundSoundEffect") {} | |
void ClientboundSoundEffect::encode(std::ostream &dest) const { | |
enc_varint(dest, soundId); | |
enc_varint(dest, soundCategory); | |
enc_be32(dest, x); | |
enc_be32(dest, y); | |
enc_be32(dest, z); | |
enc_bef32(dest, volume); | |
enc_bef32(dest, pitch); | |
} | |
void ClientboundSoundEffect::decode(std::istream &src) { | |
soundId = dec_varint(src); | |
soundCategory = dec_varint(src); | |
x = dec_be32(src); | |
y = dec_be32(src); | |
z = dec_be32(src); | |
volume = dec_bef32(src); | |
pitch = dec_bef32(src); | |
} | |
ClientboundStopSound::ClientboundStopSound() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_STOP_SOUND, | |
"ClientboundStopSound") {} | |
void ClientboundStopSound::encode(std::ostream &dest) const { | |
enc_byte(dest, flags); | |
switch(flags) { | |
case 1: | |
enc_varint(dest, source); | |
break; | |
case 2: | |
enc_string(dest, sound); | |
break; | |
case 3: | |
enc_varint(dest, source); | |
enc_string(dest, sound); | |
break; | |
} | |
} | |
void ClientboundStopSound::decode(std::istream &src) { | |
flags = dec_byte(src); | |
switch(flags) { | |
case 1: | |
source = dec_varint(src); | |
break; | |
case 2: | |
sound = dec_string(src); | |
break; | |
case 3: | |
source = dec_varint(src); | |
sound = dec_string(src); | |
break; | |
} | |
} | |
ClientboundPlayerlistHeader::ClientboundPlayerlistHeader() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_PLAYERLIST_HEADER, | |
"ClientboundPlayerlistHeader") {} | |
void ClientboundPlayerlistHeader::encode(std::ostream &dest) const { | |
enc_string(dest, header); | |
enc_string(dest, footer); | |
} | |
void ClientboundPlayerlistHeader::decode(std::istream &src) { | |
header = dec_string(src); | |
footer = dec_string(src); | |
} | |
ClientboundNbtQueryResponse::ClientboundNbtQueryResponse() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_NBT_QUERY_RESPONSE, | |
"ClientboundNbtQueryResponse") {} | |
void ClientboundNbtQueryResponse::encode(std::ostream &dest) const { | |
enc_varint(dest, transactionId); | |
nbt.encode_full(dest); | |
} | |
void ClientboundNbtQueryResponse::decode(std::istream &src) { | |
transactionId = dec_varint(src); | |
nbt.decode_full(src); | |
} | |
ClientboundCollect::ClientboundCollect() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_COLLECT, | |
"ClientboundCollect") {} | |
void ClientboundCollect::encode(std::ostream &dest) const { | |
enc_varint(dest, collectedEntityId); | |
enc_varint(dest, collectorEntityId); | |
enc_varint(dest, pickupItemCount); | |
} | |
void ClientboundCollect::decode(std::istream &src) { | |
collectedEntityId = dec_varint(src); | |
collectorEntityId = dec_varint(src); | |
pickupItemCount = dec_varint(src); | |
} | |
ClientboundEntityTeleport::ClientboundEntityTeleport() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ENTITY_TELEPORT, | |
"ClientboundEntityTeleport") {} | |
void ClientboundEntityTeleport::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_bef64(dest, x); | |
enc_bef64(dest, y); | |
enc_bef64(dest, z); | |
enc_byte(dest, yaw); | |
enc_byte(dest, pitch); | |
enc_byte(dest, onGround); | |
} | |
void ClientboundEntityTeleport::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
x = dec_bef64(src); | |
y = dec_bef64(src); | |
z = dec_bef64(src); | |
yaw = dec_byte(src); | |
pitch = dec_byte(src); | |
onGround = dec_byte(src); | |
} | |
ClientboundAdvancements::ClientboundAdvancements() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ADVANCEMENTS, | |
"ClientboundAdvancements") {} | |
void ClientboundAdvancements::encode(std::ostream &dest) const { | |
enc_byte(dest, reset); | |
enc_varint(dest, advancementMapping.size()); | |
for(auto &el0 : advancementMapping) { | |
enc_string(dest, el0.key); | |
enc_byte(dest, el0.value.parentId.has_value()); | |
if(el0.value.parentId.has_value()) { | |
enc_string(dest, el0.value.parentId.value()); | |
} | |
enc_byte(dest, el0.value.displayData.has_value()); | |
if(el0.value.displayData.has_value()) { | |
enc_string(dest, el0.value.displayData.value().title); | |
enc_string(dest, el0.value.displayData.value().description); | |
el0.value.displayData.value().icon.encode(dest); | |
enc_varint(dest, el0.value.displayData.value().frameType); | |
std::uint32_t flags = 0; | |
flags |= (el0.value.displayData.value().flags.hidden&1)<<2; | |
flags |= (el0.value.displayData.value().flags.show_toast&1)<<1; | |
flags |= (el0.value.displayData.value().flags.has_background_texture&1); | |
enc_be32(dest, flags); | |
if(el0.value.displayData.value().flags.has_background_texture == 1) { | |
enc_string(dest, el0.value.displayData.value().backgroundTexture); | |
} | |
enc_bef32(dest, el0.value.displayData.value().xCord); | |
enc_bef32(dest, el0.value.displayData.value().yCord); | |
} | |
enc_varint(dest, el0.value.criteria.size()); | |
for(auto &el3 : el0.value.criteria) { | |
enc_string(dest, el3.key); | |
// 'el3.value' is a void type | |
} | |
enc_varint(dest, el0.value.requirements.size()); | |
for(auto &el3 : el0.value.requirements) { | |
enc_varint(dest, el3.size()); | |
for(auto &el4 : el3) { | |
enc_string(dest, el4); | |
} | |
} | |
} | |
enc_varint(dest, identifiers.size()); | |
for(auto &el0 : identifiers) { | |
enc_string(dest, el0); | |
} | |
enc_varint(dest, progressMapping.size()); | |
for(auto &el0 : progressMapping) { | |
enc_string(dest, el0.key); | |
enc_varint(dest, el0.value.size()); | |
for(auto &el2 : el0.value) { | |
enc_string(dest, el2.criterionIdentifier); | |
enc_byte(dest, el2.criterionProgress.has_value()); | |
if(el2.criterionProgress.has_value()) { | |
enc_be64(dest, el2.criterionProgress.value()); | |
} | |
} | |
} | |
} | |
void ClientboundAdvancements::decode(std::istream &src) { | |
reset = dec_byte(src); | |
advancementMapping.resize(dec_varint(src)); | |
for(auto &el0 : advancementMapping) { | |
el0.key = dec_string(src); | |
if(dec_byte(src)) { | |
el0.value.parentId = dec_string(src); | |
} | |
if(dec_byte(src)) { | |
el0.value.displayData.emplace(); | |
el0.value.displayData.value().title = dec_string(src); | |
el0.value.displayData.value().description = dec_string(src); | |
el0.value.displayData.value().icon.decode(src); | |
el0.value.displayData.value().frameType = dec_varint(src); | |
std::uint32_t flags = dec_be32(src); | |
el0.value.displayData.value().flags.hidden = (flags>>2)&1; | |
el0.value.displayData.value().flags.show_toast = (flags>>1)&1; | |
el0.value.displayData.value().flags.has_background_texture = (flags)&1; | |
if(el0.value.displayData.value().flags.has_background_texture == 1) { | |
el0.value.displayData.value().backgroundTexture = dec_string(src); | |
} | |
el0.value.displayData.value().xCord = dec_bef32(src); | |
el0.value.displayData.value().yCord = dec_bef32(src); | |
} | |
el0.value.criteria.resize(dec_varint(src)); | |
for(auto &el3 : el0.value.criteria) { | |
el3.key = dec_string(src); | |
// 'el3.value' is a void type | |
} | |
el0.value.requirements.resize(dec_varint(src)); | |
for(auto &el3 : el0.value.requirements) { | |
el3.resize(dec_varint(src)); | |
for(auto &el4 : el3) { | |
el4 = dec_string(src); | |
} | |
} | |
} | |
identifiers.resize(dec_varint(src)); | |
for(auto &el0 : identifiers) { | |
el0 = dec_string(src); | |
} | |
progressMapping.resize(dec_varint(src)); | |
for(auto &el0 : progressMapping) { | |
el0.key = dec_string(src); | |
el0.value.resize(dec_varint(src)); | |
for(auto &el2 : el0.value) { | |
el2.criterionIdentifier = dec_string(src); | |
if(dec_byte(src)) { | |
el2.criterionProgress = dec_be64(src); | |
} | |
} | |
} | |
} | |
ClientboundEntityUpdateAttributes::ClientboundEntityUpdateAttributes() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ENTITY_UPDATE_ATTRIBUTES, | |
"ClientboundEntityUpdateAttributes") {} | |
void ClientboundEntityUpdateAttributes::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_be32(dest, properties.size()); | |
for(auto &el0 : properties) { | |
enc_string(dest, el0.key); | |
enc_bef64(dest, el0.value); | |
enc_varint(dest, el0.modifiers.size()); | |
for(auto &el2 : el0.modifiers) { | |
enc_uuid(dest, el2.uuid); | |
enc_bef64(dest, el2.amount); | |
enc_byte(dest, el2.operation); | |
} | |
} | |
} | |
void ClientboundEntityUpdateAttributes::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
properties.resize(dec_be32(src)); | |
for(auto &el0 : properties) { | |
el0.key = dec_string(src); | |
el0.value = dec_bef64(src); | |
el0.modifiers.resize(dec_varint(src)); | |
for(auto &el2 : el0.modifiers) { | |
el2.uuid = dec_uuid(src); | |
el2.amount = dec_bef64(src); | |
el2.operation = dec_byte(src); | |
} | |
} | |
} | |
ClientboundEntityEffect::ClientboundEntityEffect() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_ENTITY_EFFECT, | |
"ClientboundEntityEffect") {} | |
void ClientboundEntityEffect::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_byte(dest, effectId); | |
enc_byte(dest, amplifier); | |
enc_varint(dest, duration); | |
enc_byte(dest, hideParticles); | |
} | |
void ClientboundEntityEffect::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
effectId = dec_byte(src); | |
amplifier = dec_byte(src); | |
duration = dec_varint(src); | |
hideParticles = dec_byte(src); | |
} | |
ClientboundDeclareRecipes::ClientboundDeclareRecipes() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_DECLARE_RECIPES, | |
"ClientboundDeclareRecipes") {} | |
void ClientboundDeclareRecipes::encode(std::ostream &dest) const { | |
enc_varint(dest, recipes.size()); | |
for(auto &el0 : recipes) { | |
enc_string(dest, el0.type); | |
enc_string(dest, el0.recipeId); | |
if(!el0.type.compare("minecraft:crafting_shapeless")) { | |
enc_string(dest, el0.minecraft_crafting_shapeless.group); | |
enc_varint(dest, el0.minecraft_crafting_shapeless.ingredients.size()); | |
for(auto &el4 : el0.minecraft_crafting_shapeless.ingredients) { | |
enc_varint(dest, el4.size()); | |
for(auto &el5 : el4) | |
el5.encode(dest); | |
} | |
el0.minecraft_crafting_shapeless.result.encode(dest); | |
} else if(!el0.type.compare("minecraft:crafting_shaped")) { | |
enc_varint(dest, el0.minecraft_crafting_shaped.width); | |
enc_varint(dest, el0.minecraft_crafting_shaped.height); | |
enc_string(dest, el0.minecraft_crafting_shaped.group); | |
for(auto &el4 : el0.minecraft_crafting_shaped.ingredients) { | |
for(auto &el5 : el4) { | |
enc_varint(dest, el5.size()); | |
for(auto &el6 : el5) | |
el6.encode(dest); | |
} | |
} | |
el0.minecraft_crafting_shaped.result.encode(dest); | |
} else if(!el0.type.compare("minecraft:smelting")) { | |
el0.minecraft_smelting.encode(dest); | |
} else if(!el0.type.compare("minecraft:blasting")) { | |
el0.minecraft_blasting.encode(dest); | |
} else if(!el0.type.compare("minecraft:smoking")) { | |
el0.minecraft_smoking.encode(dest); | |
} else if(!el0.type.compare("minecraft:campfire_cooking")) { | |
el0.minecraft_campfire_cooking.encode(dest); | |
} else if(!el0.type.compare("minecraft:stonecutting")) { | |
enc_string(dest, el0.minecraft_stonecutting.group); | |
enc_varint(dest, el0.minecraft_stonecutting.ingredient.size()); | |
for(auto &el4 : el0.minecraft_stonecutting.ingredient) | |
el4.encode(dest); | |
el0.minecraft_stonecutting.result.encode(dest); | |
} else if(!el0.type.compare("minecraft:smithing")) { | |
enc_varint(dest, el0.minecraft_smithing.base.size()); | |
for(auto &el4 : el0.minecraft_smithing.base) | |
el4.encode(dest); | |
enc_varint(dest, el0.minecraft_smithing.addition.size()); | |
for(auto &el4 : el0.minecraft_smithing.addition) | |
el4.encode(dest); | |
el0.minecraft_smithing.result.encode(dest); | |
} | |
} | |
} | |
void ClientboundDeclareRecipes::decode(std::istream &src) { | |
recipes.resize(dec_varint(src)); | |
for(auto &el0 : recipes) { | |
el0.type = dec_string(src); | |
el0.recipeId = dec_string(src); | |
if(!el0.type.compare("minecraft:crafting_shapeless")) { | |
el0.minecraft_crafting_shapeless.group = dec_string(src); | |
el0.minecraft_crafting_shapeless.ingredients.resize(dec_varint(src)); | |
for(auto &el4 : el0.minecraft_crafting_shapeless.ingredients) { | |
el4.resize(dec_varint(src)); | |
for(auto &el5 : el4) | |
el5.decode(src); | |
} | |
el0.minecraft_crafting_shapeless.result.decode(src); | |
} else if(!el0.type.compare("minecraft:crafting_shaped")) { | |
el0.minecraft_crafting_shaped.width = dec_varint(src); | |
el0.minecraft_crafting_shaped.height = dec_varint(src); | |
el0.minecraft_crafting_shaped.group = dec_string(src); | |
el0.minecraft_crafting_shaped.ingredients.resize(el0.minecraft_crafting_shaped.width); | |
for(auto &el4 : el0.minecraft_crafting_shaped.ingredients) { | |
el4.resize(el0.minecraft_crafting_shaped.height); | |
for(auto &el5 : el4) { | |
el5.resize(dec_varint(src)); | |
for(auto &el6 : el5) | |
el6.decode(src); | |
} | |
} | |
el0.minecraft_crafting_shaped.result.decode(src); | |
} else if(!el0.type.compare("minecraft:smelting")) { | |
el0.minecraft_smelting.decode(src); | |
} else if(!el0.type.compare("minecraft:blasting")) { | |
el0.minecraft_blasting.decode(src); | |
} else if(!el0.type.compare("minecraft:smoking")) { | |
el0.minecraft_smoking.decode(src); | |
} else if(!el0.type.compare("minecraft:campfire_cooking")) { | |
el0.minecraft_campfire_cooking.decode(src); | |
} else if(!el0.type.compare("minecraft:stonecutting")) { | |
el0.minecraft_stonecutting.group = dec_string(src); | |
el0.minecraft_stonecutting.ingredient.resize(dec_varint(src)); | |
for(auto &el4 : el0.minecraft_stonecutting.ingredient) | |
el4.decode(src); | |
el0.minecraft_stonecutting.result.decode(src); | |
} else if(!el0.type.compare("minecraft:smithing")) { | |
el0.minecraft_smithing.base.resize(dec_varint(src)); | |
for(auto &el4 : el0.minecraft_smithing.base) | |
el4.decode(src); | |
el0.minecraft_smithing.addition.resize(dec_varint(src)); | |
for(auto &el4 : el0.minecraft_smithing.addition) | |
el4.decode(src); | |
el0.minecraft_smithing.result.decode(src); | |
} | |
} | |
} | |
ClientboundTags::ClientboundTags() : | |
Packet(PLAY, CLIENTBOUND, CB_PL_TAGS, | |
"ClientboundTags") {} | |
void ClientboundTags::encode(std::ostream &dest) const { | |
enc_varint(dest, blockTags.size()); | |
for(auto &el0 : blockTags) | |
el0.encode(dest); | |
enc_varint(dest, itemTags.size()); | |
for(auto &el0 : itemTags) | |
el0.encode(dest); | |
enc_varint(dest, fluidTags.size()); | |
for(auto &el0 : fluidTags) | |
el0.encode(dest); | |
enc_varint(dest, entityTags.size()); | |
for(auto &el0 : entityTags) | |
el0.encode(dest); | |
} | |
void ClientboundTags::decode(std::istream &src) { | |
blockTags.resize(dec_varint(src)); | |
for(auto &el0 : blockTags) | |
el0.decode(src); | |
itemTags.resize(dec_varint(src)); | |
for(auto &el0 : itemTags) | |
el0.decode(src); | |
fluidTags.resize(dec_varint(src)); | |
for(auto &el0 : fluidTags) | |
el0.decode(src); | |
entityTags.resize(dec_varint(src)); | |
for(auto &el0 : entityTags) | |
el0.decode(src); | |
} | |
ServerboundTeleportConfirm::ServerboundTeleportConfirm() : | |
Packet(PLAY, SERVERBOUND, SB_PL_TELEPORT_CONFIRM, | |
"ServerboundTeleportConfirm") {} | |
void ServerboundTeleportConfirm::encode(std::ostream &dest) const { | |
enc_varint(dest, teleportId); | |
} | |
void ServerboundTeleportConfirm::decode(std::istream &src) { | |
teleportId = dec_varint(src); | |
} | |
ServerboundQueryBlockNbt::ServerboundQueryBlockNbt() : | |
Packet(PLAY, SERVERBOUND, SB_PL_QUERY_BLOCK_NBT, | |
"ServerboundQueryBlockNbt") {} | |
void ServerboundQueryBlockNbt::encode(std::ostream &dest) const { | |
enc_varint(dest, transactionId); | |
enc_position(dest, location); | |
} | |
void ServerboundQueryBlockNbt::decode(std::istream &src) { | |
transactionId = dec_varint(src); | |
location = dec_position(src); | |
} | |
ServerboundSetDifficulty::ServerboundSetDifficulty() : | |
Packet(PLAY, SERVERBOUND, SB_PL_SET_DIFFICULTY, | |
"ServerboundSetDifficulty") {} | |
void ServerboundSetDifficulty::encode(std::ostream &dest) const { | |
enc_byte(dest, newDifficulty); | |
} | |
void ServerboundSetDifficulty::decode(std::istream &src) { | |
newDifficulty = dec_byte(src); | |
} | |
ServerboundChat::ServerboundChat() : | |
Packet(PLAY, SERVERBOUND, SB_PL_CHAT, | |
"ServerboundChat") {} | |
void ServerboundChat::encode(std::ostream &dest) const { | |
enc_string(dest, message); | |
} | |
void ServerboundChat::decode(std::istream &src) { | |
message = dec_string(src); | |
} | |
ServerboundClientCommand::ServerboundClientCommand() : | |
Packet(PLAY, SERVERBOUND, SB_PL_CLIENT_COMMAND, | |
"ServerboundClientCommand") {} | |
void ServerboundClientCommand::encode(std::ostream &dest) const { | |
enc_varint(dest, actionId); | |
} | |
void ServerboundClientCommand::decode(std::istream &src) { | |
actionId = dec_varint(src); | |
} | |
ServerboundSettings::ServerboundSettings() : | |
Packet(PLAY, SERVERBOUND, SB_PL_SETTINGS, | |
"ServerboundSettings") {} | |
void ServerboundSettings::encode(std::ostream &dest) const { | |
enc_string(dest, locale); | |
enc_byte(dest, viewDistance); | |
enc_varint(dest, chatFlags); | |
enc_byte(dest, chatColors); | |
enc_byte(dest, skinParts); | |
enc_varint(dest, mainHand); | |
} | |
void ServerboundSettings::decode(std::istream &src) { | |
locale = dec_string(src); | |
viewDistance = dec_byte(src); | |
chatFlags = dec_varint(src); | |
chatColors = dec_byte(src); | |
skinParts = dec_byte(src); | |
mainHand = dec_varint(src); | |
} | |
ServerboundTabComplete::ServerboundTabComplete() : | |
Packet(PLAY, SERVERBOUND, SB_PL_TAB_COMPLETE, | |
"ServerboundTabComplete") {} | |
void ServerboundTabComplete::encode(std::ostream &dest) const { | |
enc_varint(dest, transactionId); | |
enc_string(dest, text); | |
} | |
void ServerboundTabComplete::decode(std::istream &src) { | |
transactionId = dec_varint(src); | |
text = dec_string(src); | |
} | |
ServerboundTransaction::ServerboundTransaction() : | |
Packet(PLAY, SERVERBOUND, SB_PL_TRANSACTION, | |
"ServerboundTransaction") {} | |
void ServerboundTransaction::encode(std::ostream &dest) const { | |
enc_byte(dest, windowId); | |
enc_be16(dest, action); | |
enc_byte(dest, accepted); | |
} | |
void ServerboundTransaction::decode(std::istream &src) { | |
windowId = dec_byte(src); | |
action = dec_be16(src); | |
accepted = dec_byte(src); | |
} | |
ServerboundEnchantItem::ServerboundEnchantItem() : | |
Packet(PLAY, SERVERBOUND, SB_PL_ENCHANT_ITEM, | |
"ServerboundEnchantItem") {} | |
void ServerboundEnchantItem::encode(std::ostream &dest) const { | |
enc_byte(dest, windowId); | |
enc_byte(dest, enchantment); | |
} | |
void ServerboundEnchantItem::decode(std::istream &src) { | |
windowId = dec_byte(src); | |
enchantment = dec_byte(src); | |
} | |
ServerboundWindowClick::ServerboundWindowClick() : | |
Packet(PLAY, SERVERBOUND, SB_PL_WINDOW_CLICK, | |
"ServerboundWindowClick") {} | |
void ServerboundWindowClick::encode(std::ostream &dest) const { | |
enc_byte(dest, windowId); | |
enc_be16(dest, slot); | |
enc_byte(dest, mouseButton); | |
enc_be16(dest, action); | |
enc_byte(dest, mode); | |
item.encode(dest); | |
} | |
void ServerboundWindowClick::decode(std::istream &src) { | |
windowId = dec_byte(src); | |
slot = dec_be16(src); | |
mouseButton = dec_byte(src); | |
action = dec_be16(src); | |
mode = dec_byte(src); | |
item.decode(src); | |
} | |
ServerboundCloseWindow::ServerboundCloseWindow() : | |
Packet(PLAY, SERVERBOUND, SB_PL_CLOSE_WINDOW, | |
"ServerboundCloseWindow") {} | |
void ServerboundCloseWindow::encode(std::ostream &dest) const { | |
enc_byte(dest, windowId); | |
} | |
void ServerboundCloseWindow::decode(std::istream &src) { | |
windowId = dec_byte(src); | |
} | |
ServerboundCustomPayload::ServerboundCustomPayload() : | |
Packet(PLAY, SERVERBOUND, SB_PL_CUSTOM_PAYLOAD, | |
"ServerboundCustomPayload") {} | |
void ServerboundCustomPayload::encode(std::ostream &dest) const { | |
enc_string(dest, channel); | |
dest.write(data.data(), data.size()); | |
} | |
void ServerboundCustomPayload::decode(std::istream &src) { | |
channel = dec_string(src); | |
data = std::vector<char>(std::istreambuf_iterator<char>(src), | |
std::istreambuf_iterator<char>()); | |
} | |
ServerboundEditBook::ServerboundEditBook() : | |
Packet(PLAY, SERVERBOUND, SB_PL_EDIT_BOOK, | |
"ServerboundEditBook") {} | |
void ServerboundEditBook::encode(std::ostream &dest) const { | |
new_book.encode(dest); | |
enc_byte(dest, signing); | |
enc_varint(dest, hand); | |
} | |
void ServerboundEditBook::decode(std::istream &src) { | |
new_book.decode(src); | |
signing = dec_byte(src); | |
hand = dec_varint(src); | |
} | |
ServerboundQueryEntityNbt::ServerboundQueryEntityNbt() : | |
Packet(PLAY, SERVERBOUND, SB_PL_QUERY_ENTITY_NBT, | |
"ServerboundQueryEntityNbt") {} | |
void ServerboundQueryEntityNbt::encode(std::ostream &dest) const { | |
enc_varint(dest, transactionId); | |
enc_varint(dest, entityId); | |
} | |
void ServerboundQueryEntityNbt::decode(std::istream &src) { | |
transactionId = dec_varint(src); | |
entityId = dec_varint(src); | |
} | |
ServerboundUseEntity::ServerboundUseEntity() : | |
Packet(PLAY, SERVERBOUND, SB_PL_USE_ENTITY, | |
"ServerboundUseEntity") {} | |
void ServerboundUseEntity::encode(std::ostream &dest) const { | |
enc_varint(dest, target); | |
enc_varint(dest, mouse); | |
switch(mouse) { | |
case 0: | |
enc_varint(dest, hand); | |
break; | |
case 2: | |
enc_bef32(dest, x); | |
enc_bef32(dest, y); | |
enc_bef32(dest, z); | |
enc_varint(dest, hand); | |
break; | |
} | |
enc_byte(dest, sneaking); | |
} | |
void ServerboundUseEntity::decode(std::istream &src) { | |
target = dec_varint(src); | |
mouse = dec_varint(src); | |
switch(mouse) { | |
case 0: | |
hand = dec_varint(src); | |
break; | |
case 2: | |
x = dec_bef32(src); | |
y = dec_bef32(src); | |
z = dec_bef32(src); | |
hand = dec_varint(src); | |
break; | |
} | |
sneaking = dec_byte(src); | |
} | |
ServerboundGenerateStructure::ServerboundGenerateStructure() : | |
Packet(PLAY, SERVERBOUND, SB_PL_GENERATE_STRUCTURE, | |
"ServerboundGenerateStructure") {} | |
void ServerboundGenerateStructure::encode(std::ostream &dest) const { | |
enc_position(dest, location); | |
enc_varint(dest, levels); | |
enc_byte(dest, keepJigsaws); | |
} | |
void ServerboundGenerateStructure::decode(std::istream &src) { | |
location = dec_position(src); | |
levels = dec_varint(src); | |
keepJigsaws = dec_byte(src); | |
} | |
ServerboundKeepAlive::ServerboundKeepAlive() : | |
Packet(PLAY, SERVERBOUND, SB_PL_KEEP_ALIVE, | |
"ServerboundKeepAlive") {} | |
void ServerboundKeepAlive::encode(std::ostream &dest) const { | |
enc_be64(dest, keepAliveId); | |
} | |
void ServerboundKeepAlive::decode(std::istream &src) { | |
keepAliveId = dec_be64(src); | |
} | |
ServerboundLockDifficulty::ServerboundLockDifficulty() : | |
Packet(PLAY, SERVERBOUND, SB_PL_LOCK_DIFFICULTY, | |
"ServerboundLockDifficulty") {} | |
void ServerboundLockDifficulty::encode(std::ostream &dest) const { | |
enc_byte(dest, locked); | |
} | |
void ServerboundLockDifficulty::decode(std::istream &src) { | |
locked = dec_byte(src); | |
} | |
ServerboundPosition::ServerboundPosition() : | |
Packet(PLAY, SERVERBOUND, SB_PL_POSITION, | |
"ServerboundPosition") {} | |
void ServerboundPosition::encode(std::ostream &dest) const { | |
enc_bef64(dest, x); | |
enc_bef64(dest, y); | |
enc_bef64(dest, z); | |
enc_byte(dest, onGround); | |
} | |
void ServerboundPosition::decode(std::istream &src) { | |
x = dec_bef64(src); | |
y = dec_bef64(src); | |
z = dec_bef64(src); | |
onGround = dec_byte(src); | |
} | |
ServerboundPositionLook::ServerboundPositionLook() : | |
Packet(PLAY, SERVERBOUND, SB_PL_POSITION_LOOK, | |
"ServerboundPositionLook") {} | |
void ServerboundPositionLook::encode(std::ostream &dest) const { | |
enc_bef64(dest, x); | |
enc_bef64(dest, y); | |
enc_bef64(dest, z); | |
enc_bef32(dest, yaw); | |
enc_bef32(dest, pitch); | |
enc_byte(dest, onGround); | |
} | |
void ServerboundPositionLook::decode(std::istream &src) { | |
x = dec_bef64(src); | |
y = dec_bef64(src); | |
z = dec_bef64(src); | |
yaw = dec_bef32(src); | |
pitch = dec_bef32(src); | |
onGround = dec_byte(src); | |
} | |
ServerboundLook::ServerboundLook() : | |
Packet(PLAY, SERVERBOUND, SB_PL_LOOK, | |
"ServerboundLook") {} | |
void ServerboundLook::encode(std::ostream &dest) const { | |
enc_bef32(dest, yaw); | |
enc_bef32(dest, pitch); | |
enc_byte(dest, onGround); | |
} | |
void ServerboundLook::decode(std::istream &src) { | |
yaw = dec_bef32(src); | |
pitch = dec_bef32(src); | |
onGround = dec_byte(src); | |
} | |
ServerboundFlying::ServerboundFlying() : | |
Packet(PLAY, SERVERBOUND, SB_PL_FLYING, | |
"ServerboundFlying") {} | |
void ServerboundFlying::encode(std::ostream &dest) const { | |
enc_byte(dest, onGround); | |
} | |
void ServerboundFlying::decode(std::istream &src) { | |
onGround = dec_byte(src); | |
} | |
ServerboundVehicleMove::ServerboundVehicleMove() : | |
Packet(PLAY, SERVERBOUND, SB_PL_VEHICLE_MOVE, | |
"ServerboundVehicleMove") {} | |
void ServerboundVehicleMove::encode(std::ostream &dest) const { | |
enc_bef64(dest, x); | |
enc_bef64(dest, y); | |
enc_bef64(dest, z); | |
enc_bef32(dest, yaw); | |
enc_bef32(dest, pitch); | |
} | |
void ServerboundVehicleMove::decode(std::istream &src) { | |
x = dec_bef64(src); | |
y = dec_bef64(src); | |
z = dec_bef64(src); | |
yaw = dec_bef32(src); | |
pitch = dec_bef32(src); | |
} | |
ServerboundSteerBoat::ServerboundSteerBoat() : | |
Packet(PLAY, SERVERBOUND, SB_PL_STEER_BOAT, | |
"ServerboundSteerBoat") {} | |
void ServerboundSteerBoat::encode(std::ostream &dest) const { | |
enc_byte(dest, leftPaddle); | |
enc_byte(dest, rightPaddle); | |
} | |
void ServerboundSteerBoat::decode(std::istream &src) { | |
leftPaddle = dec_byte(src); | |
rightPaddle = dec_byte(src); | |
} | |
ServerboundPickItem::ServerboundPickItem() : | |
Packet(PLAY, SERVERBOUND, SB_PL_PICK_ITEM, | |
"ServerboundPickItem") {} | |
void ServerboundPickItem::encode(std::ostream &dest) const { | |
enc_varint(dest, slot); | |
} | |
void ServerboundPickItem::decode(std::istream &src) { | |
slot = dec_varint(src); | |
} | |
ServerboundCraftRecipeRequest::ServerboundCraftRecipeRequest() : | |
Packet(PLAY, SERVERBOUND, SB_PL_CRAFT_RECIPE_REQUEST, | |
"ServerboundCraftRecipeRequest") {} | |
void ServerboundCraftRecipeRequest::encode(std::ostream &dest) const { | |
enc_byte(dest, windowId); | |
enc_string(dest, recipe); | |
enc_byte(dest, makeAll); | |
} | |
void ServerboundCraftRecipeRequest::decode(std::istream &src) { | |
windowId = dec_byte(src); | |
recipe = dec_string(src); | |
makeAll = dec_byte(src); | |
} | |
ServerboundAbilities::ServerboundAbilities() : | |
Packet(PLAY, SERVERBOUND, SB_PL_ABILITIES, | |
"ServerboundAbilities") {} | |
void ServerboundAbilities::encode(std::ostream &dest) const { | |
enc_byte(dest, flags); | |
} | |
void ServerboundAbilities::decode(std::istream &src) { | |
flags = dec_byte(src); | |
} | |
ServerboundBlockDig::ServerboundBlockDig() : | |
Packet(PLAY, SERVERBOUND, SB_PL_BLOCK_DIG, | |
"ServerboundBlockDig") {} | |
void ServerboundBlockDig::encode(std::ostream &dest) const { | |
enc_byte(dest, status); | |
enc_position(dest, location); | |
enc_byte(dest, face); | |
} | |
void ServerboundBlockDig::decode(std::istream &src) { | |
status = dec_byte(src); | |
location = dec_position(src); | |
face = dec_byte(src); | |
} | |
ServerboundEntityAction::ServerboundEntityAction() : | |
Packet(PLAY, SERVERBOUND, SB_PL_ENTITY_ACTION, | |
"ServerboundEntityAction") {} | |
void ServerboundEntityAction::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_varint(dest, actionId); | |
enc_varint(dest, jumpBoost); | |
} | |
void ServerboundEntityAction::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
actionId = dec_varint(src); | |
jumpBoost = dec_varint(src); | |
} | |
ServerboundSteerVehicle::ServerboundSteerVehicle() : | |
Packet(PLAY, SERVERBOUND, SB_PL_STEER_VEHICLE, | |
"ServerboundSteerVehicle") {} | |
void ServerboundSteerVehicle::encode(std::ostream &dest) const { | |
enc_bef32(dest, sideways); | |
enc_bef32(dest, forward); | |
enc_byte(dest, jump); | |
} | |
void ServerboundSteerVehicle::decode(std::istream &src) { | |
sideways = dec_bef32(src); | |
forward = dec_bef32(src); | |
jump = dec_byte(src); | |
} | |
ServerboundCraftingBookData::ServerboundCraftingBookData() : | |
Packet(PLAY, SERVERBOUND, SB_PL_CRAFTING_BOOK_DATA, | |
"ServerboundCraftingBookData") {} | |
void ServerboundCraftingBookData::encode(std::ostream &dest) const { | |
enc_varint(dest, type); | |
switch(type) { | |
case 0: | |
enc_string(dest, displayedRecipe); | |
break; | |
case 1: | |
enc_byte(dest, craftingBookOpen); | |
enc_byte(dest, craftingFilter); | |
enc_byte(dest, smeltingBookOpen); | |
enc_byte(dest, smeltingFilter); | |
enc_byte(dest, blastingBookOpen); | |
enc_byte(dest, blastingFilter); | |
enc_byte(dest, smokingBookOpen); | |
enc_byte(dest, smokingFilter); | |
break; | |
} | |
} | |
void ServerboundCraftingBookData::decode(std::istream &src) { | |
type = dec_varint(src); | |
switch(type) { | |
case 0: | |
displayedRecipe = dec_string(src); | |
break; | |
case 1: | |
craftingBookOpen = dec_byte(src); | |
craftingFilter = dec_byte(src); | |
smeltingBookOpen = dec_byte(src); | |
smeltingFilter = dec_byte(src); | |
blastingBookOpen = dec_byte(src); | |
blastingFilter = dec_byte(src); | |
smokingBookOpen = dec_byte(src); | |
smokingFilter = dec_byte(src); | |
break; | |
} | |
} | |
ServerboundNameItem::ServerboundNameItem() : | |
Packet(PLAY, SERVERBOUND, SB_PL_NAME_ITEM, | |
"ServerboundNameItem") {} | |
void ServerboundNameItem::encode(std::ostream &dest) const { | |
enc_string(dest, name); | |
} | |
void ServerboundNameItem::decode(std::istream &src) { | |
name = dec_string(src); | |
} | |
ServerboundResourcePackReceive::ServerboundResourcePackReceive() : | |
Packet(PLAY, SERVERBOUND, SB_PL_RESOURCE_PACK_RECEIVE, | |
"ServerboundResourcePackReceive") {} | |
void ServerboundResourcePackReceive::encode(std::ostream &dest) const { | |
enc_varint(dest, result); | |
} | |
void ServerboundResourcePackReceive::decode(std::istream &src) { | |
result = dec_varint(src); | |
} | |
ServerboundAdvancementTab::ServerboundAdvancementTab() : | |
Packet(PLAY, SERVERBOUND, SB_PL_ADVANCEMENT_TAB, | |
"ServerboundAdvancementTab") {} | |
void ServerboundAdvancementTab::encode(std::ostream &dest) const { | |
enc_varint(dest, action); | |
if(action == 0) { | |
enc_string(dest, tabId); | |
} | |
} | |
void ServerboundAdvancementTab::decode(std::istream &src) { | |
action = dec_varint(src); | |
if(action == 0) { | |
tabId = dec_string(src); | |
} | |
} | |
ServerboundSelectTrade::ServerboundSelectTrade() : | |
Packet(PLAY, SERVERBOUND, SB_PL_SELECT_TRADE, | |
"ServerboundSelectTrade") {} | |
void ServerboundSelectTrade::encode(std::ostream &dest) const { | |
enc_varint(dest, slot); | |
} | |
void ServerboundSelectTrade::decode(std::istream &src) { | |
slot = dec_varint(src); | |
} | |
ServerboundSetBeaconEffect::ServerboundSetBeaconEffect() : | |
Packet(PLAY, SERVERBOUND, SB_PL_SET_BEACON_EFFECT, | |
"ServerboundSetBeaconEffect") {} | |
void ServerboundSetBeaconEffect::encode(std::ostream &dest) const { | |
enc_varint(dest, primary_effect); | |
enc_varint(dest, secondary_effect); | |
} | |
void ServerboundSetBeaconEffect::decode(std::istream &src) { | |
primary_effect = dec_varint(src); | |
secondary_effect = dec_varint(src); | |
} | |
ServerboundHeldItemSlot::ServerboundHeldItemSlot() : | |
Packet(PLAY, SERVERBOUND, SB_PL_HELD_ITEM_SLOT, | |
"ServerboundHeldItemSlot") {} | |
void ServerboundHeldItemSlot::encode(std::ostream &dest) const { | |
enc_be16(dest, slotId); | |
} | |
void ServerboundHeldItemSlot::decode(std::istream &src) { | |
slotId = dec_be16(src); | |
} | |
ServerboundUpdateCommandBlock::ServerboundUpdateCommandBlock() : | |
Packet(PLAY, SERVERBOUND, SB_PL_UPDATE_COMMAND_BLOCK, | |
"ServerboundUpdateCommandBlock") {} | |
void ServerboundUpdateCommandBlock::encode(std::ostream &dest) const { | |
enc_position(dest, location); | |
enc_string(dest, command); | |
enc_varint(dest, mode); | |
enc_byte(dest, flags); | |
} | |
void ServerboundUpdateCommandBlock::decode(std::istream &src) { | |
location = dec_position(src); | |
command = dec_string(src); | |
mode = dec_varint(src); | |
flags = dec_byte(src); | |
} | |
ServerboundUpdateCommandBlockMinecart::ServerboundUpdateCommandBlockMinecart() : | |
Packet(PLAY, SERVERBOUND, SB_PL_UPDATE_COMMAND_BLOCK_MINECART, | |
"ServerboundUpdateCommandBlockMinecart") {} | |
void ServerboundUpdateCommandBlockMinecart::encode(std::ostream &dest) const { | |
enc_varint(dest, entityId); | |
enc_string(dest, command); | |
enc_byte(dest, track_output); | |
} | |
void ServerboundUpdateCommandBlockMinecart::decode(std::istream &src) { | |
entityId = dec_varint(src); | |
command = dec_string(src); | |
track_output = dec_byte(src); | |
} | |
ServerboundSetCreativeSlot::ServerboundSetCreativeSlot() : | |
Packet(PLAY, SERVERBOUND, SB_PL_SET_CREATIVE_SLOT, | |
"ServerboundSetCreativeSlot") {} | |
void ServerboundSetCreativeSlot::encode(std::ostream &dest) const { | |
enc_be16(dest, slot); | |
item.encode(dest); | |
} | |
void ServerboundSetCreativeSlot::decode(std::istream &src) { | |
slot = dec_be16(src); | |
item.decode(src); | |
} | |
ServerboundUpdateJigsawBlock::ServerboundUpdateJigsawBlock() : | |
Packet(PLAY, SERVERBOUND, SB_PL_UPDATE_JIGSAW_BLOCK, | |
"ServerboundUpdateJigsawBlock") {} | |
void ServerboundUpdateJigsawBlock::encode(std::ostream &dest) const { | |
enc_position(dest, location); | |
enc_string(dest, name); | |
enc_string(dest, target); | |
enc_string(dest, pool); | |
enc_string(dest, finalState); | |
enc_string(dest, jointType); | |
} | |
void ServerboundUpdateJigsawBlock::decode(std::istream &src) { | |
location = dec_position(src); | |
name = dec_string(src); | |
target = dec_string(src); | |
pool = dec_string(src); | |
finalState = dec_string(src); | |
jointType = dec_string(src); | |
} | |
ServerboundUpdateStructureBlock::ServerboundUpdateStructureBlock() : | |
Packet(PLAY, SERVERBOUND, SB_PL_UPDATE_STRUCTURE_BLOCK, | |
"ServerboundUpdateStructureBlock") {} | |
void ServerboundUpdateStructureBlock::encode(std::ostream &dest) const { | |
enc_position(dest, location); | |
enc_varint(dest, action); | |
enc_varint(dest, mode); | |
enc_string(dest, name); | |
enc_byte(dest, offset_x); | |
enc_byte(dest, offset_y); | |
enc_byte(dest, offset_z); | |
enc_byte(dest, size_x); | |
enc_byte(dest, size_y); | |
enc_byte(dest, size_z); | |
enc_varint(dest, mirror); | |
enc_varint(dest, rotation); | |
enc_string(dest, metadata); | |
enc_bef32(dest, integrity); | |
enc_varint(dest, seed); | |
enc_byte(dest, flags); | |
} | |
void ServerboundUpdateStructureBlock::decode(std::istream &src) { | |
location = dec_position(src); | |
action = dec_varint(src); | |
mode = dec_varint(src); | |
name = dec_string(src); | |
offset_x = dec_byte(src); | |
offset_y = dec_byte(src); | |
offset_z = dec_byte(src); | |
size_x = dec_byte(src); | |
size_y = dec_byte(src); | |
size_z = dec_byte(src); | |
mirror = dec_varint(src); | |
rotation = dec_varint(src); | |
metadata = dec_string(src); | |
integrity = dec_bef32(src); | |
seed = dec_varint(src); | |
flags = dec_byte(src); | |
} | |
ServerboundUpdateSign::ServerboundUpdateSign() : | |
Packet(PLAY, SERVERBOUND, SB_PL_UPDATE_SIGN, | |
"ServerboundUpdateSign") {} | |
void ServerboundUpdateSign::encode(std::ostream &dest) const { | |
enc_position(dest, location); | |
enc_string(dest, text1); | |
enc_string(dest, text2); | |
enc_string(dest, text3); | |
enc_string(dest, text4); | |
} | |
void ServerboundUpdateSign::decode(std::istream &src) { | |
location = dec_position(src); | |
text1 = dec_string(src); | |
text2 = dec_string(src); | |
text3 = dec_string(src); | |
text4 = dec_string(src); | |
} | |
ServerboundArmAnimation::ServerboundArmAnimation() : | |
Packet(PLAY, SERVERBOUND, SB_PL_ARM_ANIMATION, | |
"ServerboundArmAnimation") {} | |
void ServerboundArmAnimation::encode(std::ostream &dest) const { | |
enc_varint(dest, hand); | |
} | |
void ServerboundArmAnimation::decode(std::istream &src) { | |
hand = dec_varint(src); | |
} | |
ServerboundSpectate::ServerboundSpectate() : | |
Packet(PLAY, SERVERBOUND, SB_PL_SPECTATE, | |
"ServerboundSpectate") {} | |
void ServerboundSpectate::encode(std::ostream &dest) const { | |
enc_uuid(dest, target); | |
} | |
void ServerboundSpectate::decode(std::istream &src) { | |
target = dec_uuid(src); | |
} | |
ServerboundBlockPlace::ServerboundBlockPlace() : | |
Packet(PLAY, SERVERBOUND, SB_PL_BLOCK_PLACE, | |
"ServerboundBlockPlace") {} | |
void ServerboundBlockPlace::encode(std::ostream &dest) const { | |
enc_varint(dest, hand); | |
enc_position(dest, location); | |
enc_varint(dest, direction); | |
enc_bef32(dest, cursorX); | |
enc_bef32(dest, cursorY); | |
enc_bef32(dest, cursorZ); | |
enc_byte(dest, insideBlock); | |
} | |
void ServerboundBlockPlace::decode(std::istream &src) { | |
hand = dec_varint(src); | |
location = dec_position(src); | |
direction = dec_varint(src); | |
cursorX = dec_bef32(src); | |
cursorY = dec_bef32(src); | |
cursorZ = dec_bef32(src); | |
insideBlock = dec_byte(src); | |
} | |
ServerboundUseItem::ServerboundUseItem() : | |
Packet(PLAY, SERVERBOUND, SB_PL_USE_ITEM, | |
"ServerboundUseItem") {} | |
void ServerboundUseItem::encode(std::ostream &dest) const { | |
enc_varint(dest, hand); | |
} | |
void ServerboundUseItem::decode(std::istream &src) { | |
hand = dec_varint(src); | |
} | |
std::unique_ptr<Packet> make_packet(packet_state state, packet_direction dir, | |
int packet_id) { | |
switch(state) { | |
case HANDSHAKING: | |
switch(dir) { | |
case CLIENTBOUND: | |
switch(packet_id) { | |
default: | |
throw std::runtime_error("Invalid Packet Id"); | |
} | |
case SERVERBOUND: | |
switch(packet_id) { | |
case SB_HS_SET_PROTOCOL: | |
return std::make_unique<ServerboundSetProtocol>(); | |
default: | |
throw std::runtime_error("Invalid Packet Id"); | |
} | |
default: | |
throw std::runtime_error("Invalid Packet Direction"); | |
} | |
case STATUS: | |
switch(dir) { | |
case CLIENTBOUND: | |
switch(packet_id) { | |
case CB_ST_SERVER_INFO: | |
return std::make_unique<ClientboundServerInfo>(); | |
case CB_ST_PING: | |
return std::make_unique<ClientboundPing>(); | |
default: | |
throw std::runtime_error("Invalid Packet Id"); | |
} | |
case SERVERBOUND: | |
switch(packet_id) { | |
case SB_ST_PING_START: | |
return std::make_unique<ServerboundPingStart>(); | |
case SB_ST_PING: | |
return std::make_unique<ServerboundPing>(); | |
default: | |
throw std::runtime_error("Invalid Packet Id"); | |
} | |
default: | |
throw std::runtime_error("Invalid Packet Direction"); | |
} | |
case LOGIN: | |
switch(dir) { | |
case CLIENTBOUND: | |
switch(packet_id) { | |
case CB_LG_DISCONNECT: | |
return std::make_unique<ClientboundDisconnect>(); | |
case CB_LG_ENCRYPTION_BEGIN: | |
return std::make_unique<ClientboundEncryptionBegin>(); | |
case CB_LG_SUCCESS: | |
return std::make_unique<ClientboundSuccess>(); | |
case CB_LG_COMPRESS: | |
return std::make_unique<ClientboundCompress>(); | |
case CB_LG_LOGIN_PLUGIN_REQUEST: | |
return std::make_unique<ClientboundLoginPluginRequest>(); | |
default: | |
throw std::runtime_error("Invalid Packet Id"); | |
} | |
case SERVERBOUND: | |
switch(packet_id) { | |
case SB_LG_LOGIN_START: | |
return std::make_unique<ServerboundLoginStart>(); | |
case SB_LG_ENCRYPTION_BEGIN: | |
return std::make_unique<ServerboundEncryptionBegin>(); | |
case SB_LG_LOGIN_PLUGIN_RESPONSE: | |
return std::make_unique<ServerboundLoginPluginResponse>(); | |
default: | |
throw std::runtime_error("Invalid Packet Id"); | |
} | |
default: | |
throw std::runtime_error("Invalid Packet Direction"); | |
} | |
case PLAY: | |
switch(dir) { | |
case CLIENTBOUND: | |
switch(packet_id) { | |
case CB_PL_SPAWN_ENTITY: | |
return std::make_unique<ClientboundSpawnEntity>(); | |
case CB_PL_SPAWN_ENTITY_EXPERIENCE_ORB: | |
return std::make_unique<ClientboundSpawnEntityExperienceOrb>(); | |
case CB_PL_SPAWN_ENTITY_LIVING: | |
return std::make_unique<ClientboundSpawnEntityLiving>(); | |
case CB_PL_SPAWN_ENTITY_PAINTING: | |
return std::make_unique<ClientboundSpawnEntityPainting>(); | |
case CB_PL_NAMED_ENTITY_SPAWN: | |
return std::make_unique<ClientboundNamedEntitySpawn>(); | |
case CB_PL_ANIMATION: | |
return std::make_unique<ClientboundAnimation>(); | |
case CB_PL_STATISTICS: | |
return std::make_unique<ClientboundStatistics>(); | |
case CB_PL_ACKNOWLEDGE_PLAYER_DIGGING: | |
return std::make_unique<ClientboundAcknowledgePlayerDigging>(); | |
case CB_PL_BLOCK_BREAK_ANIMATION: | |
return std::make_unique<ClientboundBlockBreakAnimation>(); | |
case CB_PL_TILE_ENTITY_DATA: | |
return std::make_unique<ClientboundTileEntityData>(); | |
case CB_PL_BLOCK_ACTION: | |
return std::make_unique<ClientboundBlockAction>(); | |
case CB_PL_BLOCK_CHANGE: | |
return std::make_unique<ClientboundBlockChange>(); | |
case CB_PL_BOSS_BAR: | |
return std::make_unique<ClientboundBossBar>(); | |
case CB_PL_DIFFICULTY: | |
return std::make_unique<ClientboundDifficulty>(); | |
case CB_PL_CHAT: | |
return std::make_unique<ClientboundChat>(); | |
case CB_PL_MULTI_BLOCK_CHANGE: | |
return std::make_unique<ClientboundMultiBlockChange>(); | |
case CB_PL_TAB_COMPLETE: | |
return std::make_unique<ClientboundTabComplete>(); | |
case CB_PL_DECLARE_COMMANDS: | |
return std::make_unique<ClientboundDeclareCommands>(); | |
case CB_PL_TRANSACTION: | |
return std::make_unique<ClientboundTransaction>(); | |
case CB_PL_CLOSE_WINDOW: | |
return std::make_unique<ClientboundCloseWindow>(); | |
case CB_PL_WINDOW_ITEMS: | |
return std::make_unique<ClientboundWindowItems>(); | |
case CB_PL_CRAFT_PROGRESS_BAR: | |
return std::make_unique<ClientboundCraftProgressBar>(); | |
case CB_PL_SET_SLOT: | |
return std::make_unique<ClientboundSetSlot>(); | |
case CB_PL_SET_COOLDOWN: | |
return std::make_unique<ClientboundSetCooldown>(); | |
case CB_PL_CUSTOM_PAYLOAD: | |
return std::make_unique<ClientboundCustomPayload>(); | |
case CB_PL_NAMED_SOUND_EFFECT: | |
return std::make_unique<ClientboundNamedSoundEffect>(); | |
case CB_PL_KICK_DISCONNECT: | |
return std::make_unique<ClientboundKickDisconnect>(); | |
case CB_PL_ENTITY_STATUS: | |
return std::make_unique<ClientboundEntityStatus>(); | |
case CB_PL_EXPLOSION: | |
return std::make_unique<ClientboundExplosion>(); | |
case CB_PL_UNLOAD_CHUNK: | |
return std::make_unique<ClientboundUnloadChunk>(); | |
case CB_PL_GAME_STATE_CHANGE: | |
return std::make_unique<ClientboundGameStateChange>(); | |
case CB_PL_OPEN_HORSE_WINDOW: | |
return std::make_unique<ClientboundOpenHorseWindow>(); | |
case CB_PL_KEEP_ALIVE: | |
return std::make_unique<ClientboundKeepAlive>(); | |
case CB_PL_MAP_CHUNK: | |
return std::make_unique<ClientboundMapChunk>(); | |
case CB_PL_WORLD_EVENT: | |
return std::make_unique<ClientboundWorldEvent>(); | |
case CB_PL_WORLD_PARTICLES: | |
return std::make_unique<ClientboundWorldParticles>(); | |
case CB_PL_UPDATE_LIGHT: | |
return std::make_unique<ClientboundUpdateLight>(); | |
case CB_PL_LOGIN: | |
return std::make_unique<ClientboundLogin>(); | |
case CB_PL_MAP: | |
return std::make_unique<ClientboundMap>(); | |
case CB_PL_TRADE_LIST: | |
return std::make_unique<ClientboundTradeList>(); | |
case CB_PL_REL_ENTITY_MOVE: | |
return std::make_unique<ClientboundRelEntityMove>(); | |
case CB_PL_ENTITY_MOVE_LOOK: | |
return std::make_unique<ClientboundEntityMoveLook>(); | |
case CB_PL_ENTITY_LOOK: | |
return std::make_unique<ClientboundEntityLook>(); | |
case CB_PL_ENTITY: | |
return std::make_unique<ClientboundEntity>(); | |
case CB_PL_VEHICLE_MOVE: | |
return std::make_unique<ClientboundVehicleMove>(); | |
case CB_PL_OPEN_BOOK: | |
return std::make_unique<ClientboundOpenBook>(); | |
case CB_PL_OPEN_WINDOW: | |
return std::make_unique<ClientboundOpenWindow>(); | |
case CB_PL_OPEN_SIGN_ENTITY: | |
return std::make_unique<ClientboundOpenSignEntity>(); | |
case CB_PL_CRAFT_RECIPE_RESPONSE: | |
return std::make_unique<ClientboundCraftRecipeResponse>(); | |
case CB_PL_ABILITIES: | |
return std::make_unique<ClientboundAbilities>(); | |
case CB_PL_COMBAT_EVENT: | |
return std::make_unique<ClientboundCombatEvent>(); | |
case CB_PL_PLAYER_INFO: | |
return std::make_unique<ClientboundPlayerInfo>(); | |
case CB_PL_FACE_PLAYER: | |
return std::make_unique<ClientboundFacePlayer>(); | |
case CB_PL_POSITION: | |
return std::make_unique<ClientboundPosition>(); | |
case CB_PL_UNLOCK_RECIPES: | |
return std::make_unique<ClientboundUnlockRecipes>(); | |
case CB_PL_ENTITY_DESTROY: | |
return std::make_unique<ClientboundEntityDestroy>(); | |
case CB_PL_REMOVE_ENTITY_EFFECT: | |
return std::make_unique<ClientboundRemoveEntityEffect>(); | |
case CB_PL_RESOURCE_PACK_SEND: | |
return std::make_unique<ClientboundResourcePackSend>(); | |
case CB_PL_RESPAWN: | |
return std::make_unique<ClientboundRespawn>(); | |
case CB_PL_ENTITY_HEAD_ROTATION: | |
return std::make_unique<ClientboundEntityHeadRotation>(); | |
case CB_PL_SELECT_ADVANCEMENT_TAB: | |
return std::make_unique<ClientboundSelectAdvancementTab>(); | |
case CB_PL_WORLD_BORDER: | |
return std::make_unique<ClientboundWorldBorder>(); | |
case CB_PL_CAMERA: | |
return std::make_unique<ClientboundCamera>(); | |
case CB_PL_HELD_ITEM_SLOT: | |
return std::make_unique<ClientboundHeldItemSlot>(); | |
case CB_PL_UPDATE_VIEW_POSITION: | |
return std::make_unique<ClientboundUpdateViewPosition>(); | |
case CB_PL_UPDATE_VIEW_DISTANCE: | |
return std::make_unique<ClientboundUpdateViewDistance>(); | |
case CB_PL_SPAWN_POSITION: | |
return std::make_unique<ClientboundSpawnPosition>(); | |
case CB_PL_SCOREBOARD_DISPLAY_OBJECTIVE: | |
return std::make_unique<ClientboundScoreboardDisplayObjective>(); | |
case CB_PL_ENTITY_METADATA: | |
return std::make_unique<ClientboundEntityMetadata>(); | |
case CB_PL_ATTACH_ENTITY: | |
return std::make_unique<ClientboundAttachEntity>(); | |
case CB_PL_ENTITY_VELOCITY: | |
return std::make_unique<ClientboundEntityVelocity>(); | |
case CB_PL_ENTITY_EQUIPMENT: | |
return std::make_unique<ClientboundEntityEquipment>(); | |
case CB_PL_EXPERIENCE: | |
return std::make_unique<ClientboundExperience>(); | |
case CB_PL_UPDATE_HEALTH: | |
return std::make_unique<ClientboundUpdateHealth>(); | |
case CB_PL_SCOREBOARD_OBJECTIVE: | |
return std::make_unique<ClientboundScoreboardObjective>(); | |
case CB_PL_SET_PASSENGERS: | |
return std::make_unique<ClientboundSetPassengers>(); | |
case CB_PL_TEAMS: | |
return std::make_unique<ClientboundTeams>(); | |
case CB_PL_SCOREBOARD_SCORE: | |
return std::make_unique<ClientboundScoreboardScore>(); | |
case CB_PL_UPDATE_TIME: | |
return std::make_unique<ClientboundUpdateTime>(); | |
case CB_PL_TITLE: | |
return std::make_unique<ClientboundTitle>(); | |
case CB_PL_ENTITY_SOUND_EFFECT: | |
return std::make_unique<ClientboundEntitySoundEffect>(); | |
case CB_PL_SOUND_EFFECT: | |
return std::make_unique<ClientboundSoundEffect>(); | |
case CB_PL_STOP_SOUND: | |
return std::make_unique<ClientboundStopSound>(); | |
case CB_PL_PLAYERLIST_HEADER: | |
return std::make_unique<ClientboundPlayerlistHeader>(); | |
case CB_PL_NBT_QUERY_RESPONSE: | |
return std::make_unique<ClientboundNbtQueryResponse>(); | |
case CB_PL_COLLECT: | |
return std::make_unique<ClientboundCollect>(); | |
case CB_PL_ENTITY_TELEPORT: | |
return std::make_unique<ClientboundEntityTeleport>(); | |
case CB_PL_ADVANCEMENTS: | |
return std::make_unique<ClientboundAdvancements>(); | |
case CB_PL_ENTITY_UPDATE_ATTRIBUTES: | |
return std::make_unique<ClientboundEntityUpdateAttributes>(); | |
case CB_PL_ENTITY_EFFECT: | |
return std::make_unique<ClientboundEntityEffect>(); | |
case CB_PL_DECLARE_RECIPES: | |
return std::make_unique<ClientboundDeclareRecipes>(); | |
case CB_PL_TAGS: | |
return std::make_unique<ClientboundTags>(); | |
default: | |
throw std::runtime_error("Invalid Packet Id"); | |
} | |
case SERVERBOUND: | |
switch(packet_id) { | |
case SB_PL_TELEPORT_CONFIRM: | |
return std::make_unique<ServerboundTeleportConfirm>(); | |
case SB_PL_QUERY_BLOCK_NBT: | |
return std::make_unique<ServerboundQueryBlockNbt>(); | |
case SB_PL_SET_DIFFICULTY: | |
return std::make_unique<ServerboundSetDifficulty>(); | |
case SB_PL_CHAT: | |
return std::make_unique<ServerboundChat>(); | |
case SB_PL_CLIENT_COMMAND: | |
return std::make_unique<ServerboundClientCommand>(); | |
case SB_PL_SETTINGS: | |
return std::make_unique<ServerboundSettings>(); | |
case SB_PL_TAB_COMPLETE: | |
return std::make_unique<ServerboundTabComplete>(); | |
case SB_PL_TRANSACTION: | |
return std::make_unique<ServerboundTransaction>(); | |
case SB_PL_ENCHANT_ITEM: | |
return std::make_unique<ServerboundEnchantItem>(); | |
case SB_PL_WINDOW_CLICK: | |
return std::make_unique<ServerboundWindowClick>(); | |
case SB_PL_CLOSE_WINDOW: | |
return std::make_unique<ServerboundCloseWindow>(); | |
case SB_PL_CUSTOM_PAYLOAD: | |
return std::make_unique<ServerboundCustomPayload>(); | |
case SB_PL_EDIT_BOOK: | |
return std::make_unique<ServerboundEditBook>(); | |
case SB_PL_QUERY_ENTITY_NBT: | |
return std::make_unique<ServerboundQueryEntityNbt>(); | |
case SB_PL_USE_ENTITY: | |
return std::make_unique<ServerboundUseEntity>(); | |
case SB_PL_GENERATE_STRUCTURE: | |
return std::make_unique<ServerboundGenerateStructure>(); | |
case SB_PL_KEEP_ALIVE: | |
return std::make_unique<ServerboundKeepAlive>(); | |
case SB_PL_LOCK_DIFFICULTY: | |
return std::make_unique<ServerboundLockDifficulty>(); | |
case SB_PL_POSITION: | |
return std::make_unique<ServerboundPosition>(); | |
case SB_PL_POSITION_LOOK: | |
return std::make_unique<ServerboundPositionLook>(); | |
case SB_PL_LOOK: | |
return std::make_unique<ServerboundLook>(); | |
case SB_PL_FLYING: | |
return std::make_unique<ServerboundFlying>(); | |
case SB_PL_VEHICLE_MOVE: | |
return std::make_unique<ServerboundVehicleMove>(); | |
case SB_PL_STEER_BOAT: | |
return std::make_unique<ServerboundSteerBoat>(); | |
case SB_PL_PICK_ITEM: | |
return std::make_unique<ServerboundPickItem>(); | |
case SB_PL_CRAFT_RECIPE_REQUEST: | |
return std::make_unique<ServerboundCraftRecipeRequest>(); | |
case SB_PL_ABILITIES: | |
return std::make_unique<ServerboundAbilities>(); | |
case SB_PL_BLOCK_DIG: | |
return std::make_unique<ServerboundBlockDig>(); | |
case SB_PL_ENTITY_ACTION: | |
return std::make_unique<ServerboundEntityAction>(); | |
case SB_PL_STEER_VEHICLE: | |
return std::make_unique<ServerboundSteerVehicle>(); | |
case SB_PL_CRAFTING_BOOK_DATA: | |
return std::make_unique<ServerboundCraftingBookData>(); | |
case SB_PL_NAME_ITEM: | |
return std::make_unique<ServerboundNameItem>(); | |
case SB_PL_RESOURCE_PACK_RECEIVE: | |
return std::make_unique<ServerboundResourcePackReceive>(); | |
case SB_PL_ADVANCEMENT_TAB: | |
return std::make_unique<ServerboundAdvancementTab>(); | |
case SB_PL_SELECT_TRADE: | |
return std::make_unique<ServerboundSelectTrade>(); | |
case SB_PL_SET_BEACON_EFFECT: | |
return std::make_unique<ServerboundSetBeaconEffect>(); | |
case SB_PL_HELD_ITEM_SLOT: | |
return std::make_unique<ServerboundHeldItemSlot>(); | |
case SB_PL_UPDATE_COMMAND_BLOCK: | |
return std::make_unique<ServerboundUpdateCommandBlock>(); | |
case SB_PL_UPDATE_COMMAND_BLOCK_MINECART: | |
return std::make_unique<ServerboundUpdateCommandBlockMinecart>(); | |
case SB_PL_SET_CREATIVE_SLOT: | |
return std::make_unique<ServerboundSetCreativeSlot>(); | |
case SB_PL_UPDATE_JIGSAW_BLOCK: | |
return std::make_unique<ServerboundUpdateJigsawBlock>(); | |
case SB_PL_UPDATE_STRUCTURE_BLOCK: | |
return std::make_unique<ServerboundUpdateStructureBlock>(); | |
case SB_PL_UPDATE_SIGN: | |
return std::make_unique<ServerboundUpdateSign>(); | |
case SB_PL_ARM_ANIMATION: | |
return std::make_unique<ServerboundArmAnimation>(); | |
case SB_PL_SPECTATE: | |
return std::make_unique<ServerboundSpectate>(); | |
case SB_PL_BLOCK_PLACE: | |
return std::make_unique<ServerboundBlockPlace>(); | |
case SB_PL_USE_ITEM: | |
return std::make_unique<ServerboundUseItem>(); | |
default: | |
throw std::runtime_error("Invalid Packet Id"); | |
} | |
default: | |
throw std::runtime_error("Invalid Packet Direction"); | |
} | |
default: | |
throw std::runtime_error("Invalid Packet State"); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This file was generated by mcd2cpp.py | |
It should not be edited by hand. | |
*/ | |
#ifndef PROTO_1_16_1_HPP | |
#define PROTO_1_16_1_HPP | |
#include <cstdint> | |
#include <string> | |
#include <vector> | |
#include <array> | |
#include <optional> | |
#include <memory> | |
#include <stdexcept> | |
#include "datautils.hpp" | |
#include "nbt.hpp" | |
#define MC_PROTO_VERSION 736 | |
namespace mcd { | |
enum packet_direction { | |
SERVERBOUND, | |
CLIENTBOUND, | |
DIRECTION_MAX | |
}; | |
enum packet_state { | |
HANDSHAKING, | |
STATUS, | |
LOGIN, | |
PLAY, | |
STATE_MAX | |
}; | |
enum clientbound_handshaking_ids { | |
CLIENTBOUND_HANDSHAKING_MAX | |
}; | |
enum serverbound_handshaking_ids { | |
SB_HS_SET_PROTOCOL, | |
SERVERBOUND_HANDSHAKING_MAX | |
}; | |
enum clientbound_status_ids { | |
CB_ST_SERVER_INFO, | |
CB_ST_PING, | |
CLIENTBOUND_STATUS_MAX | |
}; | |
enum serverbound_status_ids { | |
SB_ST_PING_START, | |
SB_ST_PING, | |
SERVERBOUND_STATUS_MAX | |
}; | |
enum clientbound_login_ids { | |
CB_LG_DISCONNECT, | |
CB_LG_ENCRYPTION_BEGIN, | |
CB_LG_SUCCESS, | |
CB_LG_COMPRESS, | |
CB_LG_LOGIN_PLUGIN_REQUEST, | |
CLIENTBOUND_LOGIN_MAX | |
}; | |
enum serverbound_login_ids { | |
SB_LG_LOGIN_START, | |
SB_LG_ENCRYPTION_BEGIN, | |
SB_LG_LOGIN_PLUGIN_RESPONSE, | |
SERVERBOUND_LOGIN_MAX | |
}; | |
enum clientbound_play_ids { | |
CB_PL_SPAWN_ENTITY, | |
CB_PL_SPAWN_ENTITY_EXPERIENCE_ORB, | |
CB_PL_SPAWN_ENTITY_LIVING, | |
CB_PL_SPAWN_ENTITY_PAINTING, | |
CB_PL_NAMED_ENTITY_SPAWN, | |
CB_PL_ANIMATION, | |
CB_PL_STATISTICS, | |
CB_PL_ACKNOWLEDGE_PLAYER_DIGGING, | |
CB_PL_BLOCK_BREAK_ANIMATION, | |
CB_PL_TILE_ENTITY_DATA, | |
CB_PL_BLOCK_ACTION, | |
CB_PL_BLOCK_CHANGE, | |
CB_PL_BOSS_BAR, | |
CB_PL_DIFFICULTY, | |
CB_PL_CHAT, | |
CB_PL_MULTI_BLOCK_CHANGE, | |
CB_PL_TAB_COMPLETE, | |
CB_PL_DECLARE_COMMANDS, | |
CB_PL_TRANSACTION, | |
CB_PL_CLOSE_WINDOW, | |
CB_PL_WINDOW_ITEMS, | |
CB_PL_CRAFT_PROGRESS_BAR, | |
CB_PL_SET_SLOT, | |
CB_PL_SET_COOLDOWN, | |
CB_PL_CUSTOM_PAYLOAD, | |
CB_PL_NAMED_SOUND_EFFECT, | |
CB_PL_KICK_DISCONNECT, | |
CB_PL_ENTITY_STATUS, | |
CB_PL_EXPLOSION, | |
CB_PL_UNLOAD_CHUNK, | |
CB_PL_GAME_STATE_CHANGE, | |
CB_PL_OPEN_HORSE_WINDOW, | |
CB_PL_KEEP_ALIVE, | |
CB_PL_MAP_CHUNK, | |
CB_PL_WORLD_EVENT, | |
CB_PL_WORLD_PARTICLES, | |
CB_PL_UPDATE_LIGHT, | |
CB_PL_LOGIN, | |
CB_PL_MAP, | |
CB_PL_TRADE_LIST, | |
CB_PL_REL_ENTITY_MOVE, | |
CB_PL_ENTITY_MOVE_LOOK, | |
CB_PL_ENTITY_LOOK, | |
CB_PL_ENTITY, | |
CB_PL_VEHICLE_MOVE, | |
CB_PL_OPEN_BOOK, | |
CB_PL_OPEN_WINDOW, | |
CB_PL_OPEN_SIGN_ENTITY, | |
CB_PL_CRAFT_RECIPE_RESPONSE, | |
CB_PL_ABILITIES, | |
CB_PL_COMBAT_EVENT, | |
CB_PL_PLAYER_INFO, | |
CB_PL_FACE_PLAYER, | |
CB_PL_POSITION, | |
CB_PL_UNLOCK_RECIPES, | |
CB_PL_ENTITY_DESTROY, | |
CB_PL_REMOVE_ENTITY_EFFECT, | |
CB_PL_RESOURCE_PACK_SEND, | |
CB_PL_RESPAWN, | |
CB_PL_ENTITY_HEAD_ROTATION, | |
CB_PL_SELECT_ADVANCEMENT_TAB, | |
CB_PL_WORLD_BORDER, | |
CB_PL_CAMERA, | |
CB_PL_HELD_ITEM_SLOT, | |
CB_PL_UPDATE_VIEW_POSITION, | |
CB_PL_UPDATE_VIEW_DISTANCE, | |
CB_PL_SPAWN_POSITION, | |
CB_PL_SCOREBOARD_DISPLAY_OBJECTIVE, | |
CB_PL_ENTITY_METADATA, | |
CB_PL_ATTACH_ENTITY, | |
CB_PL_ENTITY_VELOCITY, | |
CB_PL_ENTITY_EQUIPMENT, | |
CB_PL_EXPERIENCE, | |
CB_PL_UPDATE_HEALTH, | |
CB_PL_SCOREBOARD_OBJECTIVE, | |
CB_PL_SET_PASSENGERS, | |
CB_PL_TEAMS, | |
CB_PL_SCOREBOARD_SCORE, | |
CB_PL_UPDATE_TIME, | |
CB_PL_TITLE, | |
CB_PL_ENTITY_SOUND_EFFECT, | |
CB_PL_SOUND_EFFECT, | |
CB_PL_STOP_SOUND, | |
CB_PL_PLAYERLIST_HEADER, | |
CB_PL_NBT_QUERY_RESPONSE, | |
CB_PL_COLLECT, | |
CB_PL_ENTITY_TELEPORT, | |
CB_PL_ADVANCEMENTS, | |
CB_PL_ENTITY_UPDATE_ATTRIBUTES, | |
CB_PL_ENTITY_EFFECT, | |
CB_PL_DECLARE_RECIPES, | |
CB_PL_TAGS, | |
CLIENTBOUND_PLAY_MAX | |
}; | |
enum serverbound_play_ids { | |
SB_PL_TELEPORT_CONFIRM, | |
SB_PL_QUERY_BLOCK_NBT, | |
SB_PL_SET_DIFFICULTY, | |
SB_PL_CHAT, | |
SB_PL_CLIENT_COMMAND, | |
SB_PL_SETTINGS, | |
SB_PL_TAB_COMPLETE, | |
SB_PL_TRANSACTION, | |
SB_PL_ENCHANT_ITEM, | |
SB_PL_WINDOW_CLICK, | |
SB_PL_CLOSE_WINDOW, | |
SB_PL_CUSTOM_PAYLOAD, | |
SB_PL_EDIT_BOOK, | |
SB_PL_QUERY_ENTITY_NBT, | |
SB_PL_USE_ENTITY, | |
SB_PL_GENERATE_STRUCTURE, | |
SB_PL_KEEP_ALIVE, | |
SB_PL_LOCK_DIFFICULTY, | |
SB_PL_POSITION, | |
SB_PL_POSITION_LOOK, | |
SB_PL_LOOK, | |
SB_PL_FLYING, | |
SB_PL_VEHICLE_MOVE, | |
SB_PL_STEER_BOAT, | |
SB_PL_PICK_ITEM, | |
SB_PL_CRAFT_RECIPE_REQUEST, | |
SB_PL_ABILITIES, | |
SB_PL_BLOCK_DIG, | |
SB_PL_ENTITY_ACTION, | |
SB_PL_STEER_VEHICLE, | |
SB_PL_CRAFTING_BOOK_DATA, | |
SB_PL_NAME_ITEM, | |
SB_PL_RESOURCE_PACK_RECEIVE, | |
SB_PL_ADVANCEMENT_TAB, | |
SB_PL_SELECT_TRADE, | |
SB_PL_SET_BEACON_EFFECT, | |
SB_PL_HELD_ITEM_SLOT, | |
SB_PL_UPDATE_COMMAND_BLOCK, | |
SB_PL_UPDATE_COMMAND_BLOCK_MINECART, | |
SB_PL_SET_CREATIVE_SLOT, | |
SB_PL_UPDATE_JIGSAW_BLOCK, | |
SB_PL_UPDATE_STRUCTURE_BLOCK, | |
SB_PL_UPDATE_SIGN, | |
SB_PL_ARM_ANIMATION, | |
SB_PL_SPECTATE, | |
SB_PL_BLOCK_PLACE, | |
SB_PL_USE_ITEM, | |
SERVERBOUND_PLAY_MAX | |
}; | |
extern const char* serverbound_handshaking_cstrings[SERVERBOUND_HANDSHAKING_MAX]; | |
extern const char* clientbound_status_cstrings[CLIENTBOUND_STATUS_MAX]; | |
extern const char* serverbound_status_cstrings[SERVERBOUND_STATUS_MAX]; | |
extern const char* clientbound_login_cstrings[CLIENTBOUND_LOGIN_MAX]; | |
extern const char* serverbound_login_cstrings[SERVERBOUND_LOGIN_MAX]; | |
extern const char* clientbound_play_cstrings[CLIENTBOUND_PLAY_MAX]; | |
extern const char* serverbound_play_cstrings[SERVERBOUND_PLAY_MAX]; | |
extern const char **protocol_cstrings[STATE_MAX][DIRECTION_MAX]; | |
extern const int protocol_max_ids[STATE_MAX][DIRECTION_MAX]; | |
class Packet { | |
public: | |
const packet_state state; | |
const packet_direction direction; | |
const std::int32_t packet_id; | |
const std::string name; | |
Packet(packet_state state, packet_direction direction, | |
std::int32_t packet_id, std::string name) : state(state), | |
direction(direction), packet_id(packet_id), name(name) {} | |
virtual ~Packet() = default; | |
virtual void encode(std::ostream &buf) const = 0; | |
virtual void decode(std::istream &buf) = 0; | |
}; | |
std::unique_ptr<Packet> make_packet(packet_state state, packet_direction dir, | |
int packet_id); | |
class ServerboundSetProtocol : public Packet { | |
public: | |
std::int64_t protocolVersion; | |
std::string serverHost; | |
std::uint16_t serverPort; | |
std::int64_t nextState; | |
ServerboundSetProtocol(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundLegacyServerListPing : public Packet { | |
public: | |
std::uint8_t payload; | |
ServerboundLegacyServerListPing(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundServerInfo : public Packet { | |
public: | |
std::string response; | |
ClientboundServerInfo(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundPing : public Packet { | |
public: | |
std::int64_t time; | |
ClientboundPing(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundPingStart : public Packet { | |
public: | |
ServerboundPingStart(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundPing : public Packet { | |
public: | |
std::int64_t time; | |
ServerboundPing(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundDisconnect : public Packet { | |
public: | |
std::string reason; | |
ClientboundDisconnect(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundEncryptionBegin : public Packet { | |
public: | |
std::string serverId; | |
std::vector<char> publicKey; | |
std::vector<char> verifyToken; | |
ClientboundEncryptionBegin(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundSuccess : public Packet { | |
public: | |
mc_uuid uuid; | |
std::string username; | |
ClientboundSuccess(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundCompress : public Packet { | |
public: | |
std::int64_t threshold; | |
ClientboundCompress(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundLoginPluginRequest : public Packet { | |
public: | |
std::int64_t messageId; | |
std::string channel; | |
std::vector<char> data; | |
ClientboundLoginPluginRequest(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundLoginStart : public Packet { | |
public: | |
std::string username; | |
ServerboundLoginStart(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundEncryptionBegin : public Packet { | |
public: | |
std::vector<char> sharedSecret; | |
std::vector<char> verifyToken; | |
ServerboundEncryptionBegin(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundLoginPluginResponse : public Packet { | |
public: | |
std::int64_t messageId; | |
std::optional<std::vector<char>> data; | |
ServerboundLoginPluginResponse(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundSpawnEntity : public Packet { | |
public: | |
std::int64_t entityId; | |
mc_uuid objectUUID; | |
std::int64_t type; | |
double x; | |
double y; | |
double z; | |
std::int8_t pitch; | |
std::int8_t yaw; | |
std::int32_t objectData; | |
std::int16_t velocityX; | |
std::int16_t velocityY; | |
std::int16_t velocityZ; | |
ClientboundSpawnEntity(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundSpawnEntityExperienceOrb : public Packet { | |
public: | |
std::int64_t entityId; | |
double x; | |
double y; | |
double z; | |
std::int16_t count; | |
ClientboundSpawnEntityExperienceOrb(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundSpawnEntityLiving : public Packet { | |
public: | |
std::int64_t entityId; | |
mc_uuid entityUUID; | |
std::int64_t type; | |
double x; | |
double y; | |
double z; | |
std::int8_t yaw; | |
std::int8_t pitch; | |
std::int8_t headPitch; | |
std::int16_t velocityX; | |
std::int16_t velocityY; | |
std::int16_t velocityZ; | |
ClientboundSpawnEntityLiving(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundSpawnEntityPainting : public Packet { | |
public: | |
std::int64_t entityId; | |
mc_uuid entityUUID; | |
std::int64_t title; | |
mc_position location; | |
std::uint8_t direction; | |
ClientboundSpawnEntityPainting(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundNamedEntitySpawn : public Packet { | |
public: | |
std::int64_t entityId; | |
mc_uuid playerUUID; | |
double x; | |
double y; | |
double z; | |
std::int8_t yaw; | |
std::int8_t pitch; | |
ClientboundNamedEntitySpawn(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundAnimation : public Packet { | |
public: | |
std::int64_t entityId; | |
std::uint8_t animation; | |
ClientboundAnimation(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundStatistics : public Packet { | |
public: | |
typedef struct { | |
std::int64_t categoryId; | |
std::int64_t statisticId; | |
std::int64_t value; | |
} entries_type; | |
std::vector<entries_type> entries; | |
ClientboundStatistics(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundAcknowledgePlayerDigging : public Packet { | |
public: | |
mc_position location; | |
std::int64_t block; | |
std::int64_t status; | |
std::uint8_t successful; | |
ClientboundAcknowledgePlayerDigging(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundBlockBreakAnimation : public Packet { | |
public: | |
std::int64_t entityId; | |
mc_position location; | |
std::int8_t destroyStage; | |
ClientboundBlockBreakAnimation(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundTileEntityData : public Packet { | |
public: | |
mc_position location; | |
std::uint8_t action; | |
std::optional<nbt::TagCompound> nbtData; | |
ClientboundTileEntityData(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundBlockAction : public Packet { | |
public: | |
mc_position location; | |
std::uint8_t byte1; | |
std::uint8_t byte2; | |
std::int64_t blockId; | |
ClientboundBlockAction(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundBlockChange : public Packet { | |
public: | |
mc_position location; | |
std::int64_t type; | |
ClientboundBlockChange(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundBossBar : public Packet { | |
public: | |
mc_uuid entityUUID; | |
std::int64_t action; | |
std::string title; | |
float health; | |
std::int64_t color; | |
std::int64_t dividers; | |
std::uint8_t flags; | |
ClientboundBossBar(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundDifficulty : public Packet { | |
public: | |
std::uint8_t difficulty; | |
std::uint8_t difficultyLocked; | |
ClientboundDifficulty(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundChat : public Packet { | |
public: | |
std::string message; | |
std::int8_t position; | |
mc_uuid sender; | |
ClientboundChat(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundMultiBlockChange : public Packet { | |
public: | |
std::int32_t chunkX; | |
std::int32_t chunkZ; | |
typedef struct { | |
std::uint8_t horizontalPos; | |
std::uint8_t y; | |
std::int64_t blockId; | |
} records_type; | |
std::vector<records_type> records; | |
ClientboundMultiBlockChange(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundTabComplete : public Packet { | |
public: | |
std::int64_t transactionId; | |
std::int64_t start; | |
std::int64_t length; | |
typedef struct { | |
std::string match; | |
std::optional<std::string> tooltip; | |
} matches_type; | |
std::vector<matches_type> matches; | |
ClientboundTabComplete(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundDeclareCommands : public Packet { | |
public: | |
typedef struct { | |
struct { | |
std::uint8_t has_custom_suggestions; | |
std::uint8_t has_redirect_node; | |
std::uint8_t has_command; | |
std::uint8_t command_node_type; | |
} flags; | |
std::vector<std::int64_t> children; | |
std::int64_t redirectNode; | |
std::string extraNodeData_1; | |
struct { | |
std::string name; | |
std::string parser; | |
struct { | |
struct { | |
std::uint8_t max_present; | |
std::uint8_t min_present; | |
} flags; | |
double min; | |
double max; | |
} brigadier_double; | |
struct { | |
struct { | |
std::uint8_t max_present; | |
std::uint8_t min_present; | |
} flags; | |
float min; | |
float max; | |
} brigadier_float; | |
struct { | |
struct { | |
std::uint8_t max_present; | |
std::uint8_t min_present; | |
} flags; | |
std::int32_t min; | |
std::int32_t max; | |
} brigadier_integer; | |
std::int64_t brigadier_string; | |
std::int8_t minecraft_entity; | |
std::int8_t minecraft_score_holder; | |
std::string suggests; | |
} extraNodeData_2; | |
} nodes_type; | |
std::vector<nodes_type> nodes; | |
std::int64_t rootIndex; | |
ClientboundDeclareCommands(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundTransaction : public Packet { | |
public: | |
std::int8_t windowId; | |
std::int16_t action; | |
std::uint8_t accepted; | |
ClientboundTransaction(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundCloseWindow : public Packet { | |
public: | |
std::uint8_t windowId; | |
ClientboundCloseWindow(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundWindowItems : public Packet { | |
public: | |
std::uint8_t windowId; | |
std::vector<MCSlot> items; | |
ClientboundWindowItems(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundCraftProgressBar : public Packet { | |
public: | |
std::uint8_t windowId; | |
std::int16_t property; | |
std::int16_t value; | |
ClientboundCraftProgressBar(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundSetSlot : public Packet { | |
public: | |
std::int8_t windowId; | |
std::int16_t slot; | |
MCSlot item; | |
ClientboundSetSlot(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundSetCooldown : public Packet { | |
public: | |
std::int64_t itemID; | |
std::int64_t cooldownTicks; | |
ClientboundSetCooldown(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundCustomPayload : public Packet { | |
public: | |
std::string channel; | |
std::vector<char> data; | |
ClientboundCustomPayload(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundNamedSoundEffect : public Packet { | |
public: | |
std::string soundName; | |
std::int64_t soundCategory; | |
std::int32_t x; | |
std::int32_t y; | |
std::int32_t z; | |
float volume; | |
float pitch; | |
ClientboundNamedSoundEffect(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundKickDisconnect : public Packet { | |
public: | |
std::string reason; | |
ClientboundKickDisconnect(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundEntityStatus : public Packet { | |
public: | |
std::int32_t entityId; | |
std::int8_t entityStatus; | |
ClientboundEntityStatus(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundExplosion : public Packet { | |
public: | |
float x; | |
float y; | |
float z; | |
float radius; | |
typedef struct { | |
std::int8_t x; | |
std::int8_t y; | |
std::int8_t z; | |
} affectedBlockOffsets_type; | |
std::vector<affectedBlockOffsets_type> affectedBlockOffsets; | |
float playerMotionX; | |
float playerMotionY; | |
float playerMotionZ; | |
ClientboundExplosion(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundUnloadChunk : public Packet { | |
public: | |
std::int32_t chunkX; | |
std::int32_t chunkZ; | |
ClientboundUnloadChunk(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundGameStateChange : public Packet { | |
public: | |
std::uint8_t reason; | |
float gameMode; | |
ClientboundGameStateChange(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundOpenHorseWindow : public Packet { | |
public: | |
std::uint8_t windowId; | |
std::int64_t nbSlots; | |
std::int32_t entityId; | |
ClientboundOpenHorseWindow(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundKeepAlive : public Packet { | |
public: | |
std::int64_t keepAliveId; | |
ClientboundKeepAlive(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundMapChunk : public Packet { | |
public: | |
std::int32_t x; | |
std::int32_t z; | |
std::uint8_t groundUp; | |
std::uint8_t ignoreOldData; | |
std::int64_t bitMap; | |
nbt::TagCompound heightmaps; | |
std::array<std::int32_t, 1024> biomes; | |
std::vector<char> chunkData; | |
std::vector<nbt::TagCompound> blockEntities; | |
ClientboundMapChunk(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundWorldEvent : public Packet { | |
public: | |
std::int32_t effectId; | |
mc_position location; | |
std::int32_t data; | |
std::uint8_t global; | |
ClientboundWorldEvent(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundWorldParticles : public Packet { | |
public: | |
std::int32_t particleId; | |
std::uint8_t longDistance; | |
double x; | |
double y; | |
double z; | |
float offsetX; | |
float offsetY; | |
float offsetZ; | |
float particleData; | |
std::int32_t particles; | |
MCParticle data; | |
ClientboundWorldParticles(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundUpdateLight : public Packet { | |
public: | |
std::int64_t chunkX; | |
std::int64_t chunkZ; | |
std::uint8_t trustEdges; | |
std::int64_t skyLightMask; | |
std::int64_t blockLightMask; | |
std::int64_t emptySkyLightMask; | |
std::int64_t emptyBlockLightMask; | |
std::vector<char> data; | |
ClientboundUpdateLight(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundLogin : public Packet { | |
public: | |
std::int32_t entityId; | |
std::uint8_t gameMode; | |
std::uint8_t previousGameMode; | |
std::vector<std::string> worldNames; | |
nbt::TagCompound dimensionCodec; | |
std::string dimension; | |
std::string worldName; | |
std::int64_t hashedSeed; | |
std::uint8_t maxPlayers; | |
std::int64_t viewDistance; | |
std::uint8_t reducedDebugInfo; | |
std::uint8_t enableRespawnScreen; | |
std::uint8_t isDebug; | |
std::uint8_t isFlat; | |
ClientboundLogin(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundMap : public Packet { | |
public: | |
std::int64_t itemDamage; | |
std::int8_t scale; | |
std::uint8_t trackingPosition; | |
std::uint8_t locked; | |
typedef struct { | |
std::int64_t type; | |
std::int8_t x; | |
std::int8_t y; | |
std::uint8_t direction; | |
std::optional<std::string> displayName; | |
} icons_type; | |
std::vector<icons_type> icons; | |
std::int8_t columns; | |
std::int8_t rows; | |
std::int8_t x; | |
std::int8_t y; | |
std::vector<char> data; | |
ClientboundMap(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundTradeList : public Packet { | |
public: | |
std::int64_t windowId; | |
typedef struct { | |
MCSlot inputItem1; | |
MCSlot outputItem; | |
std::optional<MCSlot> inputItem2; | |
std::uint8_t tradeDisabled; | |
std::int32_t nbTradeUses; | |
std::int32_t maximumNbTradeUses; | |
std::int32_t xp; | |
std::int32_t specialPrice; | |
float priceMultiplier; | |
std::int32_t demand; | |
} trades_type; | |
std::vector<trades_type> trades; | |
std::int64_t villagerLevel; | |
std::int64_t experience; | |
std::uint8_t isRegularVillager; | |
std::uint8_t canRestock; | |
ClientboundTradeList(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundRelEntityMove : public Packet { | |
public: | |
std::int64_t entityId; | |
std::int16_t dX; | |
std::int16_t dY; | |
std::int16_t dZ; | |
std::uint8_t onGround; | |
ClientboundRelEntityMove(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundEntityMoveLook : public Packet { | |
public: | |
std::int64_t entityId; | |
std::int16_t dX; | |
std::int16_t dY; | |
std::int16_t dZ; | |
std::int8_t yaw; | |
std::int8_t pitch; | |
std::uint8_t onGround; | |
ClientboundEntityMoveLook(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundEntityLook : public Packet { | |
public: | |
std::int64_t entityId; | |
std::int8_t yaw; | |
std::int8_t pitch; | |
std::uint8_t onGround; | |
ClientboundEntityLook(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundEntity : public Packet { | |
public: | |
std::int64_t entityId; | |
ClientboundEntity(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundVehicleMove : public Packet { | |
public: | |
double x; | |
double y; | |
double z; | |
float yaw; | |
float pitch; | |
ClientboundVehicleMove(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundOpenBook : public Packet { | |
public: | |
std::int64_t hand; | |
ClientboundOpenBook(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundOpenWindow : public Packet { | |
public: | |
std::int64_t windowId; | |
std::int64_t inventoryType; | |
std::string windowTitle; | |
ClientboundOpenWindow(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundOpenSignEntity : public Packet { | |
public: | |
mc_position location; | |
ClientboundOpenSignEntity(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundCraftRecipeResponse : public Packet { | |
public: | |
std::int8_t windowId; | |
std::string recipe; | |
ClientboundCraftRecipeResponse(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundAbilities : public Packet { | |
public: | |
std::int8_t flags; | |
float flyingSpeed; | |
float walkingSpeed; | |
ClientboundAbilities(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundCombatEvent : public Packet { | |
public: | |
std::int64_t event; | |
std::int64_t duration; | |
std::int64_t playerId; | |
std::int32_t entityId; | |
std::string message; | |
ClientboundCombatEvent(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundPlayerInfo : public Packet { | |
public: | |
std::int64_t action; | |
typedef struct { | |
mc_uuid UUID; | |
std::string name; | |
typedef struct { | |
std::string name; | |
std::string value; | |
std::optional<std::string> signature; | |
} properties_type; | |
std::vector<properties_type> properties; | |
std::int64_t gamemode; | |
std::int64_t ping; | |
std::optional<std::string> displayName; | |
} data_type; | |
std::vector<data_type> data; | |
ClientboundPlayerInfo(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundFacePlayer : public Packet { | |
public: | |
std::int64_t feet_eyes; | |
double x; | |
double y; | |
double z; | |
std::uint8_t isEntity; | |
std::int64_t entityId; | |
std::string entity_feet_eyes; | |
ClientboundFacePlayer(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundPosition : public Packet { | |
public: | |
double x; | |
double y; | |
double z; | |
float yaw; | |
float pitch; | |
std::int8_t flags; | |
std::int64_t teleportId; | |
ClientboundPosition(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundUnlockRecipes : public Packet { | |
public: | |
std::int64_t action; | |
std::uint8_t craftingBookOpen; | |
std::uint8_t filteringCraftable; | |
std::uint8_t smeltingBookOpen; | |
std::uint8_t filteringSmeltable; | |
std::vector<std::string> recipes1; | |
std::vector<std::string> recipes2; | |
ClientboundUnlockRecipes(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundEntityDestroy : public Packet { | |
public: | |
std::vector<std::int64_t> entityIds; | |
ClientboundEntityDestroy(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundRemoveEntityEffect : public Packet { | |
public: | |
std::int64_t entityId; | |
std::int8_t effectId; | |
ClientboundRemoveEntityEffect(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundResourcePackSend : public Packet { | |
public: | |
std::string url; | |
std::string hash; | |
ClientboundResourcePackSend(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundRespawn : public Packet { | |
public: | |
std::string dimension; | |
std::string worldName; | |
std::int64_t hashedSeed; | |
std::uint8_t gamemode; | |
std::uint8_t previousGamemode; | |
std::uint8_t isDebug; | |
std::uint8_t isFlat; | |
std::uint8_t copyMetadata; | |
ClientboundRespawn(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundEntityHeadRotation : public Packet { | |
public: | |
std::int64_t entityId; | |
std::int8_t headYaw; | |
ClientboundEntityHeadRotation(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundSelectAdvancementTab : public Packet { | |
public: | |
std::optional<std::string> id; | |
ClientboundSelectAdvancementTab(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundWorldBorder : public Packet { | |
public: | |
std::int64_t action; | |
double radius; | |
double x; | |
double z; | |
double old_radius; | |
double new_radius; | |
std::int64_t speed; | |
std::int64_t portalBoundary; | |
std::int64_t warning_time; | |
std::int64_t warning_blocks; | |
ClientboundWorldBorder(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundCamera : public Packet { | |
public: | |
std::int64_t cameraId; | |
ClientboundCamera(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundHeldItemSlot : public Packet { | |
public: | |
std::int8_t slot; | |
ClientboundHeldItemSlot(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundUpdateViewPosition : public Packet { | |
public: | |
std::int64_t chunkX; | |
std::int64_t chunkZ; | |
ClientboundUpdateViewPosition(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundUpdateViewDistance : public Packet { | |
public: | |
std::int64_t viewDistance; | |
ClientboundUpdateViewDistance(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundSpawnPosition : public Packet { | |
public: | |
mc_position location; | |
ClientboundSpawnPosition(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundScoreboardDisplayObjective : public Packet { | |
public: | |
std::int8_t position; | |
std::string name; | |
ClientboundScoreboardDisplayObjective(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundEntityMetadata : public Packet { | |
public: | |
std::int64_t entityId; | |
MCEntityMetadata metadata; | |
ClientboundEntityMetadata(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundAttachEntity : public Packet { | |
public: | |
std::int32_t entityId; | |
std::int32_t vehicleId; | |
ClientboundAttachEntity(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundEntityVelocity : public Packet { | |
public: | |
std::int64_t entityId; | |
std::int16_t velocityX; | |
std::int16_t velocityY; | |
std::int16_t velocityZ; | |
ClientboundEntityVelocity(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundEntityEquipment : public Packet { | |
public: | |
std::int64_t entityId; | |
MCEntityEquipment equipments; | |
ClientboundEntityEquipment(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundExperience : public Packet { | |
public: | |
float experienceBar; | |
std::int64_t level; | |
std::int64_t totalExperience; | |
ClientboundExperience(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundUpdateHealth : public Packet { | |
public: | |
float health; | |
std::int64_t food; | |
float foodSaturation; | |
ClientboundUpdateHealth(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundScoreboardObjective : public Packet { | |
public: | |
std::string name; | |
std::int8_t action; | |
std::string displayText; | |
std::int64_t type; | |
ClientboundScoreboardObjective(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundSetPassengers : public Packet { | |
public: | |
std::int64_t entityId; | |
std::vector<std::int64_t> passengers; | |
ClientboundSetPassengers(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundTeams : public Packet { | |
public: | |
std::string team; | |
std::int8_t mode; | |
std::string name; | |
std::int8_t friendlyFire; | |
std::string nameTagVisibility; | |
std::string collisionRule; | |
std::int64_t formatting; | |
std::string prefix; | |
std::string suffix; | |
std::vector<std::string> players; | |
ClientboundTeams(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundScoreboardScore : public Packet { | |
public: | |
std::string itemName; | |
std::int8_t action; | |
std::string scoreName; | |
std::int64_t value; | |
ClientboundScoreboardScore(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundUpdateTime : public Packet { | |
public: | |
std::int64_t age; | |
std::int64_t time; | |
ClientboundUpdateTime(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundTitle : public Packet { | |
public: | |
std::int64_t action; | |
std::string text; | |
std::int32_t fadeIn; | |
std::int32_t stay; | |
std::int32_t fadeOut; | |
ClientboundTitle(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundEntitySoundEffect : public Packet { | |
public: | |
std::int64_t soundId; | |
std::int64_t soundCategory; | |
std::int64_t entityId; | |
float volume; | |
float pitch; | |
ClientboundEntitySoundEffect(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundSoundEffect : public Packet { | |
public: | |
std::int64_t soundId; | |
std::int64_t soundCategory; | |
std::int32_t x; | |
std::int32_t y; | |
std::int32_t z; | |
float volume; | |
float pitch; | |
ClientboundSoundEffect(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundStopSound : public Packet { | |
public: | |
std::int8_t flags; | |
std::int64_t source; | |
std::string sound; | |
ClientboundStopSound(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundPlayerlistHeader : public Packet { | |
public: | |
std::string header; | |
std::string footer; | |
ClientboundPlayerlistHeader(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundNbtQueryResponse : public Packet { | |
public: | |
std::int64_t transactionId; | |
nbt::TagCompound nbt; | |
ClientboundNbtQueryResponse(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundCollect : public Packet { | |
public: | |
std::int64_t collectedEntityId; | |
std::int64_t collectorEntityId; | |
std::int64_t pickupItemCount; | |
ClientboundCollect(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundEntityTeleport : public Packet { | |
public: | |
std::int64_t entityId; | |
double x; | |
double y; | |
double z; | |
std::int8_t yaw; | |
std::int8_t pitch; | |
std::uint8_t onGround; | |
ClientboundEntityTeleport(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundAdvancements : public Packet { | |
public: | |
std::uint8_t reset; | |
typedef struct { | |
std::string key; | |
struct { | |
std::optional<std::string> parentId; | |
typedef struct { | |
std::string title; | |
std::string description; | |
MCSlot icon; | |
std::int64_t frameType; | |
struct { | |
std::uint8_t hidden; | |
std::uint8_t show_toast; | |
std::uint8_t has_background_texture; | |
} flags; | |
std::string backgroundTexture; | |
float xCord; | |
float yCord; | |
} displayData_type; | |
std::optional<displayData_type> displayData; | |
typedef struct { | |
std::string key; | |
// 'value' is a void type | |
} criteria_type; | |
std::vector<criteria_type> criteria; | |
std::vector<std::vector<std::string>> requirements; | |
} value; | |
} advancementMapping_type; | |
std::vector<advancementMapping_type> advancementMapping; | |
std::vector<std::string> identifiers; | |
typedef struct { | |
std::string key; | |
typedef struct { | |
std::string criterionIdentifier; | |
std::optional<std::int64_t> criterionProgress; | |
} value_type; | |
std::vector<value_type> value; | |
} progressMapping_type; | |
std::vector<progressMapping_type> progressMapping; | |
ClientboundAdvancements(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundEntityUpdateAttributes : public Packet { | |
public: | |
std::int64_t entityId; | |
typedef struct { | |
std::string key; | |
double value; | |
typedef struct { | |
mc_uuid uuid; | |
double amount; | |
std::int8_t operation; | |
} modifiers_type; | |
std::vector<modifiers_type> modifiers; | |
} properties_type; | |
std::vector<properties_type> properties; | |
ClientboundEntityUpdateAttributes(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundEntityEffect : public Packet { | |
public: | |
std::int64_t entityId; | |
std::int8_t effectId; | |
std::int8_t amplifier; | |
std::int64_t duration; | |
std::int8_t hideParticles; | |
ClientboundEntityEffect(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundDeclareRecipes : public Packet { | |
public: | |
typedef struct { | |
std::string type; | |
std::string recipeId; | |
struct { | |
std::string group; | |
std::vector<std::vector<MCSlot>> ingredients; | |
MCSlot result; | |
} minecraft_crafting_shapeless; | |
struct { | |
std::int64_t width; | |
std::int64_t height; | |
std::string group; | |
std::vector<std::vector<std::vector<MCSlot>>> ingredients; | |
MCSlot result; | |
} minecraft_crafting_shaped; | |
MCSmelting minecraft_smelting; | |
MCSmelting minecraft_blasting; | |
MCSmelting minecraft_smoking; | |
MCSmelting minecraft_campfire_cooking; | |
struct { | |
std::string group; | |
std::vector<MCSlot> ingredient; | |
MCSlot result; | |
} minecraft_stonecutting; | |
struct { | |
std::vector<MCSlot> base; | |
std::vector<MCSlot> addition; | |
MCSlot result; | |
} minecraft_smithing; | |
} recipes_type; | |
std::vector<recipes_type> recipes; | |
ClientboundDeclareRecipes(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ClientboundTags : public Packet { | |
public: | |
std::vector<MCTag> blockTags; | |
std::vector<MCTag> itemTags; | |
std::vector<MCTag> fluidTags; | |
std::vector<MCTag> entityTags; | |
ClientboundTags(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundTeleportConfirm : public Packet { | |
public: | |
std::int64_t teleportId; | |
ServerboundTeleportConfirm(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundQueryBlockNbt : public Packet { | |
public: | |
std::int64_t transactionId; | |
mc_position location; | |
ServerboundQueryBlockNbt(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundSetDifficulty : public Packet { | |
public: | |
std::uint8_t newDifficulty; | |
ServerboundSetDifficulty(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundChat : public Packet { | |
public: | |
std::string message; | |
ServerboundChat(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundClientCommand : public Packet { | |
public: | |
std::int64_t actionId; | |
ServerboundClientCommand(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundSettings : public Packet { | |
public: | |
std::string locale; | |
std::int8_t viewDistance; | |
std::int64_t chatFlags; | |
std::uint8_t chatColors; | |
std::uint8_t skinParts; | |
std::int64_t mainHand; | |
ServerboundSettings(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundTabComplete : public Packet { | |
public: | |
std::int64_t transactionId; | |
std::string text; | |
ServerboundTabComplete(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundTransaction : public Packet { | |
public: | |
std::int8_t windowId; | |
std::int16_t action; | |
std::uint8_t accepted; | |
ServerboundTransaction(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundEnchantItem : public Packet { | |
public: | |
std::int8_t windowId; | |
std::int8_t enchantment; | |
ServerboundEnchantItem(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundWindowClick : public Packet { | |
public: | |
std::uint8_t windowId; | |
std::int16_t slot; | |
std::int8_t mouseButton; | |
std::int16_t action; | |
std::int8_t mode; | |
MCSlot item; | |
ServerboundWindowClick(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundCloseWindow : public Packet { | |
public: | |
std::uint8_t windowId; | |
ServerboundCloseWindow(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundCustomPayload : public Packet { | |
public: | |
std::string channel; | |
std::vector<char> data; | |
ServerboundCustomPayload(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundEditBook : public Packet { | |
public: | |
MCSlot new_book; | |
std::uint8_t signing; | |
std::int64_t hand; | |
ServerboundEditBook(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundQueryEntityNbt : public Packet { | |
public: | |
std::int64_t transactionId; | |
std::int64_t entityId; | |
ServerboundQueryEntityNbt(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundUseEntity : public Packet { | |
public: | |
std::int64_t target; | |
std::int64_t mouse; | |
float x; | |
float y; | |
float z; | |
std::int64_t hand; | |
std::uint8_t sneaking; | |
ServerboundUseEntity(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundGenerateStructure : public Packet { | |
public: | |
mc_position location; | |
std::int64_t levels; | |
std::uint8_t keepJigsaws; | |
ServerboundGenerateStructure(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundKeepAlive : public Packet { | |
public: | |
std::int64_t keepAliveId; | |
ServerboundKeepAlive(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundLockDifficulty : public Packet { | |
public: | |
std::uint8_t locked; | |
ServerboundLockDifficulty(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundPosition : public Packet { | |
public: | |
double x; | |
double y; | |
double z; | |
std::uint8_t onGround; | |
ServerboundPosition(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundPositionLook : public Packet { | |
public: | |
double x; | |
double y; | |
double z; | |
float yaw; | |
float pitch; | |
std::uint8_t onGround; | |
ServerboundPositionLook(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundLook : public Packet { | |
public: | |
float yaw; | |
float pitch; | |
std::uint8_t onGround; | |
ServerboundLook(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundFlying : public Packet { | |
public: | |
std::uint8_t onGround; | |
ServerboundFlying(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundVehicleMove : public Packet { | |
public: | |
double x; | |
double y; | |
double z; | |
float yaw; | |
float pitch; | |
ServerboundVehicleMove(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundSteerBoat : public Packet { | |
public: | |
std::uint8_t leftPaddle; | |
std::uint8_t rightPaddle; | |
ServerboundSteerBoat(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundPickItem : public Packet { | |
public: | |
std::int64_t slot; | |
ServerboundPickItem(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundCraftRecipeRequest : public Packet { | |
public: | |
std::int8_t windowId; | |
std::string recipe; | |
std::uint8_t makeAll; | |
ServerboundCraftRecipeRequest(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundAbilities : public Packet { | |
public: | |
std::int8_t flags; | |
ServerboundAbilities(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundBlockDig : public Packet { | |
public: | |
std::int8_t status; | |
mc_position location; | |
std::int8_t face; | |
ServerboundBlockDig(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundEntityAction : public Packet { | |
public: | |
std::int64_t entityId; | |
std::int64_t actionId; | |
std::int64_t jumpBoost; | |
ServerboundEntityAction(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundSteerVehicle : public Packet { | |
public: | |
float sideways; | |
float forward; | |
std::uint8_t jump; | |
ServerboundSteerVehicle(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundCraftingBookData : public Packet { | |
public: | |
std::int64_t type; | |
std::string displayedRecipe; | |
std::uint8_t craftingBookOpen; | |
std::uint8_t craftingFilter; | |
std::uint8_t smeltingBookOpen; | |
std::uint8_t smeltingFilter; | |
std::uint8_t blastingBookOpen; | |
std::uint8_t blastingFilter; | |
std::uint8_t smokingBookOpen; | |
std::uint8_t smokingFilter; | |
ServerboundCraftingBookData(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundNameItem : public Packet { | |
public: | |
std::string name; | |
ServerboundNameItem(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundResourcePackReceive : public Packet { | |
public: | |
std::int64_t result; | |
ServerboundResourcePackReceive(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundAdvancementTab : public Packet { | |
public: | |
std::int64_t action; | |
std::string tabId; | |
ServerboundAdvancementTab(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundSelectTrade : public Packet { | |
public: | |
std::int64_t slot; | |
ServerboundSelectTrade(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundSetBeaconEffect : public Packet { | |
public: | |
std::int64_t primary_effect; | |
std::int64_t secondary_effect; | |
ServerboundSetBeaconEffect(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundHeldItemSlot : public Packet { | |
public: | |
std::int16_t slotId; | |
ServerboundHeldItemSlot(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundUpdateCommandBlock : public Packet { | |
public: | |
mc_position location; | |
std::string command; | |
std::int64_t mode; | |
std::uint8_t flags; | |
ServerboundUpdateCommandBlock(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundUpdateCommandBlockMinecart : public Packet { | |
public: | |
std::int64_t entityId; | |
std::string command; | |
std::uint8_t track_output; | |
ServerboundUpdateCommandBlockMinecart(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundSetCreativeSlot : public Packet { | |
public: | |
std::int16_t slot; | |
MCSlot item; | |
ServerboundSetCreativeSlot(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundUpdateJigsawBlock : public Packet { | |
public: | |
mc_position location; | |
std::string name; | |
std::string target; | |
std::string pool; | |
std::string finalState; | |
std::string jointType; | |
ServerboundUpdateJigsawBlock(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundUpdateStructureBlock : public Packet { | |
public: | |
mc_position location; | |
std::int64_t action; | |
std::int64_t mode; | |
std::string name; | |
std::uint8_t offset_x; | |
std::uint8_t offset_y; | |
std::uint8_t offset_z; | |
std::uint8_t size_x; | |
std::uint8_t size_y; | |
std::uint8_t size_z; | |
std::int64_t mirror; | |
std::int64_t rotation; | |
std::string metadata; | |
float integrity; | |
std::int64_t seed; | |
std::uint8_t flags; | |
ServerboundUpdateStructureBlock(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundUpdateSign : public Packet { | |
public: | |
mc_position location; | |
std::string text1; | |
std::string text2; | |
std::string text3; | |
std::string text4; | |
ServerboundUpdateSign(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundArmAnimation : public Packet { | |
public: | |
std::int64_t hand; | |
ServerboundArmAnimation(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundSpectate : public Packet { | |
public: | |
mc_uuid target; | |
ServerboundSpectate(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundBlockPlace : public Packet { | |
public: | |
std::int64_t hand; | |
mc_position location; | |
std::int64_t direction; | |
float cursorX; | |
float cursorY; | |
float cursorZ; | |
std::uint8_t insideBlock; | |
ServerboundBlockPlace(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
class ServerboundUseItem : public Packet { | |
public: | |
std::int64_t hand; | |
ServerboundUseItem(); | |
void encode(std::ostream &dest) const; | |
void decode(std::istream &src); | |
}; | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment