Moved blockticking into blockhandler classes.
Also slightly refactored the variable / argument names (BlockID is deprecated, use BlockType instead) git-svn-id: http://mc-server.googlecode.com/svn/trunk@921 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -5,7 +5,12 @@
|
||||
#include "../World.h"
|
||||
#include "../Player.h"
|
||||
|
||||
class cItemDyeHandler : public cItemHandler
|
||||
|
||||
|
||||
|
||||
|
||||
class cItemDyeHandler :
|
||||
public cItemHandler
|
||||
{
|
||||
public:
|
||||
cItemDyeHandler(int a_ItemID)
|
||||
@@ -20,7 +25,7 @@ public:
|
||||
// Handle growing the plants:
|
||||
if (a_Item->m_ItemHealth == E_META_DYE_WHITE)
|
||||
{
|
||||
if(a_World->GrowPlant(a_X, a_Y, a_Z, true))
|
||||
if (a_World->GrowRipePlant(a_X, a_Y, a_Z, true))
|
||||
{
|
||||
if (a_Player->GetGameMode() == eGameMode_Survival)
|
||||
{
|
||||
@@ -32,4 +37,8 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@ bool cItemHandler::IsPlaceable()
|
||||
|
||||
|
||||
|
||||
bool cItemHandler::CanHarvestBlock(BLOCKTYPE a_BlockID)
|
||||
bool cItemHandler::CanHarvestBlock(BLOCKTYPE a_BlockType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
//Returns the block meta on placement
|
||||
virtual NIBBLETYPE GetBlockMeta(short a_ItemDamage);
|
||||
// Returns whether this tool/item can harvest a specific block (e.g. wooden pickaxe can harvest stone, but wood can´t) DEFAULT: False
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID);
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType);
|
||||
|
||||
static cItemHandler *GetItemHandler(int a_ItemID);
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID) override
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
|
||||
{
|
||||
switch(a_BlockID)
|
||||
switch(a_BlockType)
|
||||
{
|
||||
case E_BLOCK_OBSIDIAN:
|
||||
return PickaxeLevel() >= 4;
|
||||
|
||||
@@ -34,9 +34,9 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID) override
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
|
||||
{
|
||||
return a_BlockID == E_BLOCK_COBWEB
|
||||
|| a_BlockID == E_BLOCK_VINES;
|
||||
return a_BlockType == E_BLOCK_COBWEB
|
||||
|| a_BlockType == E_BLOCK_VINES;
|
||||
}
|
||||
};
|
||||
@@ -34,8 +34,8 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID) override
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
|
||||
{
|
||||
return a_BlockID == E_BLOCK_SNOW;
|
||||
return a_BlockType == E_BLOCK_SNOW;
|
||||
}
|
||||
};
|
||||
@@ -14,8 +14,8 @@ public:
|
||||
|
||||
}
|
||||
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID) override
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
|
||||
{
|
||||
return a_BlockID == E_BLOCK_COBWEB;
|
||||
return a_BlockType == E_BLOCK_COBWEB;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user