summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-02-02 15:49:37 +0100
committerTycho <work.tycho+git@gmail.com>2014-02-02 15:49:37 +0100
commitb82fc394dd2a40e12e3c13709fea26c2435792c9 (patch)
treea310eb96470c3651480c5899a36955f87800bee8 /src
parentChanged Signiture of OnDigging (diff)
downloadcuberite-b82fc394dd2a40e12e3c13709fea26c2435792c9.tar
cuberite-b82fc394dd2a40e12e3c13709fea26c2435792c9.tar.gz
cuberite-b82fc394dd2a40e12e3c13709fea26c2435792c9.tar.bz2
cuberite-b82fc394dd2a40e12e3c13709fea26c2435792c9.tar.lz
cuberite-b82fc394dd2a40e12e3c13709fea26c2435792c9.tar.xz
cuberite-b82fc394dd2a40e12e3c13709fea26c2435792c9.tar.zst
cuberite-b82fc394dd2a40e12e3c13709fea26c2435792c9.zip
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockCactus.h2
-rw-r--r--src/Blocks/BlockCrops.h2
-rw-r--r--src/Blocks/BlockDirt.h2
-rw-r--r--src/Blocks/BlockFarmland.h2
-rw-r--r--src/Blocks/BlockFluid.h6
-rw-r--r--src/Blocks/BlockHandler.cpp14
-rw-r--r--src/Blocks/BlockHandler.h7
-rw-r--r--src/Blocks/BlockLeaves.h6
-rw-r--r--src/Blocks/BlockNetherWart.h2
-rw-r--r--src/Blocks/BlockSapling.h2
-rw-r--r--src/Blocks/BlockStems.h2
-rw-r--r--src/Blocks/BlockSugarcane.h2
-rw-r--r--src/Blocks/BlockVine.h4
-rw-r--r--src/Chunk.cpp14
-rw-r--r--src/Items/ItemBucket.h5
-rw-r--r--src/Items/ItemHandler.cpp5
-rw-r--r--src/Items/ItemShovel.h7
-rw-r--r--src/Mobs/Villager.cpp5
-rw-r--r--src/Piston.cpp5
-rw-r--r--src/Simulator/FloodyFluidSimulator.cpp8
20 files changed, 65 insertions, 37 deletions
diff --git a/src/Blocks/BlockCactus.h b/src/Blocks/BlockCactus.h
index 70c9c5257..83595d2b9 100644
--- a/src/Blocks/BlockCactus.h
+++ b/src/Blocks/BlockCactus.h
@@ -65,7 +65,7 @@ public:
}
- void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
+ virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
a_Chunk.GetWorld()->GrowCactus(a_RelX + a_Chunk.GetPosX() * cChunkDef::Width, a_RelY, a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width, 1);
}
diff --git a/src/Blocks/BlockCrops.h b/src/Blocks/BlockCrops.h
index c86183ca4..4c4ac21be 100644
--- a/src/Blocks/BlockCrops.h
+++ b/src/Blocks/BlockCrops.h
@@ -74,7 +74,7 @@ public:
}
- void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
+ virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
NIBBLETYPE Meta = a_Chunk.GetMeta (a_RelX, a_RelY, a_RelZ);
NIBBLETYPE Light = a_Chunk.GetBlockLight(a_RelX, a_RelY, a_RelZ);
diff --git a/src/Blocks/BlockDirt.h b/src/Blocks/BlockDirt.h
index 1cc6bc0c3..91534c5e5 100644
--- a/src/Blocks/BlockDirt.h
+++ b/src/Blocks/BlockDirt.h
@@ -25,7 +25,7 @@ public:
}
- void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
+ virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
if (m_BlockType != E_BLOCK_GRASS)
{
diff --git a/src/Blocks/BlockFarmland.h b/src/Blocks/BlockFarmland.h
index a69d9b775..101ab8e34 100644
--- a/src/Blocks/BlockFarmland.h
+++ b/src/Blocks/BlockFarmland.h
@@ -28,7 +28,7 @@ public:
}
- void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
+ virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
bool Found = false;
diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h
index fbdbec26c..37885e4de 100644
--- a/src/Blocks/BlockFluid.h
+++ b/src/Blocks/BlockFluid.h
@@ -32,7 +32,7 @@ public:
}
- virtual void Check(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override
+ virtual void Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override
{
switch (m_BlockType)
{
@@ -47,7 +47,7 @@ public:
break;
}
}
- super::Check(a_ChunkInterface, a_RelX, a_RelY, a_RelZ, a_Chunk);
+ super::Check(a_ChunkInterface, a_PluginInterface, a_RelX, a_RelY, a_RelZ, a_Chunk);
}
} ;
@@ -68,7 +68,7 @@ public:
/// Called to tick the block
- virtual void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
+ virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
if (a_Chunk.GetWorld()->ShouldLavaSpawnFire())
{
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp
index 8ce8ec1f7..3f69ba1c1 100644
--- a/src/Blocks/BlockHandler.cpp
+++ b/src/Blocks/BlockHandler.cpp
@@ -261,7 +261,7 @@ bool cBlockHandler::GetPlacementBlockTypeMeta(
-void cBlockHandler::OnUpdate(cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ)
+void cBlockHandler::OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ)
{
}
@@ -361,14 +361,14 @@ void cBlockHandler::ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta)
-void cBlockHandler::DropBlock(cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ)
+void cBlockHandler::DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, 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);
+ NIBBLETYPE Meta = a_ChunkInterface.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);
+ a_BlockPluginInterface.CallHookBlockToPickups(a_Digger, a_BlockX, a_BlockY, a_BlockZ, m_BlockType, Meta, Pickups);
if (!Pickups.empty())
{
@@ -384,7 +384,7 @@ void cBlockHandler::DropBlock(cWorld * a_World, cEntity * a_Digger, int a_BlockX
MicroX += r1.rand(1) - 0.5;
MicroZ += r1.rand(1) - 0.5;
- a_World->SpawnItemPickups(Pickups, MicroX, MicroY, MicroZ);
+ a_WorldInterface.SpawnItemPickups(Pickups, MicroX, MicroY, MicroZ);
}
}
@@ -446,7 +446,7 @@ bool cBlockHandler::DoesDropOnUnsuitable(void)
-void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk)
+void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk)
{
if (!CanBeAt(a_ChunkInterface, a_RelX, a_RelY, a_RelZ, a_Chunk))
{
@@ -454,7 +454,7 @@ void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, int a_RelX, int a_
{
int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width;
int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width;
- DropBlock(a_Chunk.GetWorld(), NULL, BlockX, a_RelY, BlockZ);
+ DropBlock(a_ChunkInterface, *a_Chunk.GetWorld(), a_PluginInterface, NULL, BlockX, a_RelY, BlockZ);
}
a_Chunk.SetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_AIR, 0);
diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h
index 867c4c2c5..44b15bce1 100644
--- a/src/Blocks/BlockHandler.h
+++ b/src/Blocks/BlockHandler.h
@@ -5,6 +5,7 @@
#include "../Item.h"
#include "WorldInterface.h"
#include "ChunkInterface.h"
+#include "BlockPluginInterface.h"
@@ -25,7 +26,7 @@ public:
/// Called when the block gets ticked either by a random tick or by a queued tick.
/// Note that the coords are chunk-relative!
- virtual void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ);
+ virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ);
/** Called before a block is placed into a world.
The handler should return true to allow placement, false to refuse.
@@ -72,7 +73,7 @@ public:
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. 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);
+ virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ);
/// Returns step sound name of block
virtual const char * GetStepSound(void);
@@ -113,7 +114,7 @@ public:
By default drops if position no more suitable (CanBeAt(), DoesDropOnUnsuitable(), Drop()),
and wakes up all simulators on the block.
*/
- virtual void Check(cChunkInterface & ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk);
+ virtual void Check(cChunkInterface & ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk);
/// <summary>Rotates a given block meta counter-clockwise. Default: no change</summary>
/// <returns>Block meta following rotation</returns>
diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h
index 069849361..ad6e440e2 100644
--- a/src/Blocks/BlockLeaves.h
+++ b/src/Blocks/BlockLeaves.h
@@ -77,7 +77,7 @@ public:
}
- void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
+ virtual void OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
if ((Meta & 0x04) != 0)
@@ -116,8 +116,8 @@ public:
}
// Decay the leaves:
- DropBlock(a_Chunk.GetWorld(), NULL, BlockX, a_RelY, BlockZ);
- a_Chunk.GetWorld()->DigBlock(BlockX, a_RelY, BlockZ);
+ DropBlock(a_ChunkInterface, a_WorldInterface, a_PluginInterface, NULL, BlockX, a_RelY, BlockZ);
+ a_ChunkInterface.DigBlock(a_WorldInterface, BlockX, a_RelY, BlockZ);
}
diff --git a/src/Blocks/BlockNetherWart.h b/src/Blocks/BlockNetherWart.h
index 937d2b4b5..923180e19 100644
--- a/src/Blocks/BlockNetherWart.h
+++ b/src/Blocks/BlockNetherWart.h
@@ -35,7 +35,7 @@ public:
}
}
- void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
+ virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
NIBBLETYPE Meta = a_Chunk.GetMeta (a_RelX, a_RelY, a_RelZ);
diff --git a/src/Blocks/BlockSapling.h b/src/Blocks/BlockSapling.h
index 3d6e58438..3d925029a 100644
--- a/src/Blocks/BlockSapling.h
+++ b/src/Blocks/BlockSapling.h
@@ -31,7 +31,7 @@ public:
}
- void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
+ virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
diff --git a/src/Blocks/BlockStems.h b/src/Blocks/BlockStems.h
index ed18817b2..705436345 100644
--- a/src/Blocks/BlockStems.h
+++ b/src/Blocks/BlockStems.h
@@ -24,7 +24,7 @@ public:
}
- void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
+ virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
if (Meta >= 7)
diff --git a/src/Blocks/BlockSugarcane.h b/src/Blocks/BlockSugarcane.h
index 59314e37d..84d3b2e7d 100644
--- a/src/Blocks/BlockSugarcane.h
+++ b/src/Blocks/BlockSugarcane.h
@@ -73,7 +73,7 @@ public:
}
- void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
+ virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
a_Chunk.GetWorld()->GrowSugarcane(a_RelX + a_Chunk.GetPosX() * cChunkDef::Width, a_RelY, a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width, 1);
}
diff --git a/src/Blocks/BlockVine.h b/src/Blocks/BlockVine.h
index aa29849b2..aa0d582b3 100644
--- a/src/Blocks/BlockVine.h
+++ b/src/Blocks/BlockVine.h
@@ -105,7 +105,7 @@ public:
}
- void Check(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override
+ void Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override
{
NIBBLETYPE CurMeta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
NIBBLETYPE MaxMeta = GetMaxMeta(a_Chunk, a_RelX, a_RelY, a_RelZ);
@@ -128,7 +128,7 @@ public:
{
int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width;
int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width;
- DropBlock(a_Chunk.GetWorld(), NULL, BlockX, a_RelY, BlockZ);
+ DropBlock(a_ChunkInterface, *a_Chunk.GetWorld(), a_PluginInterface, NULL, BlockX, a_RelY, BlockZ);
}
a_Chunk.SetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_AIR, 0);
return;
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index b29c97084..b48bfe65e 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -31,7 +31,7 @@
#include "Simulator/FluidSimulator.h"
#include "MobCensus.h"
#include "MobSpawner.h"
-
+#include "BlockInServerPluginInterface.h"
#include "json/json.h"
@@ -638,7 +638,9 @@ void cChunk::TickBlock(int a_RelX, int a_RelY, int a_RelZ)
unsigned Index = MakeIndex(a_RelX, a_RelY, a_RelZ);
cBlockHandler * Handler = BlockHandler(m_BlockTypes[Index]);
ASSERT(Handler != NULL); // Happenned on server restart, FS #243
- Handler->OnUpdate(*this, a_RelX, a_RelY, a_RelZ);
+ cChunkInterface ChunkInterface(this->GetWorld()->GetChunkMap());
+ cBlockInServerPluginInterface PluginInterface(*this->GetWorld());
+ Handler->OnUpdate(ChunkInterface, *this->GetWorld(), PluginInterface,*this, a_RelX, a_RelY, a_RelZ);
}
@@ -763,6 +765,7 @@ void cChunk::CheckBlocks()
std::swap(m_ToTickBlocks, ToTickBlocks);
cChunkInterface ChunkInterface(m_World->GetChunkMap());
+ cBlockInServerPluginInterface PluginInterface(*m_World);
for (std::vector<unsigned int>::const_iterator itr = ToTickBlocks.begin(), end = ToTickBlocks.end(); itr != end; ++itr)
{
@@ -770,7 +773,7 @@ void cChunk::CheckBlocks()
Vector3i BlockPos = IndexToCoordinate(index);
cBlockHandler * Handler = BlockHandler(GetBlock(index));
- Handler->Check(ChunkInterface, BlockPos.x, BlockPos.y, BlockPos.z, *this);
+ Handler->Check(ChunkInterface, PluginInterface, BlockPos.x, BlockPos.y, BlockPos.z, *this);
} // for itr - ToTickBlocks[]
}
@@ -788,6 +791,9 @@ void cChunk::TickBlocks(void)
int TickX = m_BlockTickX;
int TickY = m_BlockTickY;
int TickZ = m_BlockTickZ;
+
+ cChunkInterface ChunkInterface(this->GetWorld()->GetChunkMap());
+ cBlockInServerPluginInterface PluginInterface(*this->GetWorld());
// This for loop looks disgusting, but it actually does a simple thing - first processes m_BlockTick, then adds random to it
// This is so that SetNextBlockTick() works
@@ -813,7 +819,7 @@ void cChunk::TickBlocks(void)
unsigned int Index = MakeIndexNoCheck(m_BlockTickX, m_BlockTickY, m_BlockTickZ);
cBlockHandler * Handler = BlockHandler(m_BlockTypes[Index]);
ASSERT(Handler != NULL); // Happenned on server restart, FS #243
- Handler->OnUpdate(*this, m_BlockTickX, m_BlockTickY, m_BlockTickZ);
+ Handler->OnUpdate(ChunkInterface, *this->GetWorld(), PluginInterface, *this, m_BlockTickX, m_BlockTickY, m_BlockTickZ);
} // for i - tickblocks
}
diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h
index c9a632580..f18a4d959 100644
--- a/src/Items/ItemBucket.h
+++ b/src/Items/ItemBucket.h
@@ -6,6 +6,7 @@
#include "../Simulator/FluidSimulator.h"
#include "../Blocks/BlockHandler.h"
#include "../LineBlockTracer.h"
+#include "../BlockInServerPluginInterface.h"
@@ -142,7 +143,9 @@ public:
cBlockHandler * Handler = BlockHandler(CurrentBlock);
if (Handler->DoesDropOnUnsuitable())
{
- Handler->DropBlock(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ);
+ cChunkInterface ChunkInterface(a_World->GetChunkMap());
+ cBlockInServerPluginInterface PluginInterface(*a_World);
+ Handler->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ);
}
}
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index 2b8b9f794..302796d1b 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -5,6 +5,7 @@
#include "../World.h"
#include "../Entities/Player.h"
#include "../FastRandom.h"
+#include "../BlockInServerPluginInterface.h"
// Handlers:
#include "ItemBed.h"
@@ -257,7 +258,9 @@ void cItemHandler::OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const
{
if (!BlockRequiresSpecialTool(Block) || CanHarvestBlock(Block))
{
- Handler->DropBlock(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ);
+ cChunkInterface ChunkInterface(a_World->GetChunkMap());
+ cBlockInServerPluginInterface PluginInterface(*a_World);
+ Handler->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ);
}
}
diff --git a/src/Items/ItemShovel.h b/src/Items/ItemShovel.h
index d0625ef1c..4921b257a 100644
--- a/src/Items/ItemShovel.h
+++ b/src/Items/ItemShovel.h
@@ -6,6 +6,7 @@
#include "../Entities/Player.h"
#include "../Blocks/BlockHandler.h"
+#include "../BlockInServerPluginInterface.h"
@@ -25,7 +26,9 @@ public:
BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
if (Block == E_BLOCK_SNOW)
{
- BlockHandler(Block)->DropBlock(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ);
+ cChunkInterface ChunkInterface(a_World->GetChunkMap());
+ cBlockInServerPluginInterface PluginInterface(*a_World);
+ BlockHandler(Block)->DropBlock(ChunkInterface,*a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ);
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
a_Player->UseEquippedItem();
@@ -38,4 +41,4 @@ public:
{
return (a_BlockType == E_BLOCK_SNOW);
}
-}; \ No newline at end of file
+};
diff --git a/src/Mobs/Villager.cpp b/src/Mobs/Villager.cpp
index 44ec14295..08e5e4315 100644
--- a/src/Mobs/Villager.cpp
+++ b/src/Mobs/Villager.cpp
@@ -5,6 +5,7 @@
#include "../World.h"
#include "../BlockArea.h"
#include "../Blocks/BlockHandler.h"
+#include "../BlockInServerPluginInterface.h"
@@ -150,7 +151,9 @@ void cVillager::HandleFarmerTryHarvestCrops()
if (IsBlockFarmable(CropBlock) && m_World->GetBlockMeta(m_CropsPos.x, m_CropsPos.y, m_CropsPos.z) == 0x7)
{
cBlockHandler * Handler = cBlockHandler::GetBlockHandler(CropBlock);
- Handler->DropBlock(m_World, this, m_CropsPos.x, m_CropsPos.y, m_CropsPos.z);
+ cChunkInterface ChunkInterface(m_World->GetChunkMap());
+ cBlockInServerPluginInterface PluginInterface(*m_World);
+ Handler->DropBlock(ChunkInterface, *m_World, PluginInterface, this, m_CropsPos.x, m_CropsPos.y, m_CropsPos.z);
m_World->SetBlock(m_CropsPos.x, m_CropsPos.y, m_CropsPos.z, E_BLOCK_AIR, 0);
m_ActionCountDown = 20;
}
diff --git a/src/Piston.cpp b/src/Piston.cpp
index 75eeb5e98..5eb14451d 100644
--- a/src/Piston.cpp
+++ b/src/Piston.cpp
@@ -9,6 +9,7 @@
#include "World.h"
#include "Server.h"
#include "Blocks/BlockHandler.h"
+#include "BlockInServerPluginInterface.h"
@@ -90,7 +91,9 @@ void cPiston::ExtendPiston(int pistx, int pisty, int pistz)
cBlockHandler * Handler = BlockHandler(currBlock);
if (Handler->DoesDropOnUnsuitable())
{
- Handler->DropBlock(m_World, NULL, pistx, pisty, pistz);
+ cChunkInterface ChunkInterface(m_World->GetChunkMap());
+ cBlockInServerPluginInterface PluginInterface(*m_World);
+ Handler->DropBlock(ChunkInterface, *m_World, PluginInterface, NULL, pistx, pisty, pistz);
}
}
diff --git a/src/Simulator/FloodyFluidSimulator.cpp b/src/Simulator/FloodyFluidSimulator.cpp
index fdc4643a8..95182345c 100644
--- a/src/Simulator/FloodyFluidSimulator.cpp
+++ b/src/Simulator/FloodyFluidSimulator.cpp
@@ -11,6 +11,7 @@
#include "../Chunk.h"
#include "../BlockArea.h"
#include "../Blocks/BlockHandler.h"
+#include "../BlockInServerPluginInterface.h"
@@ -273,8 +274,13 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i
cBlockHandler * Handler = BlockHandler(BlockType);
if (Handler->DoesDropOnUnsuitable())
{
+ cChunkInterface ChunkInterface(m_World.GetChunkMap());
+ cBlockInServerPluginInterface PluginInterface(m_World);
Handler->DropBlock(
- &m_World, NULL,
+ ChunkInterface,
+ m_World,
+ PluginInterface,
+ NULL,
a_NearChunk->GetPosX() * cChunkDef::Width + a_RelX,
a_RelY,
a_NearChunk->GetPosZ() * cChunkDef::Width + a_RelZ