From 66c211c33afa1dc99f6dc3a03119ad0b99ce50c5 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 9 Apr 2021 23:17:01 +0100 Subject: Unify multiprotocol entity animations --- src/Mobs/Monster.cpp | 2 +- src/Mobs/Ocelot.cpp | 6 ++---- src/Mobs/Sheep.cpp | 2 +- src/Mobs/Villager.cpp | 2 +- src/Mobs/Wolf.cpp | 6 ++---- 5 files changed, 7 insertions(+), 11 deletions(-) (limited to 'src/Mobs') diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 1537a8a74..c1a244a9f 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -1463,7 +1463,7 @@ void cMonster::RightClickFeed(cPlayer & a_Player) a_Player.GetInventory().RemoveOneEquippedItem(); } m_LoveTimer = TPS * 30; // half a minute - m_World->BroadcastEntityStatus(*this, esMobInLove); + m_World->BroadcastEntityAnimation(*this, EntityAnimation::AnimalFallsInLove); } } // If a player holding my spawn egg right-clicked me, spawn a new baby diff --git a/src/Mobs/Ocelot.cpp b/src/Mobs/Ocelot.cpp index 329c17527..4b731154d 100644 --- a/src/Mobs/Ocelot.cpp +++ b/src/Mobs/Ocelot.cpp @@ -166,14 +166,12 @@ void cOcelot::OnRightClicked(cPlayer & a_Player) SetIsTame(true); SetOwner(a_Player.GetName(), a_Player.GetUUID()); SetCatType(static_cast(Random.RandInt(1, 3))); - m_World->BroadcastEntityStatus(*this, esWolfTamed); - m_World->BroadcastParticleEffect("heart", static_cast(GetPosition()), Vector3f{}, 0, 5); + m_World->BroadcastEntityAnimation(*this, EntityAnimation::OcelotTrusts); } else { // Taming failed - m_World->BroadcastEntityStatus(*this, esWolfTaming); - m_World->BroadcastParticleEffect("smoke", static_cast(GetPosition()), Vector3f{}, 0, 5); + m_World->BroadcastEntityAnimation(*this, EntityAnimation::OcelotDistrusts); } } } diff --git a/src/Mobs/Sheep.cpp b/src/Mobs/Sheep.cpp index 7808d3181..156046c74 100644 --- a/src/Mobs/Sheep.cpp +++ b/src/Mobs/Sheep.cpp @@ -129,7 +129,7 @@ void cSheep::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { if (m_World->GetBlock({ PosX, PosY, PosZ }) == E_BLOCK_GRASS) { - m_World->BroadcastEntityStatus(*this, esSheepEating); + m_World->BroadcastEntityAnimation(*this, EntityAnimation::SheepEatsGrass); m_TimeToStopEating = 40; } } diff --git a/src/Mobs/Villager.cpp b/src/Mobs/Villager.cpp index 156515880..46dd613f1 100644 --- a/src/Mobs/Villager.cpp +++ b/src/Mobs/Villager.cpp @@ -34,7 +34,7 @@ bool cVillager::DoTakeDamage(TakeDamageInfo & a_TDI) { if (GetRandomProvider().RandBool(1.0 / 6.0)) { - m_World->BroadcastEntityStatus(*this, esVillagerAngry); + m_World->BroadcastEntityAnimation(*this, EntityAnimation::VillagerShowsAnger); } } diff --git a/src/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp index 85d2a5a1b..0a3a12ea7 100644 --- a/src/Mobs/Wolf.cpp +++ b/src/Mobs/Wolf.cpp @@ -185,14 +185,12 @@ void cWolf::OnRightClicked(cPlayer & a_Player) SetMaxHealth(20); SetIsTame(true); SetOwner(a_Player.GetName(), a_Player.GetUUID()); - m_World->BroadcastEntityStatus(*this, esWolfTamed); - m_World->BroadcastParticleEffect("heart", static_cast(GetPosition()), Vector3f{}, 0, 5); + m_World->BroadcastEntityAnimation(*this, EntityAnimation::WolfTamingSucceeds); } else { // Taming failed - m_World->BroadcastEntityStatus(*this, esWolfTaming); - m_World->BroadcastParticleEffect("smoke", static_cast(GetPosition()), Vector3f{}, 0, 5); + m_World->BroadcastEntityAnimation(*this, EntityAnimation::WolfTamingFails); } } } -- cgit v1.2.3