Initial resource pack support (#4622)
This commit is contained in:
@@ -1233,6 +1233,25 @@ void cProtocol_1_9_0::SendResetTitle(void)
|
||||
|
||||
|
||||
|
||||
void cProtocol_1_9_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_9_0::SendRespawn(eDimension a_Dimension)
|
||||
{
|
||||
cPacketizer Pkt(*this, pktRespawn);
|
||||
@@ -2209,6 +2228,7 @@ UInt32 cProtocol_1_9_0::GetPacketID(cProtocol::ePacketType a_Packet)
|
||||
case pktPlayerMoveLook: return 0x2e;
|
||||
case pktPluginMessage: return 0x18;
|
||||
case pktRemoveEntityEffect: return 0x31;
|
||||
case pktResourcePack: return 0x32;
|
||||
case pktRespawn: return 0x33;
|
||||
case pktScoreboardObjective: return 0x3f;
|
||||
case pktSpawnExperienceOrb: return 0x01;
|
||||
@@ -2299,7 +2319,7 @@ bool cProtocol_1_9_0::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketTy
|
||||
case 0x13: HandlePacketBlockDig (a_ByteBuffer); return true;
|
||||
case 0x14: HandlePacketEntityAction (a_ByteBuffer); return true;
|
||||
case 0x15: HandlePacketSteerVehicle (a_ByteBuffer); return true;
|
||||
case 0x16: break; // Resource pack status - not yet implemented
|
||||
case 0x16: HandlePacketResourcePackStatus (a_ByteBuffer); return true;
|
||||
case 0x17: HandlePacketSlotSelect (a_ByteBuffer); return true;
|
||||
case 0x18: HandlePacketCreativeInventoryAction(a_ByteBuffer); return true;
|
||||
case 0x19: HandlePacketUpdateSign (a_ByteBuffer); return true;
|
||||
@@ -2804,6 +2824,16 @@ void cProtocol_1_9_0::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer)
|
||||
|
||||
|
||||
|
||||
void cProtocol_1_9_0::HandlePacketResourcePackStatus(cByteBuffer & a_ByteBuffer)
|
||||
{
|
||||
HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Hash);
|
||||
HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol_1_9_0::HandlePacketSlotSelect(cByteBuffer & a_ByteBuffer)
|
||||
{
|
||||
HANDLE_READ(a_ByteBuffer, ReadBEInt16, Int16, SlotNum);
|
||||
|
||||
Reference in New Issue
Block a user