summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-02-02 15:59:36 +0100
committerTycho <work.tycho+git@gmail.com>2014-02-02 15:59:36 +0100
commit42497847acd65c34b67f4c6c2a16320ecbe19c65 (patch)
treeca1faaae5c7d0fbd756f4cee56f61500ba0a12ed /src
parentMerge branch 'master' into GeneratingBenchmark2 (diff)
downloadcuberite-42497847acd65c34b67f4c6c2a16320ecbe19c65.tar
cuberite-42497847acd65c34b67f4c6c2a16320ecbe19c65.tar.gz
cuberite-42497847acd65c34b67f4c6c2a16320ecbe19c65.tar.bz2
cuberite-42497847acd65c34b67f4c6c2a16320ecbe19c65.tar.lz
cuberite-42497847acd65c34b67f4c6c2a16320ecbe19c65.tar.xz
cuberite-42497847acd65c34b67f4c6c2a16320ecbe19c65.tar.zst
cuberite-42497847acd65c34b67f4c6c2a16320ecbe19c65.zip
Diffstat (limited to 'src')
-rw-r--r--src/BlockInServerPluginInterface.h19
-rw-r--r--src/Blocks/BlockPluginInterface.h8
-rw-r--r--src/Blocks/ChunkInterface.cpp12
3 files changed, 39 insertions, 0 deletions
diff --git a/src/BlockInServerPluginInterface.h b/src/BlockInServerPluginInterface.h
new file mode 100644
index 000000000..e82435364
--- /dev/null
+++ b/src/BlockInServerPluginInterface.h
@@ -0,0 +1,19 @@
+
+#pragma once
+
+#include "Blocks/BlockPluginInterface.h"
+#include "World.h"
+#include "Root.h"
+#include "Bindings/PluginManager.h"
+
+class cBlockInServerPluginInterface : public cBlockPluginInterface
+{
+public:
+ cBlockInServerPluginInterface(cWorld & a_World) : m_World(a_World) {}
+ virtual bool CallHookBlockToPickups(cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups) override
+ {
+ return cRoot::Get()->GetPluginManager()->CallHookBlockToPickups(&m_World, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_Pickups);
+ }
+private:
+ cWorld & m_World;
+};
diff --git a/src/Blocks/BlockPluginInterface.h b/src/Blocks/BlockPluginInterface.h
new file mode 100644
index 000000000..7428c9a7a
--- /dev/null
+++ b/src/Blocks/BlockPluginInterface.h
@@ -0,0 +1,8 @@
+
+#pragma once
+
+class cBlockPluginInterface
+{
+public:
+ virtual bool CallHookBlockToPickups(cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups) = 0;
+};
diff --git a/src/Blocks/ChunkInterface.cpp b/src/Blocks/ChunkInterface.cpp
new file mode 100644
index 000000000..b2dda19f4
--- /dev/null
+++ b/src/Blocks/ChunkInterface.cpp
@@ -0,0 +1,12 @@
+
+#include "Globals.h"
+
+#include "ChunkInterface.h"
+#include "BlockHandler.h"
+
+bool cChunkInterface::DigBlock(cWorldInterface & a_WorldInterface, int a_X, int a_Y, int a_Z)
+{
+ cBlockHandler *Handler = cBlockHandler::GetBlockHandler(GetBlock(a_X, a_Y, a_Z));
+ Handler->OnDestroyed(*this, a_WorldInterface, a_X, a_Y, a_Z);
+ return m_ChunkMap->DigBlock(a_X, a_Y, a_Z);
+}