summaryrefslogtreecommitdiffstats
path: root/src/Entities/ArrowEntity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entities/ArrowEntity.cpp')
-rw-r--r--src/Entities/ArrowEntity.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Entities/ArrowEntity.cpp b/src/Entities/ArrowEntity.cpp
index adbee3cf8..ce0adcdcc 100644
--- a/src/Entities/ArrowEntity.cpp
+++ b/src/Entities/ArrowEntity.cpp
@@ -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
}