summaryrefslogtreecommitdiffstats
path: root/src/Blocks
diff options
context:
space:
mode:
Diffstat (limited to 'src/Blocks')
-rw-r--r--src/Blocks/BlockButton.h2
-rw-r--r--src/Blocks/BlockDoor.h2
-rw-r--r--src/Blocks/BlockHandler.cpp3
-rw-r--r--src/Blocks/BlockHandler.h4
-rw-r--r--src/Blocks/BlockPiston.cpp10
-rw-r--r--src/Blocks/BlockPiston.h2
-rw-r--r--src/Blocks/BlockRedstoneRepeater.h1
-rw-r--r--src/Blocks/BlockSign.h2
-rw-r--r--src/Blocks/BlockTorch.h2
-rw-r--r--src/Blocks/ChunkInterface.h5
-rw-r--r--src/Blocks/WorldInterface.h3
11 files changed, 23 insertions, 13 deletions
diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h
index 62fae6abc..f592b94a1 100644
--- a/src/Blocks/BlockButton.h
+++ b/src/Blocks/BlockButton.h
@@ -1,7 +1,7 @@
#pragma once
#include "BlockHandler.h"
-
+#include "Chunk.h"
diff --git a/src/Blocks/BlockDoor.h b/src/Blocks/BlockDoor.h
index 31d1bb797..2da561952 100644
--- a/src/Blocks/BlockDoor.h
+++ b/src/Blocks/BlockDoor.h
@@ -3,7 +3,7 @@
#include "BlockHandler.h"
#include "../Entities/Player.h"
-
+#include "Chunk.h"
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp
index 374c64fd8..d5ca9dcc1 100644
--- a/src/Blocks/BlockHandler.cpp
+++ b/src/Blocks/BlockHandler.cpp
@@ -5,6 +5,7 @@
#include "../World.h"
#include "../Root.h"
#include "../Bindings/PluginManager.h"
+#include "../Chunk.h"
#include "BlockBed.h"
#include "BlockBrewingStand.h"
#include "BlockButton.h"
@@ -276,7 +277,7 @@ void cBlockHandler::OnPlacedByPlayer(cChunkInterface & a_ChunkInterface, cWorldI
-void cBlockHandler::OnDestroyedByPlayer(cWorld *a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
+void cBlockHandler::OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
{
}
diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h
index 73a658b3f..a48a5a62b 100644
--- a/src/Blocks/BlockHandler.h
+++ b/src/Blocks/BlockHandler.h
@@ -3,7 +3,6 @@
#include "../Defines.h"
#include "../Item.h"
-#include "../Chunk.h"
#include "WorldInterface.h"
#include "ChunkInterface.h"
@@ -13,6 +12,7 @@
// fwd:
class cPlayer;
+class cChunk;
@@ -51,7 +51,7 @@ public:
);
/// Called before the player has destroyed a block
- virtual void OnDestroyedByPlayer(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ);
+ virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ);
/// Called before a block gets destroyed / replaced with air
virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ);
diff --git a/src/Blocks/BlockPiston.cpp b/src/Blocks/BlockPiston.cpp
index 43afda45a..e960d23e4 100644
--- a/src/Blocks/BlockPiston.cpp
+++ b/src/Blocks/BlockPiston.cpp
@@ -80,19 +80,19 @@ cBlockPistonHeadHandler::cBlockPistonHeadHandler(void) :
-void cBlockPistonHeadHandler::OnDestroyedByPlayer(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
+void cBlockPistonHeadHandler::OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
{
- NIBBLETYPE OldMeta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
+ NIBBLETYPE OldMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
int newX = a_BlockX;
int newY = a_BlockY;
int newZ = a_BlockZ;
AddPistonDir(newX, newY, newZ, OldMeta & ~(8), -1);
- BLOCKTYPE Block = a_World->GetBlock(newX, newY, newZ);
+ BLOCKTYPE Block = a_ChunkInterface.GetBlock(newX, newY, newZ);
if ((Block == E_BLOCK_STICKY_PISTON) || (Block == E_BLOCK_PISTON))
{
- a_World->DigBlock(newX, newY, newZ);
+ a_ChunkInterface.DigBlock(a_WorldInterface, newX, newY, newZ);
if (a_Player->IsGameModeCreative())
{
return; // No pickups if creative
@@ -100,7 +100,7 @@ void cBlockPistonHeadHandler::OnDestroyedByPlayer(cWorld * a_World, cPlayer * a_
cItems Pickups;
Pickups.push_back(cItem(Block, 1));
- a_World->SpawnItemPickups(Pickups, a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5);
+ a_WorldInterface.SpawnItemPickups(Pickups, a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5);
}
}
diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h
index e0ab182db..de40afdd6 100644
--- a/src/Blocks/BlockPiston.h
+++ b/src/Blocks/BlockPiston.h
@@ -35,7 +35,7 @@ class cBlockPistonHeadHandler :
public:
cBlockPistonHeadHandler(void);
- virtual void OnDestroyedByPlayer(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override;
+ virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override;
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
diff --git a/src/Blocks/BlockRedstoneRepeater.h b/src/Blocks/BlockRedstoneRepeater.h
index 1e82108c4..a48fed8b6 100644
--- a/src/Blocks/BlockRedstoneRepeater.h
+++ b/src/Blocks/BlockRedstoneRepeater.h
@@ -2,6 +2,7 @@
#pragma once
#include "BlockHandler.h"
+#include "Chunk.h"
diff --git a/src/Blocks/BlockSign.h b/src/Blocks/BlockSign.h
index 60895f69c..dced0008c 100644
--- a/src/Blocks/BlockSign.h
+++ b/src/Blocks/BlockSign.h
@@ -2,8 +2,8 @@
#pragma once
#include "BlockHandler.h"
-#include "../World.h"
#include "../Entities/Player.h"
+#include "Chunk.h"
diff --git a/src/Blocks/BlockTorch.h b/src/Blocks/BlockTorch.h
index 61f43ac76..33cafbddc 100644
--- a/src/Blocks/BlockTorch.h
+++ b/src/Blocks/BlockTorch.h
@@ -1,7 +1,7 @@
#pragma once
#include "BlockHandler.h"
-#include "../World.h"
+#include "../Chunk.h"
diff --git a/src/Blocks/ChunkInterface.h b/src/Blocks/ChunkInterface.h
index cca5bf913..b30eff1e4 100644
--- a/src/Blocks/ChunkInterface.h
+++ b/src/Blocks/ChunkInterface.h
@@ -3,6 +3,9 @@
#include "../ChunkMap.h"
#include "../ForEachChunkProvider.h"
+#include "WorldInterface.h"
+
+class cBlockHandler;
class cChunkInterface : public cForEachChunkProvider
{
@@ -69,6 +72,8 @@ public:
return m_ChunkMap->WriteBlockArea(a_Area, a_MinBlockX, a_MinBlockY, a_MinBlockZ, a_DataTypes);
}
+ bool DigBlock(cWorldInterface & a_WorldInterface, int a_X, int a_Y, int a_Z);
+
private:
cChunkMap * m_ChunkMap;
};
diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h
index f6b83942f..b6f2f55a7 100644
--- a/src/Blocks/WorldInterface.h
+++ b/src/Blocks/WorldInterface.h
@@ -2,6 +2,9 @@
#pragma once
#include "BroadcastInterface.h"
+#include "../Mobs/Monster.h"
+
+class cItems;
class cWorldInterface
{