summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorAlexander Harkness <bearbin@gmail.com>2014-05-19 11:35:21 +0200
committerAlexander Harkness <bearbin@gmail.com>2014-05-19 11:35:21 +0200
commitdc39d88d3f5951479084c1ea4d51079015777f01 (patch)
treeed7fea1ad3fef8f3c3d3dce17c9106a6acb82fd0 /src/Entities
parentFixed clanging errors. (diff)
downloadcuberite-dc39d88d3f5951479084c1ea4d51079015777f01.tar
cuberite-dc39d88d3f5951479084c1ea4d51079015777f01.tar.gz
cuberite-dc39d88d3f5951479084c1ea4d51079015777f01.tar.bz2
cuberite-dc39d88d3f5951479084c1ea4d51079015777f01.tar.lz
cuberite-dc39d88d3f5951479084c1ea4d51079015777f01.tar.xz
cuberite-dc39d88d3f5951479084c1ea4d51079015777f01.tar.zst
cuberite-dc39d88d3f5951479084c1ea4d51079015777f01.zip
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/Entity.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 1a91639ac..71b9f63a7 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -1005,11 +1005,12 @@ void cEntity::TickInVoid(cChunk & a_Chunk)
void cEntity::DetectCacti()
{
int X = POSX_TOINT, Y = POSY_TOINT, Z = POSZ_TOINT;
+ float w = m_Width / 2
if (
- (((X + 1) - GetPosX() < 0.3) && (GetWorld()->GetBlock(X + 1, Y, Z) == E_BLOCK_CACTUS)) ||
- (((GetPosX() - (X - 1)) - 1 < 0.3) && (GetWorld()->GetBlock(X - 1, Y, Z) == E_BLOCK_CACTUS)) ||
- (((Z + 1) - GetPosZ() < 0.3) && (GetWorld()->GetBlock(X, Y, Z + 1) == E_BLOCK_CACTUS)) ||
- (((GetPosZ() - (Z - 1)) - 1 < 0.3) && (GetWorld()->GetBlock(X, Y, Z - 1) == E_BLOCK_CACTUS)) ||
+ (((X + 1) - GetPosX() < w) && (GetWorld()->GetBlock(X + 1, Y, Z) == E_BLOCK_CACTUS)) ||
+ (((GetPosX() - (X - 1)) - 1 < w) && (GetWorld()->GetBlock(X - 1, Y, Z) == E_BLOCK_CACTUS)) ||
+ (((Z + 1) - GetPosZ() < w) && (GetWorld()->GetBlock(X, Y, Z + 1) == E_BLOCK_CACTUS)) ||
+ (((GetPosZ() - (Z - 1)) - 1 < w) && (GetWorld()->GetBlock(X, Y, Z - 1) == E_BLOCK_CACTUS)) ||
(((Y > 0) && (Y < cChunkDef::Height)) && ((GetPosY() - Y < 1) && (GetWorld()->GetBlock(X, Y, Z) == E_BLOCK_CACTUS)))
)
{