summaryrefslogtreecommitdiffstats
path: root/source/blocks
diff options
context:
space:
mode:
Diffstat (limited to 'source/blocks')
-rw-r--r--source/blocks/Block.cpp8
-rw-r--r--source/blocks/Block.h11
-rw-r--r--source/blocks/BlockCactus.h8
-rw-r--r--source/blocks/BlockChest.h2
-rw-r--r--source/blocks/BlockCloth.cpp9
-rw-r--r--source/blocks/BlockCloth.h8
-rw-r--r--source/blocks/BlockCrops.h13
-rw-r--r--source/blocks/BlockDirt.cpp9
-rw-r--r--source/blocks/BlockDirt.h11
-rw-r--r--source/blocks/BlockDispenser.h2
-rw-r--r--source/blocks/BlockDoor.cpp2
-rw-r--r--source/blocks/BlockDoor.h16
-rw-r--r--source/blocks/BlockEntity.cpp15
-rw-r--r--source/blocks/BlockEntity.h12
-rw-r--r--source/blocks/BlockFire.cpp24
-rw-r--r--source/blocks/BlockFire.h23
-rw-r--r--source/blocks/BlockFlower.h8
-rw-r--r--source/blocks/BlockFluid.h2
-rw-r--r--source/blocks/BlockFurnace.h4
-rw-r--r--source/blocks/BlockGlowstone.h4
-rw-r--r--source/blocks/BlockIce.h4
-rw-r--r--source/blocks/BlockLadder.h2
-rw-r--r--source/blocks/BlockLeaves.h10
-rw-r--r--source/blocks/BlockMelon.h4
-rw-r--r--source/blocks/BlockMushroom.h8
-rw-r--r--source/blocks/BlockOre.h2
-rw-r--r--source/blocks/BlockPiston.cpp2
-rw-r--r--source/blocks/BlockPiston.h6
-rw-r--r--source/blocks/BlockRedstone.cpp2
-rw-r--r--source/blocks/BlockRedstone.h14
-rw-r--r--source/blocks/BlockRedstoneRepeater.cpp2
-rw-r--r--source/blocks/BlockRedstoneRepeater.h20
-rw-r--r--source/blocks/BlockRedstoneTorch.h4
-rw-r--r--source/blocks/BlockSapling.h10
-rw-r--r--source/blocks/BlockSign.h6
-rw-r--r--source/blocks/BlockSlab.cpp17
-rw-r--r--source/blocks/BlockSlab.h17
-rw-r--r--source/blocks/BlockSnow.h10
-rw-r--r--source/blocks/BlockStairs.cpp18
-rw-r--r--source/blocks/BlockStairs.h14
-rw-r--r--source/blocks/BlockStems.h10
-rw-r--r--source/blocks/BlockStone.h2
-rw-r--r--source/blocks/BlockSugarcane.h10
-rw-r--r--source/blocks/BlockTallGrass.h8
-rw-r--r--source/blocks/BlockTorch.cpp15
-rw-r--r--source/blocks/BlockTorch.h13
-rw-r--r--source/blocks/BlockVine.cpp17
-rw-r--r--source/blocks/BlockVine.h19
-rw-r--r--source/blocks/BlockWood.h2
-rw-r--r--source/blocks/BlockWorkbench.cpp24
-rw-r--r--source/blocks/BlockWorkbench.h19
51 files changed, 212 insertions, 290 deletions
diff --git a/source/blocks/Block.cpp b/source/blocks/Block.cpp
index 1fd7a1af8..215a6c618 100644
--- a/source/blocks/Block.cpp
+++ b/source/blocks/Block.cpp
@@ -42,7 +42,7 @@
bool cBlockHandler::m_HandlerInitialized = false;
cBlockHandler *cBlockHandler::m_BlockHandler[256];
-cBlockHandler *cBlockHandler::GetBlockHandler(char a_BlockID)
+cBlockHandler *cBlockHandler::GetBlockHandler(BLOCKTYPE a_BlockID)
{
if(!m_HandlerInitialized)
{ //We have to initialize
@@ -227,7 +227,7 @@ void cBlockHandler::OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y
}
-void cBlockHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
+void cBlockHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
{
a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, a_BlockMeta);
OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
@@ -249,7 +249,7 @@ int cBlockHandler::GetDropID()
return m_BlockID;
}
-char cBlockHandler::GetDropMeta(char a_BlockMeta)
+NIBBLETYPE cBlockHandler::GetDropMeta(NIBBLETYPE a_BlockMeta)
{
return a_BlockMeta; //This keeps most textures. The few other blocks have to override this
}
@@ -257,7 +257,7 @@ char cBlockHandler::GetDropMeta(char a_BlockMeta)
void cBlockHandler::DropBlock(cWorld *a_World, int a_X, int a_Y, int a_Z)
{
cItems Drops;
- char Meta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
+ NIBBLETYPE Meta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
char DropCount = GetDropCount();
int DropItem = GetDropID();
if(DropCount > 0 && DropItem != E_ITEM_EMPTY)
diff --git a/source/blocks/Block.h b/source/blocks/Block.h
index f55ee7dd2..e35856459 100644
--- a/source/blocks/Block.h
+++ b/source/blocks/Block.h
@@ -19,18 +19,17 @@ public:
virtual void OnNeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z);
static void NeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z);
virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z);
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir);
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir);
virtual int GetTickRate();
virtual char GetDropCount();
virtual int GetDropID();
- virtual char GetDropMeta(char a_BlockMeta);
+ virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta);
virtual bool NeedsRandomTicks();
- //Item is -2 if it wasn´t a player
virtual void DropBlock(cWorld *a_World, int a_X, int a_Y, int a_Z);
//Checks if the block can stay at
virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z);
- //Checks if the block can be placed at Default:CanBeAt(...) NOTE: In the block is not placed
+ //Checks if the block can be placed at this point. Default: CanBeAt(...) NOTE: In the block is not placed in this callback
virtual bool CanBePlacedAt(cWorld *a_World, int a_X, int a_Y, int a_Z, char a_Dir);
//This gets called if the player tries to place a block ontop of this block (Only if he aims directly on this block)
virtual bool AllowBlockOnTop();
@@ -42,7 +41,7 @@ public:
//Does this block drops if it gets destroyed by an unsuitable situation? Default: true
virtual bool DropOnUnsuitable();
- static cBlockHandler *GetBlockHandler(char a_BlockID);
+ static cBlockHandler *GetBlockHandler(BLOCKTYPE a_BlockID);
static void Deinit();
@@ -54,4 +53,4 @@ protected:
};
-inline cBlockHandler *BlockHandler(char a_BlockID) { return cBlockHandler::GetBlockHandler(a_BlockID); } \ No newline at end of file
+inline cBlockHandler *BlockHandler(BLOCKTYPE a_BlockID) { return cBlockHandler::GetBlockHandler(a_BlockID); } \ No newline at end of file
diff --git a/source/blocks/BlockCactus.h b/source/blocks/BlockCactus.h
index 4977d4a98..5eb351d9c 100644
--- a/source/blocks/BlockCactus.h
+++ b/source/blocks/BlockCactus.h
@@ -10,12 +10,12 @@ public:
{
}
- virtual char GetDropMeta(char a_BlockMeta)
+ virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta) override
{
return 0;
}
- virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
BLOCKTYPE Surface = a_World->GetBlock(a_X, a_Y - 1, a_Z);
if ((Surface != E_BLOCK_SAND) && (Surface != E_BLOCK_CACTUS))
@@ -38,13 +38,13 @@ public:
return true;
}
- virtual bool AllowBlockOnTop()
+ virtual bool AllowBlockOnTop() override
{
return false;
}
- virtual bool CanBePlacedOnSide()
+ virtual bool CanBePlacedOnSide() override
{
return false;
}
diff --git a/source/blocks/BlockChest.h b/source/blocks/BlockChest.h
index 557b2d640..fd444a9d2 100644
--- a/source/blocks/BlockChest.h
+++ b/source/blocks/BlockChest.h
@@ -12,7 +12,7 @@ public:
{
}
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
{
a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cPiston::RotationPitchToMetaData(a_Player->GetRotation(), 0));
OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
diff --git a/source/blocks/BlockCloth.cpp b/source/blocks/BlockCloth.cpp
deleted file mode 100644
index a55b8dc7f..000000000
--- a/source/blocks/BlockCloth.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "Globals.h"
-#include "BlockCloth.h"
-#include "../cItem.h"
-#include "../cPlayer.h"
-
-cBlockClothHandler::cBlockClothHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
-{
-} \ No newline at end of file
diff --git a/source/blocks/BlockCloth.h b/source/blocks/BlockCloth.h
index dca7184cb..f2ce78fb5 100644
--- a/source/blocks/BlockCloth.h
+++ b/source/blocks/BlockCloth.h
@@ -5,8 +5,12 @@
class cBlockClothHandler : public cBlockHandler
{
public:
- cBlockClothHandler(BLOCKTYPE a_BlockID);
- char GetDropMeta(char a_BlockMeta)
+ cBlockClothHandler(BLOCKTYPE a_BlockID)
+ : cBlockHandler(a_BlockID)
+ {
+ }
+
+ virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta) override
{
return a_BlockMeta;
}
diff --git a/source/blocks/BlockCrops.h b/source/blocks/BlockCrops.h
index 34af1a43c..fb4934540 100644
--- a/source/blocks/BlockCrops.h
+++ b/source/blocks/BlockCrops.h
@@ -16,12 +16,17 @@ public:
return true;
}
- virtual int GetDropID()
+ virtual bool AllowBlockOnTop() override
+ {
+ return false;
+ }
+
+ virtual int GetDropID() override
{
return E_ITEM_EMPTY;
}
- virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
MTRand rand;
NIBBLETYPE Meta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
@@ -42,13 +47,13 @@ public:
a_World->SpawnItemPickups(Drops, a_X, a_Y, a_Z);
}
- void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
//TODO: Handle Growing here
}
- virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
return a_World->GetBlock(a_X, a_Y - 1, a_Z) == E_BLOCK_FARMLAND;
}
diff --git a/source/blocks/BlockDirt.cpp b/source/blocks/BlockDirt.cpp
deleted file mode 100644
index ea8c6509d..000000000
--- a/source/blocks/BlockDirt.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "Globals.h"
-#include "BlockDirt.h"
-#include "../cItem.h"
-#include "../cWorld.h"
-
-cBlockDirtHandler::cBlockDirtHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
-{
-}
diff --git a/source/blocks/BlockDirt.h b/source/blocks/BlockDirt.h
index 49450b16d..2edfa5608 100644
--- a/source/blocks/BlockDirt.h
+++ b/source/blocks/BlockDirt.h
@@ -6,21 +6,24 @@
class cBlockDirtHandler : public cBlockHandler
{
public:
- cBlockDirtHandler(BLOCKTYPE a_BlockID);
+ cBlockDirtHandler(BLOCKTYPE a_BlockID)
+ : cBlockHandler(a_BlockID)
+ {
+ }
- virtual bool NeedsRandomTicks()
+ virtual bool NeedsRandomTicks() override
{
return m_BlockID == E_BLOCK_GRASS;
}
- virtual int GetDropID()
+ virtual int GetDropID() override
{
return E_BLOCK_DIRT;
}
- void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
if(m_BlockID == E_BLOCK_GRASS)
{
diff --git a/source/blocks/BlockDispenser.h b/source/blocks/BlockDispenser.h
index 4ccfe0dfc..f3ad20d5c 100644
--- a/source/blocks/BlockDispenser.h
+++ b/source/blocks/BlockDispenser.h
@@ -12,7 +12,7 @@ public:
{
}
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
{
a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cPiston::RotationPitchToMetaData(a_Player->GetRotation(), 0));
OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
diff --git a/source/blocks/BlockDoor.cpp b/source/blocks/BlockDoor.cpp
index e854281a5..3fc804704 100644
--- a/source/blocks/BlockDoor.cpp
+++ b/source/blocks/BlockDoor.cpp
@@ -48,7 +48,7 @@ char cBlockDoorHandler::GetDropCount()
return 1;
}
-void cBlockDoorHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
+void cBlockDoorHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
{
if (a_World->GetBlock(a_X, a_Y + 1, a_Z) == E_BLOCK_AIR)
{
diff --git a/source/blocks/BlockDoor.h b/source/blocks/BlockDoor.h
index 180d3b48f..ccf7dd4a7 100644
--- a/source/blocks/BlockDoor.h
+++ b/source/blocks/BlockDoor.h
@@ -6,23 +6,23 @@ class cBlockDoorHandler : public cBlockHandler
{
public:
cBlockDoorHandler(BLOCKTYPE a_BlockID);
- virtual void OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir);
- virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z);
- virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z);
- virtual char GetDropCount();
- virtual bool IsUseable()
+ virtual void OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir) override;
+ virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z) override;
+ virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override;
+ virtual char GetDropCount() override;
+ virtual bool IsUseable() override
{
return true;
}
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir);
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override;
- virtual int GetDropID()
+ virtual int GetDropID() override
{
return (m_BlockID == E_BLOCK_WOODEN_DOOR) ? E_ITEM_WOODEN_DOOR : E_ITEM_IRON_DOOR;
}
- virtual bool CanBePlacedOnSide()
+ virtual bool CanBePlacedOnSide() override
{
return false;
}
diff --git a/source/blocks/BlockEntity.cpp b/source/blocks/BlockEntity.cpp
deleted file mode 100644
index b34b01ee9..000000000
--- a/source/blocks/BlockEntity.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "Globals.h"
-#include "BlockEntity.h"
-#include "../cItem.h"
-#include "../cPlayer.h"
-#include "../cWorld.h"
-
-cBlockEntityHandler::cBlockEntityHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
-{
-}
-
-void cBlockEntityHandler::OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z)
-{
- a_World->UseBlockEntity(a_Player, a_X, a_Y, a_Z);
-}
diff --git a/source/blocks/BlockEntity.h b/source/blocks/BlockEntity.h
index abdaa7615..c7b8b0859 100644
--- a/source/blocks/BlockEntity.h
+++ b/source/blocks/BlockEntity.h
@@ -5,9 +5,15 @@
class cBlockEntityHandler : public cBlockHandler
{
public:
- cBlockEntityHandler(BLOCKTYPE a_BlockID);
- virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z);
- virtual bool IsUseable()
+ cBlockEntityHandler(BLOCKTYPE a_BlockID)
+ : cBlockHandler(a_BlockID)
+ {
+ }
+ virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override
+ {
+ a_World->UseBlockEntity(a_Player, a_X, a_Y, a_Z);
+ }
+ virtual bool IsUseable() override
{
return true;
}
diff --git a/source/blocks/BlockFire.cpp b/source/blocks/BlockFire.cpp
deleted file mode 100644
index 5ca8dd902..000000000
--- a/source/blocks/BlockFire.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "Globals.h"
-#include "BlockFire.h"
-#include "../cItem.h"
-#include "../cWorld.h"
-
-cBlockFireHandler::cBlockFireHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
-{
-}
-
-void cBlockFireHandler::OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z)
-{
- a_World->DigBlock(a_X, a_Y, a_Z);
-}
-
-char cBlockFireHandler::GetDropCount()
-{
- return -1;
-}
-
-bool cBlockFireHandler::IsClickedThrough()
-{
- return true;
-} \ No newline at end of file
diff --git a/source/blocks/BlockFire.h b/source/blocks/BlockFire.h
index 0a5396096..f1563c637 100644
--- a/source/blocks/BlockFire.h
+++ b/source/blocks/BlockFire.h
@@ -5,10 +5,25 @@
class cBlockFireHandler : public cBlockHandler
{
public:
- cBlockFireHandler(BLOCKTYPE a_BlockID);
- virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z);
- virtual bool IsClickedThrough();
- virtual char GetDropCount();
+ cBlockFireHandler(BLOCKTYPE a_BlockID)
+ : cBlockHandler(a_BlockID)
+ {
+ }
+
+ virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override
+ {
+ a_World->DigBlock(a_X, a_Y, a_Z);
+ }
+
+ virtual char GetDropCount() override
+ {
+ return -1;
+ }
+
+ virtual bool IsClickedThrough() override
+ {
+ return true;
+ }
}; \ No newline at end of file
diff --git a/source/blocks/BlockFlower.h b/source/blocks/BlockFlower.h
index 12eaa4dc8..b94e6cb6d 100644
--- a/source/blocks/BlockFlower.h
+++ b/source/blocks/BlockFlower.h
@@ -10,22 +10,22 @@ public:
{
}
- virtual char GetDropMeta(char a_BlockMeta)
+ virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta) override
{
return 0;
}
- virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
return IsBlockTypeOfDirt(a_World->GetBlock(a_X, a_Y - 1, a_Z));
}
- virtual bool AllowBlockOnTop()
+ virtual bool AllowBlockOnTop() override
{
return false;
}
- virtual bool CanBePlacedOnSide()
+ virtual bool CanBePlacedOnSide() override
{
return false;
}
diff --git a/source/blocks/BlockFluid.h b/source/blocks/BlockFluid.h
index 4da785523..6883ce715 100644
--- a/source/blocks/BlockFluid.h
+++ b/source/blocks/BlockFluid.h
@@ -11,7 +11,7 @@ public:
}
- virtual bool IgnoreBuildCollision()
+ virtual bool IgnoreBuildCollision() override
{
return true;
}
diff --git a/source/blocks/BlockFurnace.h b/source/blocks/BlockFurnace.h
index 927c925bd..d0455e805 100644
--- a/source/blocks/BlockFurnace.h
+++ b/source/blocks/BlockFurnace.h
@@ -12,12 +12,12 @@ public:
{
}
- virtual int GetDropID()
+ virtual int GetDropID() override
{
return E_ITEM_FURNACE;
}
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
{
a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cPiston::RotationPitchToMetaData(a_Player->GetRotation(), 0));
OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
diff --git a/source/blocks/BlockGlowstone.h b/source/blocks/BlockGlowstone.h
index 8d05cd799..ecd34a1d9 100644
--- a/source/blocks/BlockGlowstone.h
+++ b/source/blocks/BlockGlowstone.h
@@ -10,12 +10,12 @@ public:
{
}
- virtual char GetDropMeta(char a_BlockMeta)
+ virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta) override
{
return 0;
}
- virtual int GetDropID()
+ virtual int GetDropID() override
{
return E_ITEM_GLOWSTONE_DUST;
}
diff --git a/source/blocks/BlockIce.h b/source/blocks/BlockIce.h
index 9b356e323..d6bb63b0a 100644
--- a/source/blocks/BlockIce.h
+++ b/source/blocks/BlockIce.h
@@ -11,12 +11,12 @@ public:
{
}
- virtual int GetDropID()
+ virtual int GetDropID() override
{
return E_ITEM_EMPTY;
}
- virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
a_World->FastSetBlock(a_X, a_Y, a_Z, E_BLOCK_STATIONARY_WATER, 8);
//This is called later than the real destroying of this ice block
diff --git a/source/blocks/BlockLadder.h b/source/blocks/BlockLadder.h
index b32f8081d..4c7f37b1f 100644
--- a/source/blocks/BlockLadder.h
+++ b/source/blocks/BlockLadder.h
@@ -12,7 +12,7 @@ public:
}
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
{
a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cLadder::DirectionToMetaData(a_Dir));
OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
diff --git a/source/blocks/BlockLeaves.h b/source/blocks/BlockLeaves.h
index 4bae2003f..57cfad5da 100644
--- a/source/blocks/BlockLeaves.h
+++ b/source/blocks/BlockLeaves.h
@@ -28,7 +28,7 @@ public:
{
}
- virtual int GetDropID()
+ virtual int GetDropID() override
{
MTRand rand;
@@ -40,7 +40,7 @@ public:
return E_ITEM_EMPTY;
}
- void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
cBlockHandler::OnDestroyed(a_World, a_X, a_Y, a_Z);
@@ -56,18 +56,18 @@ public:
}
}
- virtual void OnNeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ virtual void OnNeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
NIBBLETYPE Meta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
a_World->SetBlockMeta(a_X, a_Y, a_Z, Meta & 0x7); //Unset 0x8 bit so it gets checked for decay
}
- virtual bool NeedsRandomTicks()
+ virtual bool NeedsRandomTicks() override
{
return true;
}
- virtual void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ virtual void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
NIBBLETYPE Meta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
if ((Meta & 0x04) != 0)
diff --git a/source/blocks/BlockMelon.h b/source/blocks/BlockMelon.h
index d64461780..0f1797a0b 100644
--- a/source/blocks/BlockMelon.h
+++ b/source/blocks/BlockMelon.h
@@ -11,12 +11,12 @@ public:
}
- virtual int GetDropID()
+ virtual int GetDropID() override
{
return E_ITEM_MELON_SLICE;
}
- virtual char GetDropCount()
+ virtual char GetDropCount() override
{
MTRand r1;
return (char)(3 + r1.randInt(4));
diff --git a/source/blocks/BlockMushroom.h b/source/blocks/BlockMushroom.h
index 5b2da6498..5ec429c5f 100644
--- a/source/blocks/BlockMushroom.h
+++ b/source/blocks/BlockMushroom.h
@@ -10,12 +10,12 @@ public:
{
}
- virtual char GetDropMeta(char a_BlockMeta)
+ virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta) override
{
return 0;
}
- virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
switch (a_World->GetBlock(a_X, a_Y - 1, a_Z))
{
@@ -29,13 +29,13 @@ public:
return true;
}
- virtual bool AllowBlockOnTop()
+ virtual bool AllowBlockOnTop() override
{
return false;
}
- virtual bool CanBePlacedOnSide()
+ virtual bool CanBePlacedOnSide() override
{
return false;
}
diff --git a/source/blocks/BlockOre.h b/source/blocks/BlockOre.h
index d1714f1af..4788c9b89 100644
--- a/source/blocks/BlockOre.h
+++ b/source/blocks/BlockOre.h
@@ -26,7 +26,7 @@ public:
}
}
- virtual char GetDropMeta(char a_Meta) override
+ virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_Meta) override
{
switch(m_BlockID)
{
diff --git a/source/blocks/BlockPiston.cpp b/source/blocks/BlockPiston.cpp
index 98463fd97..c2fcdd1f2 100644
--- a/source/blocks/BlockPiston.cpp
+++ b/source/blocks/BlockPiston.cpp
@@ -40,7 +40,7 @@ void cBlockPistonHandler::OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z
}
}
-void cBlockPistonHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
+void cBlockPistonHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
{
a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cPiston::RotationPitchToMetaData(a_Player->GetRotation(), a_Player->GetPitch()));
diff --git a/source/blocks/BlockPiston.h b/source/blocks/BlockPiston.h
index 69d3a204f..1493ff27e 100644
--- a/source/blocks/BlockPiston.h
+++ b/source/blocks/BlockPiston.h
@@ -6,10 +6,10 @@ class cBlockPistonHandler : public cBlockHandler
{
public:
cBlockPistonHandler(BLOCKTYPE a_BlockID);
- virtual void OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir);
- virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z);
+ virtual void OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir) override;
+ virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z) override;
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir);
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override;
}; \ No newline at end of file
diff --git a/source/blocks/BlockRedstone.cpp b/source/blocks/BlockRedstone.cpp
index 1171d124a..58edaa1cd 100644
--- a/source/blocks/BlockRedstone.cpp
+++ b/source/blocks/BlockRedstone.cpp
@@ -26,7 +26,7 @@ void cBlockRedstoneHandler::OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a
Redstone.ChangeRedstone(a_X, a_Y, a_Z, false);
}
-void cBlockRedstoneHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
+void cBlockRedstoneHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
{
switch(m_BlockID)
{
diff --git a/source/blocks/BlockRedstone.h b/source/blocks/BlockRedstone.h
index 21c19d4c5..dd2c75fc4 100644
--- a/source/blocks/BlockRedstone.h
+++ b/source/blocks/BlockRedstone.h
@@ -6,27 +6,27 @@ class cBlockRedstoneHandler : public cBlockHandler
{
public:
cBlockRedstoneHandler(BLOCKTYPE a_BlockID);
- virtual void OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir);
- virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z);
+ virtual void OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir) override;
+ virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z) override;
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir);
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override;
- virtual bool AllowBlockOnTop()
+ virtual bool AllowBlockOnTop() override
{
return false;
}
- virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
return a_World->GetBlock(a_X, a_Y - 1, a_Z) != E_BLOCK_AIR;
}
- virtual int GetDropID()
+ virtual int GetDropID() override
{
return E_ITEM_REDSTONE_DUST;
}
- virtual bool CanBePlacedOnSide()
+ virtual bool CanBePlacedOnSide() override
{
return false;
}
diff --git a/source/blocks/BlockRedstoneRepeater.cpp b/source/blocks/BlockRedstoneRepeater.cpp
index 639764aa5..79214069a 100644
--- a/source/blocks/BlockRedstoneRepeater.cpp
+++ b/source/blocks/BlockRedstoneRepeater.cpp
@@ -27,7 +27,7 @@ void cBlockRedstoneRepeaterHandler::OnClick(cWorld *a_World, cPlayer *a_Player,
a_World->FastSetBlock(a_X, a_Y, a_Z, m_BlockID, ((a_World->GetBlockMeta(a_X, a_Y, a_Z) + 0x04) & 0x0f));
}
-void cBlockRedstoneRepeaterHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
+void cBlockRedstoneRepeaterHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
{
a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cRedstone::RepeaterRotationToMetaData(a_Player->GetRotation()));
OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
diff --git a/source/blocks/BlockRedstoneRepeater.h b/source/blocks/BlockRedstoneRepeater.h
index e8618cdeb..4b6b60485 100644
--- a/source/blocks/BlockRedstoneRepeater.h
+++ b/source/blocks/BlockRedstoneRepeater.h
@@ -6,40 +6,40 @@ class cBlockRedstoneRepeaterHandler : public cBlockHandler
{
public:
cBlockRedstoneRepeaterHandler(BLOCKTYPE a_BlockID);
- virtual void OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir);
- virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z);
+ virtual void OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir) override;
+ virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z) override;
- virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z);
+ virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override;
- virtual char GetDropMeta(char a_BlockMeta)
+ virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta) override
{
return 0;
}
- virtual int GetDropID()
+ virtual int GetDropID() override
{
return E_ITEM_REDSTONE_REPEATER;
}
- virtual bool IsUseable()
+ virtual bool IsUseable() override
{
return true;
}
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir);
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override;
- virtual bool AllowBlockOnTop()
+ virtual bool AllowBlockOnTop() override
{
return false;
}
- virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
return a_World->GetBlock(a_X, a_Y - 1, a_Z) != E_BLOCK_AIR;
}
- virtual bool CanBePlacedOnSide()
+ virtual bool CanBePlacedOnSide() override
{
return false;
}
diff --git a/source/blocks/BlockRedstoneTorch.h b/source/blocks/BlockRedstoneTorch.h
index 927cf3d7c..0b8be74e1 100644
--- a/source/blocks/BlockRedstoneTorch.h
+++ b/source/blocks/BlockRedstoneTorch.h
@@ -24,12 +24,12 @@ public:
return CanBePlacedAt(a_World, a_X, a_Y, a_Z, Dir);
}
- virtual int GetDropID()
+ virtual int GetDropID() override
{
return E_ITEM_REDSTONE_TORCH_ON;
}
- virtual bool CanBePlacedOnSide()
+ virtual bool CanBePlacedOnSide() override
{
return true;
}
diff --git a/source/blocks/BlockSapling.h b/source/blocks/BlockSapling.h
index d0498afea..6bef614cf 100644
--- a/source/blocks/BlockSapling.h
+++ b/source/blocks/BlockSapling.h
@@ -15,22 +15,22 @@ public:
return true;
}
- virtual char GetDropMeta(char a_BlockMeta)
+ virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta) override
{
return a_BlockMeta & 3; //Only the first 2 bits contain the display information the others are for growing
}
- virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
return IsBlockTypeOfDirt(a_World->GetBlock(a_X, a_Y - 1, a_Z));
}
- virtual bool AllowBlockOnTop()
+ virtual bool AllowBlockOnTop() override
{
return false;
}
- void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
NIBBLETYPE Meta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
@@ -44,7 +44,7 @@ public:
}
}
- virtual bool CanBePlacedOnSide()
+ virtual bool CanBePlacedOnSide() override
{
return false;
}
diff --git a/source/blocks/BlockSign.h b/source/blocks/BlockSign.h
index 3b2e208e1..2a7ac2753 100644
--- a/source/blocks/BlockSign.h
+++ b/source/blocks/BlockSign.h
@@ -13,7 +13,7 @@ public:
}
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
{
BLOCKTYPE Block;
NIBBLETYPE Meta;
@@ -30,12 +30,12 @@ public:
OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
}
- virtual int GetDropID()
+ virtual int GetDropID() override
{
return E_ITEM_SIGN;
}
- virtual bool AllowBlockOnTop()
+ virtual bool AllowBlockOnTop() override
{
return false;
}
diff --git a/source/blocks/BlockSlab.cpp b/source/blocks/BlockSlab.cpp
deleted file mode 100644
index 659dc7986..000000000
--- a/source/blocks/BlockSlab.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "Globals.h"
-#include "BlockSlab.h"
-#include "../cItem.h"
-#include "../cPlayer.h"
-#include "../cWorld.h"
-
-cBlockSlabHandler::cBlockSlabHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
-{
-}
-
-
-void cBlockSlabHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
-{
- a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, DirectionToMetaData( a_Dir, a_BlockMeta ));
- OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
-} \ No newline at end of file
diff --git a/source/blocks/BlockSlab.h b/source/blocks/BlockSlab.h
index 05df819b2..f6443ff91 100644
--- a/source/blocks/BlockSlab.h
+++ b/source/blocks/BlockSlab.h
@@ -5,13 +5,17 @@
class cBlockSlabHandler : public cBlockHandler
{
public:
- cBlockSlabHandler(BLOCKTYPE a_BlockID);
- virtual char GetDropMeta(char a_BlockMeta)
+ cBlockSlabHandler(BLOCKTYPE a_BlockID)
+ : cBlockHandler(a_BlockID)
+ {
+ }
+
+ virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta) override
{
return a_BlockMeta;
}
- virtual char GetDropCount()
+ virtual char GetDropCount() override
{
if(m_BlockID == E_BLOCK_DOUBLE_STONE_SLAB
|| m_BlockID == E_BLOCK_DOUBLE_WOODEN_SLAB)
@@ -19,7 +23,12 @@ public:
return 1;
}
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir);
+
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
+ {
+ a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, DirectionToMetaData( a_Dir, a_BlockMeta ));
+ OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
+ }
static char DirectionToMetaData( char a_Direction, NIBBLETYPE Meta )
{
diff --git a/source/blocks/BlockSnow.h b/source/blocks/BlockSnow.h
index 75143b73e..ac0c0ac69 100644
--- a/source/blocks/BlockSnow.h
+++ b/source/blocks/BlockSnow.h
@@ -10,28 +10,28 @@ public:
{
}
- virtual bool IgnoreBuildCollision()
+ virtual bool IgnoreBuildCollision() override
{
return true;
}
- virtual int GetDropID()
+ virtual int GetDropID() override
{
return E_ITEM_SNOWBALL;
}
- virtual char GetDropCount()
+ virtual char GetDropCount() override
{
return 4;
}
- virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
return a_World->GetBlock(a_X, a_Y - 1, a_Z) != E_BLOCK_AIR;
}
- virtual bool DropOnUnsuitable()
+ virtual bool DropOnUnsuitable() override
{
return false;
}
diff --git a/source/blocks/BlockStairs.cpp b/source/blocks/BlockStairs.cpp
deleted file mode 100644
index cd4ad9907..000000000
--- a/source/blocks/BlockStairs.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "Globals.h"
-#include "BlockStairs.h"
-#include "../cItem.h"
-#include "../cVine.h"
-#include "../cPlayer.h"
-#include "../cWorld.h"
-#include "../cStairs.h"
-
-cBlockStairsHandler::cBlockStairsHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
-{
-}
-
-void cBlockStairsHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
-{
- a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cStairs::RotationToMetaData(a_Player->GetRotation(), a_Dir));
- OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
-} \ No newline at end of file
diff --git a/source/blocks/BlockStairs.h b/source/blocks/BlockStairs.h
index d7de17c1f..b6898f8e1 100644
--- a/source/blocks/BlockStairs.h
+++ b/source/blocks/BlockStairs.h
@@ -1,14 +1,22 @@
#pragma once
#include "Block.h"
-
+#include "../cStairs.h"
class cBlockStairsHandler : public cBlockHandler
{
public:
- cBlockStairsHandler(BLOCKTYPE a_BlockID);
+ cBlockStairsHandler(BLOCKTYPE a_BlockID)
+ : cBlockHandler(a_BlockID)
+ {
+
+ }
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir);
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
+ {
+ a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cStairs::RotationToMetaData(a_Player->GetRotation(), a_Dir));
+ OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
+ }
}; \ No newline at end of file
diff --git a/source/blocks/BlockStems.h b/source/blocks/BlockStems.h
index 8f1d4ddca..a58a2bdf4 100644
--- a/source/blocks/BlockStems.h
+++ b/source/blocks/BlockStems.h
@@ -11,29 +11,29 @@ public:
{
}
- virtual bool NeedsRandomTicks()
+ virtual bool NeedsRandomTicks() override
{
return true;
}
- virtual char GetDropMeta(char a_BlockMeta)
+ virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta) override
{
return 0;
}
- virtual int GetDropID()
+ virtual int GetDropID() override
{
if(m_BlockID == E_BLOCK_MELON_STEM)
return E_ITEM_MELON_SEEDS;
return E_ITEM_PUMPKIN_SEEDS;
}
- void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
//TODO: Handle Growing here
}
- virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
return a_World->GetBlock(a_X, a_Y - 1, a_Z) == E_BLOCK_FARMLAND;
}
diff --git a/source/blocks/BlockStone.h b/source/blocks/BlockStone.h
index d15e4730a..bd644a3a4 100644
--- a/source/blocks/BlockStone.h
+++ b/source/blocks/BlockStone.h
@@ -11,7 +11,7 @@ public:
{
}
- virtual int GetDropID()
+ virtual int GetDropID() override
{
return E_ITEM_COBBLESTONE;
}
diff --git a/source/blocks/BlockSugarcane.h b/source/blocks/BlockSugarcane.h
index 610052880..f402c4c28 100644
--- a/source/blocks/BlockSugarcane.h
+++ b/source/blocks/BlockSugarcane.h
@@ -11,17 +11,17 @@ public:
{
}
- virtual bool NeedsRandomTicks()
+ virtual bool NeedsRandomTicks() override
{
return true;
}
- virtual int GetDropID()
+ virtual int GetDropID() override
{
return E_ITEM_SUGARCANE;
}
- virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
BLOCKTYPE Block = a_World->GetBlock(a_X, a_Y-1, a_Z);
if(!IsBlockTypeOfDirt(Block) && Block != E_BLOCK_SAND && Block != E_BLOCK_SUGARCANE)
@@ -30,13 +30,13 @@ public:
return a_World->IsBlockDirectlyWatered(a_X, a_Y - 1, a_Z);
}
- void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
//TODO: Handle Growing here
}
- virtual bool CanBePlacedOnSide()
+ virtual bool CanBePlacedOnSide() override
{
return false;
}
diff --git a/source/blocks/BlockTallGrass.h b/source/blocks/BlockTallGrass.h
index a702bb8ca..ac66c1714 100644
--- a/source/blocks/BlockTallGrass.h
+++ b/source/blocks/BlockTallGrass.h
@@ -10,17 +10,17 @@ public:
{
}
- virtual bool IgnoreBuildCollision()
+ virtual bool IgnoreBuildCollision() override
{
return true;
}
- virtual int GetDropID()
+ virtual int GetDropID() override
{
return E_ITEM_SEEDS;
}
- virtual char GetDropCount()
+ virtual char GetDropCount() override
{
MTRand r1;
if(r1.randInt(10) == 5)
@@ -28,7 +28,7 @@ public:
return 0;
}
- virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z)
+ virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z) override
{
return a_World->GetBlock(a_X, a_Y - 1, a_Z) != E_BLOCK_AIR;
}
diff --git a/source/blocks/BlockTorch.cpp b/source/blocks/BlockTorch.cpp
deleted file mode 100644
index d9597a9ac..000000000
--- a/source/blocks/BlockTorch.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "Globals.h"
-#include "BlockTorch.h"
-#include "../cTorch.h"
-#include "../cWorld.h"
-
-cBlockTorchHandler::cBlockTorchHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
-{
-}
-
-void cBlockTorchHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
-{
- a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cTorch::DirectionToMetaData(a_Dir));
- OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
-} \ No newline at end of file
diff --git a/source/blocks/BlockTorch.h b/source/blocks/BlockTorch.h
index 9a2325994..562536c6e 100644
--- a/source/blocks/BlockTorch.h
+++ b/source/blocks/BlockTorch.h
@@ -7,11 +7,18 @@
class cBlockTorchHandler : public cBlockHandler
{
public:
- cBlockTorchHandler(BLOCKTYPE a_BlockID);
+ cBlockTorchHandler(BLOCKTYPE a_BlockID)
+ : cBlockHandler(a_BlockID)
+ {
+ }
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir);
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
+ {
+ a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cTorch::DirectionToMetaData(a_Dir));
+ OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
+ }
- virtual bool AllowBlockOnTop()
+ virtual bool AllowBlockOnTop() override
{
return false;
}
diff --git a/source/blocks/BlockVine.cpp b/source/blocks/BlockVine.cpp
deleted file mode 100644
index fda3c818c..000000000
--- a/source/blocks/BlockVine.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "Globals.h"
-#include "BlockVine.h"
-#include "../cItem.h"
-#include "../cVine.h"
-#include "../cPlayer.h"
-#include "../cWorld.h"
-
-cBlockVineHandler::cBlockVineHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
-{
-}
-
-void cBlockVineHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
-{
- a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cVine::DirectionToMetaData(a_Dir));
- OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
-} \ No newline at end of file
diff --git a/source/blocks/BlockVine.h b/source/blocks/BlockVine.h
index d601e622c..86f73b6b2 100644
--- a/source/blocks/BlockVine.h
+++ b/source/blocks/BlockVine.h
@@ -1,21 +1,28 @@
#pragma once
#include "Block.h"
-
+#include "../cVine.h"
class cBlockVineHandler : public cBlockHandler
{
public:
- cBlockVineHandler(BLOCKTYPE a_BlockID);
-
- virtual bool IgnoreBuildCollision()
+ cBlockVineHandler(BLOCKTYPE a_BlockID)
+ : cBlockHandler(a_BlockID)
+ {
+ }
+
+ virtual bool IgnoreBuildCollision() override
{
return true;
}
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, char a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir);
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
+ {
+ a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cVine::DirectionToMetaData(a_Dir));
+ OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
+ }
- virtual bool AllowBlockOnTop()
+ virtual bool AllowBlockOnTop() override
{
return false;
}
diff --git a/source/blocks/BlockWood.h b/source/blocks/BlockWood.h
index c93c44b4f..453ee48a1 100644
--- a/source/blocks/BlockWood.h
+++ b/source/blocks/BlockWood.h
@@ -9,7 +9,7 @@ public:
: cBlockHandler(a_BlockID)
{
}
- char GetDropMeta(char a_BlockMeta)
+ NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta) override
{
return a_BlockMeta;
}
diff --git a/source/blocks/BlockWorkbench.cpp b/source/blocks/BlockWorkbench.cpp
deleted file mode 100644
index 095a6e1da..000000000
--- a/source/blocks/BlockWorkbench.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "Globals.h"
-#include "BlockWorkbench.h"
-#include "../cItem.h"
-#include "../cPlayer.h"
-#include "../cCraftingWindow.h"
-
-cBlockWorkbenchHandler::cBlockWorkbenchHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
-{
-}
-
-void cBlockWorkbenchHandler::OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir)
-{
-}
-
-void cBlockWorkbenchHandler::OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z)
-{
-}
-
-void cBlockWorkbenchHandler::OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z)
-{
- cWindow* Window = new cCraftingWindow(0, true);
- a_Player->OpenWindow(Window);
-}
diff --git a/source/blocks/BlockWorkbench.h b/source/blocks/BlockWorkbench.h
index 2a0936c08..d654ca666 100644
--- a/source/blocks/BlockWorkbench.h
+++ b/source/blocks/BlockWorkbench.h
@@ -1,16 +1,23 @@
#pragma once
#include "Block.h"
-
+#include "../cCraftingWindow.h"
+#include "../cPlayer.h"
class cBlockWorkbenchHandler : public cBlockHandler
{
public:
- cBlockWorkbenchHandler(BLOCKTYPE a_BlockID);
- virtual void OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir);
- virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z);
+ cBlockWorkbenchHandler(BLOCKTYPE a_BlockID)
+ : cBlockHandler(a_BlockID)
+ {
+ }
- virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z);
- virtual bool IsUseable()
+ virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override
+ {
+ cWindow* Window = new cCraftingWindow(0, true);
+ a_Player->OpenWindow(Window);
+ }
+
+ virtual bool IsUseable() override
{
return true;
}