summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_9.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2019-09-10 19:33:05 +0200
committerMattes D <github@xoft.cz>2019-09-16 15:37:54 +0200
commitc7132a309190ba3480c59dfb76bd8d354f12b4b3 (patch)
tree44f1e8f740017a921b6c3ff54928cceacdd219d1 /src/Protocol/Protocol_1_9.cpp
parentInitial support for 1.13 clients (diff)
downloadcuberite-c7132a309190ba3480c59dfb76bd8d354f12b4b3.tar
cuberite-c7132a309190ba3480c59dfb76bd8d354f12b4b3.tar.gz
cuberite-c7132a309190ba3480c59dfb76bd8d354f12b4b3.tar.bz2
cuberite-c7132a309190ba3480c59dfb76bd8d354f12b4b3.tar.lz
cuberite-c7132a309190ba3480c59dfb76bd8d354f12b4b3.tar.xz
cuberite-c7132a309190ba3480c59dfb76bd8d354f12b4b3.tar.zst
cuberite-c7132a309190ba3480c59dfb76bd8d354f12b4b3.zip
Diffstat (limited to 'src/Protocol/Protocol_1_9.cpp')
-rw-r--r--src/Protocol/Protocol_1_9.cpp81
1 files changed, 45 insertions, 36 deletions
diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp
index 29d8b1c34..4bf358567 100644
--- a/src/Protocol/Protocol_1_9.cpp
+++ b/src/Protocol/Protocol_1_9.cpp
@@ -592,6 +592,37 @@ void cProtocol_1_9_0::SendEntityVelocity(const cEntity & a_Entity)
+void cProtocol_1_9_0::SendExperience(void)
+{
+ ASSERT(m_State == 3); // In game mode?
+
+ cPacketizer Pkt(*this, pktExperience);
+ cPlayer * Player = m_Client->GetPlayer();
+ Pkt.WriteBEFloat(Player->GetXpPercentage());
+ Pkt.WriteVarInt32(static_cast<UInt32>(Player->GetXpLevel()));
+ Pkt.WriteVarInt32(static_cast<UInt32>(Player->GetCurrentXp()));
+}
+
+
+
+
+
+void cProtocol_1_9_0::SendExperienceOrb(const cExpOrb & a_ExpOrb)
+{
+ ASSERT(m_State == 3); // In game mode?
+
+ cPacketizer Pkt(*this, pktSpawnExperienceOrb);
+ Pkt.WriteVarInt32(a_ExpOrb.GetUniqueID());
+ Pkt.WriteBEDouble(a_ExpOrb.GetPosX());
+ Pkt.WriteBEDouble(a_ExpOrb.GetPosY());
+ Pkt.WriteBEDouble(a_ExpOrb.GetPosZ());
+ Pkt.WriteBEInt16(static_cast<Int16>(a_ExpOrb.GetReward()));
+}
+
+
+
+
+
void cProtocol_1_9_0::SendExplosion(double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion)
{
ASSERT(m_State == 3); // In game mode?
@@ -1215,37 +1246,6 @@ void cProtocol_1_9_0::SendRespawn(eDimension a_Dimension)
-void cProtocol_1_9_0::SendExperience(void)
-{
- ASSERT(m_State == 3); // In game mode?
-
- cPacketizer Pkt(*this, pktExperience);
- cPlayer * Player = m_Client->GetPlayer();
- Pkt.WriteBEFloat(Player->GetXpPercentage());
- Pkt.WriteVarInt32(static_cast<UInt32>(Player->GetXpLevel()));
- Pkt.WriteVarInt32(static_cast<UInt32>(Player->GetCurrentXp()));
-}
-
-
-
-
-
-void cProtocol_1_9_0::SendExperienceOrb(const cExpOrb & a_ExpOrb)
-{
- ASSERT(m_State == 3); // In game mode?
-
- cPacketizer Pkt(*this, pktSpawnExperienceOrb);
- Pkt.WriteVarInt32(a_ExpOrb.GetUniqueID());
- Pkt.WriteBEDouble(a_ExpOrb.GetPosX());
- Pkt.WriteBEDouble(a_ExpOrb.GetPosY());
- Pkt.WriteBEDouble(a_ExpOrb.GetPosZ());
- Pkt.WriteBEInt16(static_cast<Int16>(a_ExpOrb.GetReward()));
-}
-
-
-
-
-
void cProtocol_1_9_0::SendScoreboardObjective(const AString & a_Name, const AString & a_DisplayName, Byte a_Mode)
{
ASSERT(m_State == 3); // In game mode?
@@ -3392,9 +3392,6 @@ eHand cProtocol_1_9_0::HandIntToEnum(Int32 a_Hand)
-////////////////////////////////////////////////////////////////////////////////
-// cProtocol_1_9_0::cPacketizer:
-
void cProtocol_1_9_0::SendPacket(cPacketizer & a_Pkt)
{
UInt32 PacketLen = static_cast<UInt32>(m_OutPacketBuffer.GetUsedSpace());
@@ -3445,10 +3442,22 @@ void cProtocol_1_9_0::SendPacket(cPacketizer & a_Pkt)
AString Hex;
ASSERT(PacketData.size() > 0);
CreateHexDump(Hex, PacketData.data(), PacketData.size(), 16);
- m_CommLogFile.Printf("Outgoing packet: type %s (0x%02x), length %u (0x%04x), state %d. Payload (incl. type):\n%s\n",
- cPacketizer::PacketTypeToStr(a_Pkt.GetPacketType()), a_Pkt.GetPacketType(), PacketLen, PacketLen, m_State, Hex
+ m_CommLogFile.Printf("Outgoing packet: type %s (translated to 0x%02x), length %u (0x%04x), state %d. Payload (incl. type):\n%s\n",
+ cPacketizer::PacketTypeToStr(a_Pkt.GetPacketType()), GetPacketID(a_Pkt.GetPacketType()),
+ PacketLen, PacketLen, m_State, Hex
+ );
+ /*
+ // Useful for debugging a new protocol:
+ LOGD("Outgoing packet: type %s (translated to 0x%02x), length %u (0x%04x), state %d. Payload (incl. type):\n%s\n",
+ cPacketizer::PacketTypeToStr(a_Pkt.GetPacketType()), GetPacketID(a_Pkt.GetPacketType()),
+ PacketLen, PacketLen, m_State, Hex
);
+ //*/
}
+ /*
+ // Useful for debugging a new protocol:
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ */
}