summaryrefslogtreecommitdiffstats
path: root/src/Entities/Boat.cpp
diff options
context:
space:
mode:
authorMat <mail@mathias.is>2020-07-17 20:33:02 +0200
committerGitHub <noreply@github.com>2020-07-17 20:33:02 +0200
commiteb0f640fa01ff9be5516f5ae3da33b2e76756577 (patch)
tree0e60a4cd1b2213573e4fcf6610ea7905f627feca /src/Entities/Boat.cpp
parentcProtocolRecognizer goes on a diet (#4770) (diff)
downloadcuberite-eb0f640fa01ff9be5516f5ae3da33b2e76756577.tar
cuberite-eb0f640fa01ff9be5516f5ae3da33b2e76756577.tar.gz
cuberite-eb0f640fa01ff9be5516f5ae3da33b2e76756577.tar.bz2
cuberite-eb0f640fa01ff9be5516f5ae3da33b2e76756577.tar.lz
cuberite-eb0f640fa01ff9be5516f5ae3da33b2e76756577.tar.xz
cuberite-eb0f640fa01ff9be5516f5ae3da33b2e76756577.tar.zst
cuberite-eb0f640fa01ff9be5516f5ae3da33b2e76756577.zip
Diffstat (limited to 'src/Entities/Boat.cpp')
-rw-r--r--src/Entities/Boat.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/Entities/Boat.cpp b/src/Entities/Boat.cpp
index 1f7963465..4400cd4c0 100644
--- a/src/Entities/Boat.cpp
+++ b/src/Entities/Boat.cpp
@@ -34,6 +34,7 @@ cBoat::cBoat(Vector3d a_Pos, eMaterial a_Material) :
void cBoat::SpawnOn(cClientHandle & a_ClientHandle)
{
a_ClientHandle.SendSpawnEntity(*this);
+ a_ClientHandle.SendEntityMetadata(*this); // Boat colour
}
@@ -154,9 +155,6 @@ void cBoat::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
SetLastDamage(GetLastDamage() - 1);
}
-
- // Broadcast any changes in position
- m_World->BroadcastEntityMetadata(*this);
}
@@ -183,6 +181,9 @@ void cBoat::HandleSpeedFromAttachee(float a_Forward, float a_Sideways)
void cBoat::SetLastDamage(int TimeSinceLastHit)
{
m_LastDamage = TimeSinceLastHit;
+
+ // Tell the client to play the shaking animation
+ m_World->BroadcastEntityMetadata(*this);
}
@@ -191,10 +192,16 @@ void cBoat::SetLastDamage(int TimeSinceLastHit)
void cBoat::UpdatePaddles(bool a_RightPaddleUsed, bool a_LeftPaddleUsed)
{
+ // Avoid telling client what it already knows since it may reset animation 1.13+
+ const bool Changed = (m_RightPaddleUsed != a_RightPaddleUsed) || (m_LeftPaddleUsed != a_LeftPaddleUsed);
+
m_RightPaddleUsed = a_RightPaddleUsed;
m_LeftPaddleUsed = a_LeftPaddleUsed;
- m_World->BroadcastEntityMetadata(*this);
+ if (Changed)
+ {
+ m_World->BroadcastEntityMetadata(*this);
+ }
}