summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities
diff options
context:
space:
mode:
authorSTRWarrior <niels.breuker@hotmail.nl>2014-04-12 00:35:13 +0200
committerSTRWarrior <niels.breuker@hotmail.nl>2014-04-12 00:35:13 +0200
commit433bd530f38b78bb7e276acafef40fec47d43267 (patch)
tree94b9442a177c0676560a5bd29b052d74393c9226 /src/BlockEntities
parentRemoved debug message. (diff)
downloadcuberite-433bd530f38b78bb7e276acafef40fec47d43267.tar
cuberite-433bd530f38b78bb7e276acafef40fec47d43267.tar.gz
cuberite-433bd530f38b78bb7e276acafef40fec47d43267.tar.bz2
cuberite-433bd530f38b78bb7e276acafef40fec47d43267.tar.lz
cuberite-433bd530f38b78bb7e276acafef40fec47d43267.tar.xz
cuberite-433bd530f38b78bb7e276acafef40fec47d43267.tar.zst
cuberite-433bd530f38b78bb7e276acafef40fec47d43267.zip
Diffstat (limited to '')
-rw-r--r--src/BlockEntities/BeaconEntity.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/BlockEntities/BeaconEntity.cpp b/src/BlockEntities/BeaconEntity.cpp
index 65fda827c..dd340f24f 100644
--- a/src/BlockEntities/BeaconEntity.cpp
+++ b/src/BlockEntities/BeaconEntity.cpp
@@ -20,14 +20,26 @@ cBeaconEntity::cBeaconEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld *
int cBeaconEntity::GetPyramidLevel()
{
cBlockArea Area;
+ int MinY = GetPosY() - 4;
+ if (MinY < 0)
+ {
+ MinY = 0;
+ }
+ int MaxY = GetPosY() - 1;
+ if (MaxY < 0)
+ {
+ MaxY = 0;
+ }
+
Area.Read(
m_World,
GetPosX() - 4,
GetPosX() + 4,
- GetPosY() - 5,
- GetPosY() - 1,
+ MinY,
+ MaxY,
GetPosZ() - 4,
- GetPosZ() + 4
+ GetPosZ() + 4,
+ cBlockArea::baTypes
);
int Layer = 1;
@@ -41,14 +53,14 @@ int cBeaconEntity::GetPyramidLevel()
{
if (!IsMineralBlock(Area.GetRelBlockType(X, Y, Z)))
{
- return Layer;
+ return Layer - 1;
}
}
}
Layer++;
}
- return Layer;
+ return Layer - 1;
}