diff options
Diffstat (limited to 'src/Protocol/Protocol17x.cpp')
-rw-r--r-- | src/Protocol/Protocol17x.cpp | 137 |
1 files changed, 132 insertions, 5 deletions
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 799c021f3..c5c0f4a03 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -247,8 +247,67 @@ void cProtocol172::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockV void cProtocol172::SendChat(const AString & a_Message) { + this->SendChatType(a_Message, ctChatBox); +} + + + + + +void cProtocol172::SendChat(const cCompositeChat & a_Message) +{ + this->SendChatType(a_Message, ctChatBox); +} + + + + + +void cProtocol172::SendChatSystem(const AString & a_Message) +{ + this->SendChatType(a_Message, ctSystem); +} + + + + + +void cProtocol172::SendChatSystem(const cCompositeChat & a_Message) +{ + this->SendChatType(a_Message, ctSystem); +} + + + + + +void cProtocol172::SendChatAboveActionBar(const AString & a_Message) +{ + this->SendChatType(a_Message, ctAboveActionBar); +} + + + + + +void cProtocol172::SendChatAboveActionBar(const cCompositeChat & a_Message) +{ + this->SendChatType(a_Message, ctAboveActionBar); +} + + + + + +void cProtocol172::SendChatType(const AString & a_Message, eChatType type) +{ ASSERT(m_State == 3); // In game mode? - + + if (type != ctChatBox) // 1.7.2 doesn't support anything else + { + return; + } + cPacketizer Pkt(*this, 0x02); // Chat Message packet Pkt.WriteString(Printf("{\"text\":\"%s\"}", EscapeString(a_Message).c_str())); } @@ -257,10 +316,15 @@ void cProtocol172::SendChat(const AString & a_Message) -void cProtocol172::SendChat(const cCompositeChat & a_Message) +void cProtocol172::SendChatType(const cCompositeChat & a_Message, eChatType type) { ASSERT(m_State == 3); // In game mode? + if (type != ctChatBox) // 1.7.2 doesn't support anything else + { + return; + } + cWorld * World = m_Client->GetPlayer()->GetWorld(); bool ShouldUseChatPrefixes = (World == nullptr) ? false : World->ShouldUseChatPrefixes(); @@ -555,6 +619,15 @@ void cProtocol172::SendHealth(void) +void cProtocol172::SendHideTitle(void) +{ + // Not implemented in this protocol version +} + + + + + void cProtocol172::SendInventorySlot(char a_WindowID, short a_SlotNum, const cItem & a_Item) { ASSERT(m_State == 3); // In game mode? @@ -995,6 +1068,15 @@ void cProtocol172::SendRemoveEntityEffect(const cEntity & a_Entity, int a_Effect +void cProtocol172::SendResetTitle(void) +{ + // Not implemented in this protocol version +} + + + + + void cProtocol172::SendRespawn(eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks) { if ((m_LastSentDimension == a_Dimension) && !a_ShouldIgnoreDimensionChecks) @@ -1023,8 +1105,8 @@ void cProtocol172::SendExperience (void) cPacketizer Pkt(*this, 0x1f); // Experience Packet cPlayer * Player = m_Client->GetPlayer(); Pkt.WriteBEFloat(Player->GetXpPercentage()); - Pkt.WriteBEInt16(static_cast<UInt16>(std::max<int>(Player->GetXpLevel(), std::numeric_limits<UInt16>::max()))); - Pkt.WriteBEInt16(static_cast<UInt16>(std::max<int>(Player->GetCurrentXp(), std::numeric_limits<UInt16>::max()))); + Pkt.WriteBEInt16(static_cast<Int16>(std::min<int>(Player->GetXpLevel(), std::numeric_limits<Int16>::max()))); + Pkt.WriteBEInt16(static_cast<Int16>(std::min<int>(Player->GetCurrentXp(), std::numeric_limits<Int16>::max()))); } @@ -1094,6 +1176,42 @@ void cProtocol172::SendDisplayObjective(const AString & a_Objective, cScoreboard +void cProtocol172::SendSetSubTitle(const cCompositeChat & a_SubTitle) +{ + // Not implemented in this protocol version +} + + + + + +void cProtocol172::SendSetRawSubTitle(const AString & a_SubTitle) +{ + // Not implemented in this protocol version +} + + + + + +void cProtocol172::SendSetTitle(const cCompositeChat & a_Title) +{ + // Not implemented in this protocol version +} + + + + + +void cProtocol172::SendSetRawTitle(const AString & a_Title) +{ + // Not implemented in this protocol version +} + + + + + void cProtocol172::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) { ASSERT(m_State == 3); // In game mode? @@ -1296,6 +1414,15 @@ void cProtocol172::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ) +void cProtocol172::SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) +{ + // Not implemented in this protocol version +} + + + + + void cProtocol172::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) { ASSERT(m_State == 3); // In game mode? @@ -2247,7 +2374,7 @@ void cProtocol172::HandlePacketWindowClick(cByteBuffer & a_ByteBuffer) case 0x0206: Action = caNumber7; break; case 0x0207: Action = caNumber8; break; case 0x0208: Action = caNumber9; break; - case 0x0300: Action = caMiddleClick; break; + case 0x0302: Action = caMiddleClick; break; case 0x0400: Action = (SlotNum == SLOT_NUM_OUTSIDE) ? caLeftClickOutsideHoldNothing : caDropKey; break; case 0x0401: Action = (SlotNum == SLOT_NUM_OUTSIDE) ? caRightClickOutsideHoldNothing : caCtrlDropKey; break; case 0x0500: Action = (SlotNum == SLOT_NUM_OUTSIDE) ? caLeftPaintBegin : caUnknown; break; |