From 07ca09574072b303064eafb2751f8f83c865f083 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 4 May 2020 09:10:47 +0100 Subject: Improve entity position updates (#4701) * Make puking pickups fly nicer * Improve entity position updates * Move determination of whether a delta is too big for a packet into the protocol handlers + Less jittery movement + Generalise CollectEntity to take any entity --- src/Protocol/ProtocolRecognizer.cpp | 52 ++++++++++++------------------------- 1 file changed, 16 insertions(+), 36 deletions(-) (limited to 'src/Protocol/ProtocolRecognizer.cpp') diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp index d5f40b19b..ddc1aaf93 100644 --- a/src/Protocol/ProtocolRecognizer.cpp +++ b/src/Protocol/ProtocolRecognizer.cpp @@ -233,10 +233,10 @@ void cProtocolRecognizer::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSe -void cProtocolRecognizer::SendCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, int a_Count) +void cProtocolRecognizer::SendCollectEntity(const cEntity & a_Collected, const cEntity & a_Collector, unsigned a_Count) { ASSERT(m_Protocol != nullptr); - m_Protocol->SendCollectEntity(a_Entity, a_Player, a_Count); + m_Protocol->SendCollectEntity(a_Collected, a_Collector, a_Count); } @@ -291,6 +291,16 @@ void cProtocolRecognizer::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ) +void cProtocolRecognizer::SendEntityAnimation(const cEntity & a_Entity, char a_Animation) +{ + ASSERT(m_Protocol != nullptr); + m_Protocol->SendEntityAnimation(a_Entity, a_Animation); +} + + + + + void cProtocolRecognizer::SendEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, int a_Duration) { ASSERT(m_Protocol != nullptr); @@ -341,30 +351,20 @@ void cProtocolRecognizer::SendEntityMetadata(const cEntity & a_Entity) -void cProtocolRecognizer::SendEntityProperties(const cEntity & a_Entity) -{ - ASSERT(m_Protocol != nullptr); - m_Protocol->SendEntityProperties(a_Entity); -} - - - - - -void cProtocolRecognizer::SendEntityRelMove(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) +void cProtocolRecognizer::SendEntityPosition(const cEntity & a_Entity) { ASSERT(m_Protocol != nullptr); - m_Protocol->SendEntityRelMove(a_Entity, a_RelX, a_RelY, a_RelZ); + m_Protocol->SendEntityPosition(a_Entity); } -void cProtocolRecognizer::SendEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) +void cProtocolRecognizer::SendEntityProperties(const cEntity & a_Entity) { ASSERT(m_Protocol != nullptr); - m_Protocol->SendEntityRelMoveLook(a_Entity, a_RelX, a_RelY, a_RelZ); + m_Protocol->SendEntityProperties(a_Entity); } @@ -560,16 +560,6 @@ void cProtocolRecognizer::SendPlayerAbilities(void) -void cProtocolRecognizer::SendEntityAnimation(const cEntity & a_Entity, char a_Animation) -{ - ASSERT(m_Protocol != nullptr); - m_Protocol->SendEntityAnimation(a_Entity, a_Animation); -} - - - - - void cProtocolRecognizer::SendPlayerListAddPlayer(const cPlayer & a_Player) { ASSERT(m_Protocol != nullptr); @@ -860,16 +850,6 @@ void cProtocolRecognizer::SendTabCompletionResults(const AStringVector & a_Resul -void cProtocolRecognizer::SendTeleportEntity(const cEntity & a_Entity) -{ - ASSERT(m_Protocol != nullptr); - m_Protocol->SendTeleportEntity(a_Entity); -} - - - - - void cProtocolRecognizer::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ) { ASSERT(m_Protocol != nullptr); -- cgit v1.2.3