summaryrefslogtreecommitdiffstats
path: root/src/Entities/ArrowEntity.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2019-10-11 11:02:53 +0200
committerMattes D <github@xoft.cz>2019-10-28 10:45:43 +0100
commit61904af626b036b6e4e045ca219b2a361aa45a6e (patch)
tree60b99ab37c9ec87ca96d403b3254a4da023cf6ac /src/Entities/ArrowEntity.cpp
parentUpdate README.md (#4423) (diff)
downloadcuberite-61904af626b036b6e4e045ca219b2a361aa45a6e.tar
cuberite-61904af626b036b6e4e045ca219b2a361aa45a6e.tar.gz
cuberite-61904af626b036b6e4e045ca219b2a361aa45a6e.tar.bz2
cuberite-61904af626b036b6e4e045ca219b2a361aa45a6e.tar.lz
cuberite-61904af626b036b6e4e045ca219b2a361aa45a6e.tar.xz
cuberite-61904af626b036b6e4e045ca219b2a361aa45a6e.tar.zst
cuberite-61904af626b036b6e4e045ca219b2a361aa45a6e.zip
Diffstat (limited to '')
-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
}