diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-07-07 22:14:15 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-07-07 22:14:15 +0200 |
commit | 7c7501abc5345ec4eddd030ab4649b05354002c3 (patch) | |
tree | 6b197b060715b81aecaf32165b8479da0f989c6e /src | |
parent | Changed everything to callbacks (diff) | |
download | cuberite-7c7501abc5345ec4eddd030ab4649b05354002c3.tar cuberite-7c7501abc5345ec4eddd030ab4649b05354002c3.tar.gz cuberite-7c7501abc5345ec4eddd030ab4649b05354002c3.tar.bz2 cuberite-7c7501abc5345ec4eddd030ab4649b05354002c3.tar.lz cuberite-7c7501abc5345ec4eddd030ab4649b05354002c3.tar.xz cuberite-7c7501abc5345ec4eddd030ab4649b05354002c3.tar.zst cuberite-7c7501abc5345ec4eddd030ab4649b05354002c3.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/Entities/ProjectileEntity.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp index 334973833..0bb34019e 100644 --- a/src/Entities/ProjectileEntity.cpp +++ b/src/Entities/ProjectileEntity.cpp @@ -69,15 +69,15 @@ protected: if (cBlockInfo::IsSolid(a_BlockType)) { // The projectile hit a solid block, calculate the exact hit coords: - cBoundingBox bb(a_BlockX, a_BlockX + 1, a_BlockY, a_BlockY + 1, a_BlockZ, a_BlockZ + 1); // Bounding box of the block hit - const Vector3d LineStart = m_Projectile->GetPosition(); // Start point for the imaginary line that goes through the block hit - const Vector3d LineEnd = LineStart + m_Projectile->GetSpeed(); // End point for the imaginary line that goes through the block hit - double LineCoeff = 0; // Used to calculate where along the line an intersection with the bounding box occurs - eBlockFace Face; // Face hit + cBoundingBox bb(a_BlockX, a_BlockX + 1, a_BlockY, a_BlockY + 1, a_BlockZ, a_BlockZ + 1); // Bounding box of the block hit + const Vector3d LineStart = m_Projectile->GetPosition(); // Start point for the imaginary line that goes through the block hit + const Vector3d LineEnd = LineStart + m_Projectile->GetSpeed(); // End point for the imaginary line that goes through the block hit + double LineCoeff = 0; // Used to calculate where along the line an intersection with the bounding box occurs + eBlockFace Face; // Face hit if (bb.CalcLineIntersection(LineStart, LineEnd, LineCoeff, Face)) { - Vector3d Intersection = LineStart + m_Projectile->GetSpeed() * LineCoeff; // Point where projectile goes into the hit block + Vector3d Intersection = LineStart + m_Projectile->GetSpeed() * LineCoeff; // Point where projectile goes into the hit block if (cPluginManager::Get()->CallHookProjectileHitBlock(*m_Projectile, a_BlockX, a_BlockY, a_BlockZ, Face, &Intersection)) { |