diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-01-27 03:00:33 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-01-27 03:00:33 +0100 |
commit | 1a127f5510f654d47ee75b3121e52c50d3e7533b (patch) | |
tree | a968d54114b660c637bb6a9ce4102cb8257e0903 /source/Blocks | |
parent | Removed cMCLogger from Lua API (diff) | |
download | cuberite-1a127f5510f654d47ee75b3121e52c50d3e7533b.tar cuberite-1a127f5510f654d47ee75b3121e52c50d3e7533b.tar.gz cuberite-1a127f5510f654d47ee75b3121e52c50d3e7533b.tar.bz2 cuberite-1a127f5510f654d47ee75b3121e52c50d3e7533b.tar.lz cuberite-1a127f5510f654d47ee75b3121e52c50d3e7533b.tar.xz cuberite-1a127f5510f654d47ee75b3121e52c50d3e7533b.tar.zst cuberite-1a127f5510f654d47ee75b3121e52c50d3e7533b.zip |
Diffstat (limited to '')
-rw-r--r-- | source/Blocks/BlockHandler.cpp | 10 | ||||
-rw-r--r-- | source/Blocks/BlockHandler.h | 4 | ||||
-rw-r--r-- | source/Blocks/BlockLeaves.h | 2 |
3 files changed, 11 insertions, 5 deletions
diff --git a/source/Blocks/BlockHandler.cpp b/source/Blocks/BlockHandler.cpp index 715db910e..5c535e052 100644 --- a/source/Blocks/BlockHandler.cpp +++ b/source/Blocks/BlockHandler.cpp @@ -3,6 +3,8 @@ #include "BlockHandler.h"
#include "../Item.h"
#include "../World.h"
+#include "../Root.h"
+#include "../PluginManager.h"
#include "BlockSand.h"
#include "BlockGravel.h"
#include "BlockDoor.h"
@@ -321,11 +323,15 @@ void cBlockHandler::ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) -void cBlockHandler::DropBlock(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
+void cBlockHandler::DropBlock(cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ)
{
cItems Pickups;
NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
ConvertToPickups(Pickups, Meta);
+
+ // Allow plugins to modify the pickups:
+ cRoot::Get()->GetPluginManager()->CallHookBlockToPickups(a_World, a_Digger, a_BlockX, a_BlockY, a_BlockZ, m_BlockType, Meta, Pickups);
+
if (!Pickups.empty())
{
a_World->SpawnItemPickups(Pickups, a_BlockX, a_BlockY, a_BlockZ);
@@ -423,7 +429,7 @@ void cBlockHandler::Check(cWorld * a_World, int a_BlockX, int a_BlockY, int a_Bl {
if (DoesDropOnUnsuitable())
{
- DropBlock(a_World, a_BlockX, a_BlockY, a_BlockZ);
+ DropBlock(a_World, NULL, a_BlockX, a_BlockY, a_BlockZ);
}
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
diff --git a/source/Blocks/BlockHandler.h b/source/Blocks/BlockHandler.h index d2ef527da..e551668f9 100644 --- a/source/Blocks/BlockHandler.h +++ b/source/Blocks/BlockHandler.h @@ -68,8 +68,8 @@ public: /// Called when the item is mined to convert it into pickups. Pickups may specify multiple items.
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta);
- /// Handles the dropping of a block based on what ConvertToDrops() returns. This will not destroy the block
- virtual void DropBlock(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ);
+ /// Handles the dropping of a block based on what ConvertToDrops() returns. This will not destroy the block. a_Digger is the entity causing the drop; it may be NULL
+ virtual void DropBlock(cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ);
/// Returns step sound name of block
virtual const char * GetStepSound(void);
diff --git a/source/Blocks/BlockLeaves.h b/source/Blocks/BlockLeaves.h index 76b5e6d60..101f7c087 100644 --- a/source/Blocks/BlockLeaves.h +++ b/source/Blocks/BlockLeaves.h @@ -113,7 +113,7 @@ public: return;
}
// Decay the leaves:
- DropBlock(a_World, a_BlockX, a_BlockY, a_BlockZ);
+ DropBlock(a_World, NULL, a_BlockX, a_BlockY, a_BlockZ);
a_World->DigBlock(a_BlockX, a_BlockY, a_BlockZ);
|