diff options
author | Mat <mail@mathias.is> | 2020-04-07 23:23:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-07 23:23:54 +0200 |
commit | 6a21bf979c5ef4ad473971257f59fe9101397cd6 (patch) | |
tree | c8d2c94a59982b7a80a36542e77ae872158a6814 /src/Protocol/Protocol_1_8.cpp | |
parent | Filter blocks to add to redstone sim's wake queue (#4621) (diff) | |
download | cuberite-6a21bf979c5ef4ad473971257f59fe9101397cd6.tar cuberite-6a21bf979c5ef4ad473971257f59fe9101397cd6.tar.gz cuberite-6a21bf979c5ef4ad473971257f59fe9101397cd6.tar.bz2 cuberite-6a21bf979c5ef4ad473971257f59fe9101397cd6.tar.lz cuberite-6a21bf979c5ef4ad473971257f59fe9101397cd6.tar.xz cuberite-6a21bf979c5ef4ad473971257f59fe9101397cd6.tar.zst cuberite-6a21bf979c5ef4ad473971257f59fe9101397cd6.zip |
Diffstat (limited to 'src/Protocol/Protocol_1_8.cpp')
-rw-r--r-- | src/Protocol/Protocol_1_8.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index 668ca7542..1b3c261f5 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -1147,6 +1147,25 @@ void cProtocol_1_8_0::SendResetTitle(void) +void cProtocol_1_8_0::SendResourcePack(const AString & a_ResourcePackUrl) +{ + cPacketizer Pkt(*this, pktResourcePack); + + cSha1Checksum Checksum; + Checksum.Update(reinterpret_cast<const Byte *>(a_ResourcePackUrl.c_str()), a_ResourcePackUrl.size()); + Byte Digest[20]; + Checksum.Finalize(Digest); + AString Sha1Output; + cSha1Checksum::DigestToHex(Digest, Sha1Output); + + Pkt.WriteString(a_ResourcePackUrl); + Pkt.WriteString(Sha1Output); +} + + + + + void cProtocol_1_8_0::SendRespawn(eDimension a_Dimension) { @@ -2152,6 +2171,7 @@ UInt32 cProtocol_1_8_0::GetPacketID(ePacketType a_PacketType) case pktPlayerMoveLook: return 0x08; case pktPluginMessage: return 0x3f; case pktRemoveEntityEffect: return 0x1e; + case pktResourcePack: return 0x48; case pktRespawn: return 0x07; case pktScoreboardObjective: return 0x3b; case pktSoundEffect: return 0x29; @@ -2250,6 +2270,7 @@ bool cProtocol_1_8_0::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketTy case 0x16: HandlePacketClientStatus (a_ByteBuffer); return true; case 0x17: HandlePacketPluginMessage (a_ByteBuffer); return true; case 0x18: HandlePacketSpectate (a_ByteBuffer); return true; + case 0x19: HandlePacketResourcePackStatus (a_ByteBuffer); return true; } break; } @@ -2708,6 +2729,16 @@ void cProtocol_1_8_0::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer) +void cProtocol_1_8_0::HandlePacketResourcePackStatus(cByteBuffer & a_ByteBuffer) +{ + HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Hash); + HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Status); +} + + + + + void cProtocol_1_8_0::HandlePacketSlotSelect(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEInt16, Int16, SlotNum); |