1
0

Convert most calls to blocking GetHeight/GetBiomeAt to direct chunk accesses

* Hopefully fixes #5094
This commit is contained in:
Tiger Wang
2021-01-05 02:13:02 +00:00
parent eeb63b8901
commit 9328afe65c
14 changed files with 204 additions and 88 deletions

View File

@@ -74,10 +74,6 @@ eMonsterType cMobSpawner::ChooseMobType(EMCSBiome a_Biome)
bool cMobSpawner::CanSpawnHere(cChunk * a_Chunk, Vector3i a_RelPos, eMonsterType a_MobType, EMCSBiome a_Biome, bool a_DisableSolidBelowCheck)
{
if (a_Chunk == nullptr)
{
return false;
}
if ((a_RelPos.y >= cChunkDef::Height - 1) || (a_RelPos.y <= 0))
{
return false;
@@ -502,9 +498,6 @@ cMonster * cMobSpawner::TryToSpawnHere(cChunk * a_Chunk, Vector3i a_RelPos, EMCS
m_NewPack = false;
}
// Make sure we are looking at the right chunk to spawn in
a_Chunk = a_Chunk->GetRelNeighborChunkAdjustCoords(a_RelPos);
if ((m_AllowedTypes.find(m_MobType) != m_AllowedTypes.end()) && CanSpawnHere(a_Chunk, a_RelPos, m_MobType, a_Biome))
{
auto NewMob = cMonster::NewMonsterFromType(m_MobType);