summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Mobs/Horse.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Mobs/Horse.cpp b/src/Mobs/Horse.cpp
index 926f125b9..e42241700 100644
--- a/src/Mobs/Horse.cpp
+++ b/src/Mobs/Horse.cpp
@@ -54,12 +54,14 @@ void cHorse::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
return;
}
+ bool MetadataDirty = false;
auto & Random = GetRandomProvider();
if (!m_bIsMouthOpen)
{
if (Random.RandBool(0.02))
{
+ MetadataDirty = true;
m_bIsMouthOpen = true;
}
}
@@ -67,6 +69,7 @@ void cHorse::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
if (Random.RandBool(0.10))
{
+ MetadataDirty = true;
m_bIsMouthOpen = false;
}
}
@@ -84,12 +87,14 @@ void cHorse::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
m_World->BroadcastSoundEffect("entity.horse.angry", GetPosition(), 1.0f, 1.0f);
m_Attachee->Detach();
+ MetadataDirty = true;
m_bIsRearing = true;
}
}
else
{
m_World->BroadcastParticleEffect("heart", static_cast<Vector3f>(GetPosition()), Vector3f{}, 0, 5);
+ MetadataDirty = true;
m_bIsTame = true;
}
}
@@ -98,6 +103,7 @@ void cHorse::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
if (m_RearTickCount == 20)
{
+ MetadataDirty = true;
m_bIsRearing = false;
m_RearTickCount = 0;
}
@@ -107,7 +113,10 @@ void cHorse::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
}
}
- m_World->BroadcastEntityMetadata(*this);
+ if (MetadataDirty)
+ {
+ m_World->BroadcastEntityMetadata(*this);
+ }
}