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:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user