1
0

Moved growing from cWorld / cChunk to cBlockHandler descendants.

This commit is contained in:
Mattes D
2019-10-11 11:02:53 +02:00
parent f4bf025db9
commit 61904af626
42 changed files with 1527 additions and 1314 deletions

View File

@@ -198,17 +198,16 @@ void cArrowEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
}
}
int RelPosX = m_HitBlockPos.x - a_Chunk.GetPosX() * cChunkDef::Width;
int RelPosZ = m_HitBlockPos.z - a_Chunk.GetPosZ() * cChunkDef::Width;
cChunk * Chunk = a_Chunk.GetRelNeighborChunkAdjustCoords(RelPosX, RelPosZ);
auto relPos = a_Chunk.RelativeToAbsolute(m_HitBlockPos);
auto chunk = a_Chunk.GetRelNeighborChunkAdjustCoords(relPos);
if (Chunk == nullptr)
if (chunk == nullptr)
{
// Inside an unloaded chunk, abort
return;
}
if (Chunk->GetBlock(RelPosX, m_HitBlockPos.y, RelPosZ) == E_BLOCK_AIR) // Block attached to was destroyed?
if (chunk->GetBlock(relPos) == E_BLOCK_AIR) // Block attached to was destroyed?
{
m_IsInGround = false; // Yes, begin simulating physics again
}