Some code improvements
git-svn-id: http://mc-server.googlecode.com/svn/trunk@677 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
520dee1a90
commit
86a991c5a8
@ -1953,10 +1953,6 @@
|
||||
RelativePath="..\source\blocks\BlockChest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockCloth.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockCloth.h"
|
||||
>
|
||||
@ -1965,10 +1961,6 @@
|
||||
RelativePath="..\source\blocks\BlockCrops.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockDirt.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockDirt.h"
|
||||
>
|
||||
@ -1985,18 +1977,10 @@
|
||||
RelativePath="..\source\blocks\BlockDoor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockEntity.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockEntity.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockFire.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockFire.h"
|
||||
>
|
||||
@ -2077,10 +2061,6 @@
|
||||
RelativePath="..\source\blocks\BlockSign.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockSlab.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockSlab.h"
|
||||
>
|
||||
@ -2089,10 +2069,6 @@
|
||||
RelativePath="..\source\blocks\BlockSnow.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockStairs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockStairs.h"
|
||||
>
|
||||
@ -2113,18 +2089,10 @@
|
||||
RelativePath="..\source\blocks\BlockTallGrass.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockTorch.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockTorch.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockVine.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockVine.h"
|
||||
>
|
||||
@ -2133,10 +2101,6 @@
|
||||
RelativePath="..\source\blocks\BlockWood.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockWorkbench.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\blocks\BlockWorkbench.h"
|
||||
>
|
||||
|
@ -305,19 +305,10 @@
|
||||
<ClCompile Include="..\source\BioGen.cpp" />
|
||||
<ClCompile Include="..\source\BlockArea.cpp" />
|
||||
<ClCompile Include="..\source\BlockID.cpp" />
|
||||
<ClCompile Include="..\source\blocks\BlockCloth.cpp" />
|
||||
<ClCompile Include="..\source\blocks\BlockDirt.cpp" />
|
||||
<ClCompile Include="..\source\blocks\BlockDoor.cpp" />
|
||||
<ClCompile Include="..\source\blocks\BlockEntity.cpp" />
|
||||
<ClCompile Include="..\source\blocks\BlockFire.cpp" />
|
||||
<ClCompile Include="..\source\blocks\BlockPiston.cpp" />
|
||||
<ClCompile Include="..\source\blocks\BlockRedstone.cpp" />
|
||||
<ClCompile Include="..\source\blocks\BlockRedstoneRepeater.cpp" />
|
||||
<ClCompile Include="..\source\blocks\BlockSlab.cpp" />
|
||||
<ClCompile Include="..\source\blocks\BlockStairs.cpp" />
|
||||
<ClCompile Include="..\source\blocks\BlockTorch.cpp" />
|
||||
<ClCompile Include="..\source\blocks\BlockVine.cpp" />
|
||||
<ClCompile Include="..\source\blocks\BlockWorkbench.cpp" />
|
||||
<ClCompile Include="..\source\blocks\Block.cpp" />
|
||||
<ClCompile Include="..\source\cAggressiveMonster.cpp" />
|
||||
<ClCompile Include="..\Source\cAuthenticator.cpp" />
|
||||
|
@ -926,12 +926,6 @@
|
||||
<ClCompile Include="..\source\cSquirrelCommandBinder.cpp">
|
||||
<Filter>cPluginManager\cSquirrelCommandBinder</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\blocks\BlockEntity.cpp">
|
||||
<Filter>Blocks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\blocks\BlockFire.cpp">
|
||||
<Filter>Blocks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\blocks\BlockPiston.cpp">
|
||||
<Filter>Blocks</Filter>
|
||||
</ClCompile>
|
||||
@ -941,24 +935,6 @@
|
||||
<ClCompile Include="..\source\blocks\BlockRedstoneRepeater.cpp">
|
||||
<Filter>Blocks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\blocks\BlockSlab.cpp">
|
||||
<Filter>Blocks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\blocks\BlockTorch.cpp">
|
||||
<Filter>Blocks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\blocks\BlockVine.cpp">
|
||||
<Filter>Blocks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\blocks\BlockWorkbench.cpp">
|
||||
<Filter>Blocks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\blocks\BlockCloth.cpp">
|
||||
<Filter>Blocks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\blocks\BlockDirt.cpp">
|
||||
<Filter>Blocks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\blocks\BlockDoor.cpp">
|
||||
<Filter>Blocks</Filter>
|
||||
</ClCompile>
|
||||
@ -968,9 +944,6 @@
|
||||
<ClCompile Include="..\source\items\Item.cpp">
|
||||
<Filter>Items</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\blocks\BlockStairs.cpp">
|
||||
<Filter>Blocks</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\source\cServer.h">
|
||||
|
@ -56,7 +56,7 @@ static cBlockIDMap gsBlockIDMap;
|
||||
|
||||
|
||||
|
||||
int BlockStringToType(const AString & a_BlockTypeString)
|
||||
BLOCKTYPE BlockStringToType(const AString & a_BlockTypeString)
|
||||
{
|
||||
int res = atoi(a_BlockTypeString.c_str());
|
||||
if ((res != 0) || (a_BlockTypeString.compare("0") == 0))
|
||||
|
@ -617,7 +617,7 @@ class cItem;
|
||||
|
||||
|
||||
/// Translates a blocktype string into blocktype. Takes either a number or an items.ini alias as input. Returns -1 on failure.
|
||||
extern int BlockStringToType(const AString & a_BlockTypeString); // tolua_export
|
||||
extern BLOCKTYPE BlockStringToType(const AString & a_BlockTypeString); // tolua_export
|
||||
|
||||
/// Translates an itemtype string into an item. Takes either a number, number^number, number:number or an items.ini alias as input. Returns true if successful.
|
||||
extern bool StringToItem(const AString & a_ItemTypeString, cItem & a_Item); // tolua_export
|
||||
|
@ -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)
|
||||
|
@ -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); }
|
||||
inline cBlockHandler *BlockHandler(BLOCKTYPE a_BlockID) { return cBlockHandler::GetBlockHandler(a_BlockID); }
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -1,9 +0,0 @@
|
||||
#include "Globals.h"
|
||||
#include "BlockCloth.h"
|
||||
#include "../cItem.h"
|
||||
#include "../cPlayer.h"
|
||||
|
||||
cBlockClothHandler::cBlockClothHandler(BLOCKTYPE a_BlockID)
|
||||
: cBlockHandler(a_BlockID)
|
||||
{
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
#include "Globals.h"
|
||||
#include "BlockDirt.h"
|
||||
#include "../cItem.h"
|
||||
#include "../cWorld.h"
|
||||
|
||||
cBlockDirtHandler::cBlockDirtHandler(BLOCKTYPE a_BlockID)
|
||||
: cBlockHandler(a_BlockID)
|
||||
{
|
||||
}
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
};
|
@ -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;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
virtual bool IgnoreBuildCollision()
|
||||
virtual bool IgnoreBuildCollision() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual char GetDropMeta(char a_Meta) override
|
||||
virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
switch(m_BlockID)
|
||||
{
|
||||
|
@ -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()));
|
||||
|
@ -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;
|
||||
|
||||
};
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
@ -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 )
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
};
|
@ -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;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual int GetDropID()
|
||||
virtual int GetDropID() override
|
||||
{
|
||||
return E_ITEM_COBBLESTONE;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ public:
|
||||
: cBlockHandler(a_BlockID)
|
||||
{
|
||||
}
|
||||
char GetDropMeta(char a_BlockMeta)
|
||||
NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
return a_BlockMeta;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
@ -209,10 +209,16 @@ bool cItemHandler::CanHarvestBlock(BLOCKTYPE a_BlockID)
|
||||
|
||||
BLOCKTYPE cItemHandler::GetBlockType()
|
||||
{
|
||||
return m_ItemID;
|
||||
#ifdef _DEBUG
|
||||
if(m_ItemID > 256)
|
||||
{
|
||||
LOGERROR("Item %d has no valid block!", m_ItemID);
|
||||
}
|
||||
#endif
|
||||
return (BLOCKTYPE) m_ItemID;
|
||||
}
|
||||
|
||||
NIBBLETYPE cItemHandler::GetBlockMeta(char a_ItemMeta)
|
||||
NIBBLETYPE cItemHandler::GetBlockMeta(NIBBLETYPE a_ItemMeta)
|
||||
{
|
||||
return a_ItemMeta; //This keeps most textures. The few other items have to override this
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
virtual bool IsPlaceable();
|
||||
|
||||
virtual BLOCKTYPE GetBlockType();
|
||||
virtual NIBBLETYPE GetBlockMeta(char a_ItemMeta);
|
||||
virtual NIBBLETYPE GetBlockMeta(NIBBLETYPE a_ItemMeta);
|
||||
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID);
|
||||
|
||||
|
@ -12,7 +12,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z, char a_Dir)
|
||||
virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z, char a_Dir) override
|
||||
{
|
||||
switch(m_ItemID)
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ public:
|
||||
{
|
||||
|
||||
}
|
||||
virtual NIBBLETYPE GetBlockMeta(char a_ItemMeta) override
|
||||
virtual NIBBLETYPE GetBlockMeta(NIBBLETYPE a_ItemMeta) override
|
||||
{
|
||||
return a_ItemMeta;
|
||||
}
|
||||
|
@ -12,12 +12,12 @@ public:
|
||||
|
||||
}
|
||||
|
||||
virtual bool IsPlaceable()
|
||||
virtual bool IsPlaceable() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual BLOCKTYPE GetBlockType()
|
||||
virtual BLOCKTYPE GetBlockType() override
|
||||
{
|
||||
return (m_ItemID == E_ITEM_WOODEN_DOOR) ? E_BLOCK_WOODEN_DOOR : E_BLOCK_IRON_DOOR;
|
||||
}
|
||||
|
@ -7,12 +7,12 @@ class cItemDyeHandler : public cItemHandler
|
||||
{
|
||||
public:
|
||||
cItemDyeHandler(int a_ItemID)
|
||||
: cItemHandler(a_ItemID)
|
||||
: cItemHandler(a_ItemID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z, char a_Dir)
|
||||
virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z, char a_Dir) override
|
||||
{
|
||||
// TODO: Handle coloring the sheep, too (OnItemUseOnEntity maybe)
|
||||
// Handle growing the plants:
|
||||
|
@ -7,12 +7,12 @@ class cItemHoeHandler : public cItemHandler
|
||||
{
|
||||
public:
|
||||
cItemHoeHandler(int a_ItemID)
|
||||
: cItemHandler(a_ItemID)
|
||||
: cItemHandler(a_ItemID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z, char a_Dir)
|
||||
virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z, char a_Dir) override
|
||||
{
|
||||
BLOCKTYPE Block = a_World->GetBlock(a_X, a_Y, a_Z);
|
||||
|
||||
|
@ -10,8 +10,8 @@ public:
|
||||
: cItemHandler(a_ItemID)
|
||||
{
|
||||
}
|
||||
virtual NIBBLETYPE GetBlockMeta(char a_ItemMeta) override
|
||||
virtual NIBBLETYPE GetBlockMeta(NIBBLETYPE a_ItemMeta) override
|
||||
{
|
||||
return a_ItemMeta | 0x4; //0x4 bit set means this is a player-placed leaves block, not to be decayed
|
||||
return a_ItemMeta | 0x4; //0x4 bit set means this is a player places leave
|
||||
}
|
||||
};
|
@ -13,7 +13,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z, char a_Dir)
|
||||
virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z, char a_Dir) override
|
||||
{
|
||||
a_Player->UseEquippedItem();
|
||||
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID)
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID) override
|
||||
{
|
||||
switch(a_BlockID)
|
||||
{
|
||||
|
@ -10,17 +10,17 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool IsPlaceable()
|
||||
virtual bool IsPlaceable() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual BLOCKTYPE GetBlockType()
|
||||
virtual BLOCKTYPE GetBlockType() override
|
||||
{
|
||||
return E_BLOCK_REDSTONE_WIRE;
|
||||
}
|
||||
|
||||
virtual NIBBLETYPE GetBlockMeta(char a_ItemMeta) override
|
||||
virtual NIBBLETYPE GetBlockMeta(NIBBLETYPE a_ItemMeta) override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -10,17 +10,17 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool IsPlaceable()
|
||||
virtual bool IsPlaceable() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual BLOCKTYPE GetBlockType()
|
||||
virtual BLOCKTYPE GetBlockType() override
|
||||
{
|
||||
return ::E_BLOCK_REDSTONE_REPEATER_OFF;
|
||||
}
|
||||
|
||||
virtual NIBBLETYPE GetBlockMeta(char a_ItemMeta) override
|
||||
virtual NIBBLETYPE GetBlockMeta(NIBBLETYPE a_ItemMeta) override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
virtual NIBBLETYPE GetBlockMeta(char a_ItemMeta) override
|
||||
virtual NIBBLETYPE GetBlockMeta(NIBBLETYPE a_ItemMeta) override
|
||||
{
|
||||
//Only the first 2 bits are important
|
||||
return a_ItemMeta & 3;
|
||||
|
@ -12,17 +12,12 @@ public:
|
||||
|
||||
}
|
||||
|
||||
virtual bool IsPlaceable()
|
||||
virtual bool IsPlaceable() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool AllowBlockOnTop()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual BLOCKTYPE GetBlockType()
|
||||
virtual BLOCKTYPE GetBlockType() override
|
||||
{
|
||||
switch(m_ItemID)
|
||||
{
|
||||
@ -37,12 +32,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual NIBBLETYPE GetBlockMeta(char a_ItemMeta) override
|
||||
virtual NIBBLETYPE GetBlockMeta(NIBBLETYPE a_ItemMeta) override
|
||||
{
|
||||
return 0; //Not grown yet
|
||||
}
|
||||
|
||||
virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z, char a_Dir)
|
||||
virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z, char a_Dir) override
|
||||
{
|
||||
int X = a_X,
|
||||
Y = a_Y,
|
||||
|
@ -12,7 +12,7 @@ public:
|
||||
{
|
||||
|
||||
}
|
||||
virtual bool IsTool()
|
||||
virtual bool IsTool() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -33,7 +33,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID)
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID) override
|
||||
{
|
||||
return a_BlockID == E_BLOCK_COBWEB
|
||||
|| a_BlockID == E_BLOCK_VINES;
|
||||
|
@ -9,7 +9,7 @@ class cItemShovelHandler : public cItemHandler
|
||||
{
|
||||
public:
|
||||
cItemShovelHandler(int a_ItemID)
|
||||
: cItemHandler(a_ItemID)
|
||||
: cItemHandler(a_ItemID)
|
||||
{
|
||||
|
||||
}
|
||||
@ -28,7 +28,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID)
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID) override
|
||||
{
|
||||
return a_BlockID == E_BLOCK_SNOW;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z, char a_Dir)
|
||||
virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z, char a_Dir) override
|
||||
{
|
||||
BLOCKTYPE Block;
|
||||
NIBBLETYPE Meta;
|
||||
@ -32,7 +32,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual NIBBLETYPE GetBlockMeta(char a_ItemMeta) override
|
||||
virtual NIBBLETYPE GetBlockMeta(NIBBLETYPE a_ItemMeta) override
|
||||
{
|
||||
return a_ItemMeta;
|
||||
}
|
||||
|
@ -12,22 +12,17 @@ public:
|
||||
|
||||
}
|
||||
|
||||
virtual bool IsPlaceable()
|
||||
virtual bool IsPlaceable() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool AllowBlockOnTop()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual BLOCKTYPE GetBlockType()
|
||||
virtual BLOCKTYPE GetBlockType() override
|
||||
{
|
||||
return E_BLOCK_SUGARCANE;
|
||||
}
|
||||
|
||||
virtual NIBBLETYPE GetBlockMeta(char a_ItemMeta) override
|
||||
virtual NIBBLETYPE GetBlockMeta(NIBBLETYPE a_ItemMeta) override
|
||||
{
|
||||
return 0; //Not grown yet
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID)
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID) override
|
||||
{
|
||||
return a_BlockID == E_BLOCK_COBWEB;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ public:
|
||||
: cItemHandler(a_ItemID)
|
||||
{
|
||||
}
|
||||
virtual NIBBLETYPE GetBlockMeta(char a_ItemMeta) override
|
||||
virtual NIBBLETYPE GetBlockMeta(NIBBLETYPE a_ItemMeta) override
|
||||
{
|
||||
return a_ItemMeta;
|
||||
}
|
||||
|
@ -137,12 +137,12 @@ int main( int argc, char **argv )
|
||||
// Parse arguments for minidump flags:
|
||||
for (int i = 0; i < argc; i++)
|
||||
{
|
||||
if (stricmp(argv[i], "/cdg") == 0)
|
||||
if (_stricmp(argv[i], "/cdg") == 0)
|
||||
{
|
||||
// Add globals to the dump
|
||||
g_DumpFlags = (MINIDUMP_TYPE)(g_DumpFlags | MiniDumpWithDataSegs);
|
||||
}
|
||||
else if (stricmp(argv[i], "/cdf") == 0)
|
||||
else if (_stricmp(argv[i], "/cdf") == 0)
|
||||
{
|
||||
// Add full memory to the dump (HUUUGE file)
|
||||
g_DumpFlags = (MINIDUMP_TYPE)(g_DumpFlags | MiniDumpWithFullMemory);
|
||||
|
Loading…
x
Reference in New Issue
Block a user