From 903bcfc61fd031985e55a604293f85c2597a8320 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Thu, 13 Jan 2022 20:51:47 +0000 Subject: eblockface --- src/Protocol/Protocol_1_8.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/Protocol/Protocol_1_8.cpp') diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index bf31c084c..71f5b16fe 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -374,7 +374,16 @@ void cProtocol_1_8_0::SendChatRaw(const AString & a_MessageRaw, eChatType a_Type // Send the json string to the client: cPacketizer Pkt(*this, pktChatRaw); Pkt.WriteString(a_MessageRaw); - Pkt.WriteBEInt8(static_cast(a_Type)); + Pkt.WriteBEInt8([a_Type]() -> signed char + { + switch (a_Type) + { + case eChatType::ctChatBox: return 0; + case eChatType::ctSystem: return 1; + case eChatType::ctAboveActionBar: return 2; + } + UNREACHABLE("Unsupported chat type"); + }()); } @@ -504,7 +513,7 @@ void cProtocol_1_8_0::SendEntityAnimation(const cEntity & a_Entity, const Entity return; } - if (const auto AnimationID = GetProtocolEntityAnimation(a_Animation); AnimationID != static_cast(-1)) + if (const auto AnimationID = GetProtocolEntityAnimation(a_Animation); AnimationID != unsigned char(-1)) { cPacketizer Pkt(*this, pktEntityAnimation); Pkt.WriteVarInt32(a_Entity.GetUniqueID()); @@ -1969,7 +1978,7 @@ unsigned char cProtocol_1_8_0::GetProtocolEntityAnimation(const EntityAnimation case EntityAnimation::PlayerLeavesBed: return 2; case EntityAnimation::PlayerMainHandSwings: return 0; case EntityAnimation::PlayerOffHandSwings: return 0; - default: return static_cast(-1); + default: return unsigned char(-1); } } -- cgit v1.2.3