Unify DoWithBlockEntity (#5168)

+ DoWith calls now broadcast the block entity and mark the chunk dirty
+ Add block entity change queue to synchronise BE updates with block updates
* Fixed a few incorrect assertions about BE type
- Remove manual overloads
This commit is contained in:
Tiger Wang
2021-03-28 14:40:57 +01:00
committed by GitHub
parent 5123850db0
commit 748b121703
37 changed files with 550 additions and 1596 deletions
+2 -1
View File
@@ -70,6 +70,7 @@ bool cMobSpawnerEntity::UsedBy(cPlayer * a_Player)
{
a_Player->GetInventory().RemoveOneEquippedItem();
}
m_World->BroadcastBlockEntity(GetPos());
FLOGD("Changed monster spawner at {0} to type {1}.", GetPos(), cMonster::MobTypeToString(MonsterType));
return true;
}
@@ -105,6 +106,7 @@ bool cMobSpawnerEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
if (m_SpawnDelay <= 0)
{
SpawnEntity();
m_World->BroadcastBlockEntity(GetPos());
return true;
}
else
@@ -121,7 +123,6 @@ bool cMobSpawnerEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
void cMobSpawnerEntity::ResetTimer(void)
{
m_SpawnDelay = GetRandomProvider().RandInt<short>(m_MinSpawnDelay, m_MaxSpawnDelay);
m_World->BroadcastBlockEntity(GetPos());
}