summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities/BeaconEntity.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-05-07 12:54:58 +0200
committerHowaner <franzi.moos@googlemail.com>2014-05-07 12:54:58 +0200
commitf5fe3682201e2f1356e3a5c408eb8296b542e072 (patch)
tree208ec7a760b9e909fbb43e1a12ee43d866cb9df7 /src/BlockEntities/BeaconEntity.cpp
parentRemove old import (diff)
parentFixed wires powering wires diagonally below them (diff)
downloadcuberite-f5fe3682201e2f1356e3a5c408eb8296b542e072.tar
cuberite-f5fe3682201e2f1356e3a5c408eb8296b542e072.tar.gz
cuberite-f5fe3682201e2f1356e3a5c408eb8296b542e072.tar.bz2
cuberite-f5fe3682201e2f1356e3a5c408eb8296b542e072.tar.lz
cuberite-f5fe3682201e2f1356e3a5c408eb8296b542e072.tar.xz
cuberite-f5fe3682201e2f1356e3a5c408eb8296b542e072.tar.zst
cuberite-f5fe3682201e2f1356e3a5c408eb8296b542e072.zip
Diffstat (limited to 'src/BlockEntities/BeaconEntity.cpp')
-rw-r--r--src/BlockEntities/BeaconEntity.cpp116
1 files changed, 116 insertions, 0 deletions
diff --git a/src/BlockEntities/BeaconEntity.cpp b/src/BlockEntities/BeaconEntity.cpp
new file mode 100644
index 000000000..0914353eb
--- /dev/null
+++ b/src/BlockEntities/BeaconEntity.cpp
@@ -0,0 +1,116 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "BeaconEntity.h"
+#include "../BlockArea.h"
+
+
+
+
+
+cBeaconEntity::cBeaconEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) :
+ super(E_BLOCK_BEACON, a_BlockX, a_BlockY, a_BlockZ, a_World)
+{
+}
+
+
+
+
+
+int cBeaconEntity::GetPyramidLevel(void)
+{
+ 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,
+ MinY, MaxY,
+ GetPosZ() - 4, GetPosZ() + 4,
+ cBlockArea::baTypes
+ );
+
+ int Layer = 1;
+ int MiddleXZ = 4;
+
+ for (int Y = Area.GetSizeY() - 1; Y > 0; Y--)
+ {
+ for (int X = MiddleXZ - Layer; X <= (MiddleXZ + Layer); X++)
+ {
+ for (int Z = MiddleXZ - Layer; Z <= (MiddleXZ + Layer); Z++)
+ {
+ if (!IsMineralBlock(Area.GetRelBlockType(X, Y, Z)))
+ {
+ return Layer - 1;
+ }
+ }
+ }
+ Layer++;
+ }
+
+ return Layer - 1;
+}
+
+
+
+
+
+bool cBeaconEntity::IsMineralBlock(BLOCKTYPE a_BlockType)
+{
+ switch(a_BlockType)
+ {
+ case E_BLOCK_DIAMOND_BLOCK:
+ case E_BLOCK_GOLD_BLOCK:
+ case E_BLOCK_IRON_BLOCK:
+ case E_BLOCK_EMERALD_BLOCK:
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+
+
+
+bool cBeaconEntity::Tick(float a_Dt, cChunk & a_Chunk)
+{
+ return false;
+}
+
+
+
+
+
+void cBeaconEntity::SaveToJson(Json::Value& a_Value)
+{
+}
+
+
+
+
+void cBeaconEntity::SendTo(cClientHandle & a_Client)
+{
+}
+
+
+
+
+
+void cBeaconEntity::UsedBy(cPlayer * a_Player)
+{
+}
+
+
+
+