diff options
author | Gargaj <gargaj@conspiracy.hu> | 2015-11-10 14:02:07 +0100 |
---|---|---|
committer | Gargaj <gargaj@conspiracy.hu> | 2015-12-13 15:16:15 +0100 |
commit | 66e65898838e3d5d40dfb225fd6c34f0f354b2e3 (patch) | |
tree | 159a72d2f877d4672d1a633853584c5b5e723f21 /src/Blocks/BlockStairs.h | |
parent | Merge pull request #2743 from SafwatHalaby/wart (diff) | |
download | cuberite-66e65898838e3d5d40dfb225fd6c34f0f354b2e3.tar cuberite-66e65898838e3d5d40dfb225fd6c34f0f354b2e3.tar.gz cuberite-66e65898838e3d5d40dfb225fd6c34f0f354b2e3.tar.bz2 cuberite-66e65898838e3d5d40dfb225fd6c34f0f354b2e3.tar.lz cuberite-66e65898838e3d5d40dfb225fd6c34f0f354b2e3.tar.xz cuberite-66e65898838e3d5d40dfb225fd6c34f0f354b2e3.tar.zst cuberite-66e65898838e3d5d40dfb225fd6c34f0f354b2e3.zip |
Diffstat (limited to 'src/Blocks/BlockStairs.h')
-rw-r--r-- | src/Blocks/BlockStairs.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Blocks/BlockStairs.h b/src/Blocks/BlockStairs.h index 8a23fd064..3d7dd1442 100644 --- a/src/Blocks/BlockStairs.h +++ b/src/Blocks/BlockStairs.h @@ -115,6 +115,38 @@ public: } } } + + /** EXCEPTION a.k.a. why is this removed: + This collision-detection is actually more accurate than the client, but since the client itself + sends inaccurate / sparse data, it's easier to just err on the side of the client and keep the + two in sync by assuming that if a player hit ANY of the stair's bounding cube, it counts as the ground. */ + #if 0 + bool IsInsideBlock(const Vector3d & a_Position, const BLOCKTYPE a_BlockType, const NIBBLETYPE a_BlockMeta) + { + if (a_BlockMeta & 0x4) // upside down + { + return true; + } + else if ((a_BlockMeta & 0x3) == 0) // tall side is east (+X) + { + return a_Position.y < ((a_Position.x > 0.5) ? 1.0 : 0.5); + } + else if ((a_BlockMeta & 0x3) == 1) // tall side is west (-X) + { + return a_Position.y < ((a_Position.x < 0.5) ? 1.0 : 0.5); + } + else if ((a_BlockMeta & 0x3) == 2) // tall side is south (+Z) + { + return a_Position.y < ((a_Position.z > 0.5) ? 1.0 : 0.5); + } + else if ((a_BlockMeta & 0x3) == 3) // tall side is north (-Z) + { + return a_Position.y < ((a_Position.z < 0.5) ? 1.0 : 0.5); + } + return false; + } + #endif + } ; |