summaryrefslogtreecommitdiffstats
path: root/source/Blocks/BlockHandler.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-01 23:08:15 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-01 23:08:15 +0200
commit85164fab8e5298ce1c0582b2aebb7e6a283d4a0c (patch)
tree6fdaf7f724044a025ecc9f1a8cadf8ee61d9355d /source/Blocks/BlockHandler.cpp
parentAdded some missing block enums (diff)
downloadcuberite-85164fab8e5298ce1c0582b2aebb7e6a283d4a0c.tar
cuberite-85164fab8e5298ce1c0582b2aebb7e6a283d4a0c.tar.gz
cuberite-85164fab8e5298ce1c0582b2aebb7e6a283d4a0c.tar.bz2
cuberite-85164fab8e5298ce1c0582b2aebb7e6a283d4a0c.tar.lz
cuberite-85164fab8e5298ce1c0582b2aebb7e6a283d4a0c.tar.xz
cuberite-85164fab8e5298ce1c0582b2aebb7e6a283d4a0c.tar.zst
cuberite-85164fab8e5298ce1c0582b2aebb7e6a283d4a0c.zip
Diffstat (limited to '')
-rw-r--r--source/Blocks/BlockHandler.cpp59
1 files changed, 16 insertions, 43 deletions
diff --git a/source/Blocks/BlockHandler.cpp b/source/Blocks/BlockHandler.cpp
index 419b20de0..ae138db92 100644
--- a/source/Blocks/BlockHandler.cpp
+++ b/source/Blocks/BlockHandler.cpp
@@ -317,43 +317,24 @@ void cBlockHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_
-char cBlockHandler::GetDropCount()
+void cBlockHandler::ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta)
{
- return 1;
+ // Setting the meta to a_BlockMeta keeps most textures. The few other blocks have to override this.
+ a_Pickups.push_back(cItem(m_BlockID, 1, a_BlockMeta));
}
-int cBlockHandler::GetDropID()
+void cBlockHandler::DropBlock(cWorld * a_World, int a_X, int a_Y, int a_Z)
{
- return m_BlockID;
-}
-
-
-
-
-
-NIBBLETYPE cBlockHandler::GetDropMeta(NIBBLETYPE a_BlockMeta)
-{
- return a_BlockMeta; //This keeps most textures. The few other blocks have to override this
-}
-
-
-
-
-
-void cBlockHandler::DropBlock(cWorld *a_World, int a_X, int a_Y, int a_Z)
-{
- cItems Drops;
+ cItems Pickups;
NIBBLETYPE Meta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
- char DropCount = GetDropCount();
- short DropItem = (short)GetDropID();
- if (DropCount > 0 && (DropItem != E_ITEM_EMPTY))
+ ConvertToPickups(Pickups, Meta);
+ if (!Pickups.empty())
{
- Drops.push_back(cItem(DropItem, DropCount, GetDropMeta(Meta)));
- a_World->SpawnItemPickups(Drops, a_X, a_Y, a_Z);
+ a_World->SpawnItemPickups(Pickups, a_X, a_Y, a_Z);
}
}
@@ -361,7 +342,8 @@ void cBlockHandler::DropBlock(cWorld *a_World, int a_X, int a_Y, int a_Z)
-AString cBlockHandler::GetStepSound() {
+const char * cBlockHandler::GetStepSound()
+{
return "step.stone";
}
@@ -396,7 +378,7 @@ bool cBlockHandler::IsUseable()
-bool cBlockHandler::IsClickedThrough()
+bool cBlockHandler::IsClickedThrough(void)
{
return false;
}
@@ -405,25 +387,16 @@ bool cBlockHandler::IsClickedThrough()
-bool cBlockHandler::IgnoreBuildCollision()
+bool cBlockHandler::DoesIgnoreBuildCollision(void)
{
- return m_BlockID == E_BLOCK_AIR;
-}
-
-
-
-
-
-bool cBlockHandler::NeedsRandomTicks()
-{
- return false;
+ return (m_BlockID == E_BLOCK_AIR);
}
-bool cBlockHandler::AllowBlockOnTop()
+bool cBlockHandler::DoesAllowBlockOnTop(void)
{
return true;
}
@@ -432,7 +405,7 @@ bool cBlockHandler::AllowBlockOnTop()
-bool cBlockHandler::CanBePlacedOnSide()
+bool cBlockHandler::CanBePlacedOnSide(void)
{
return true;
}
@@ -441,7 +414,7 @@ bool cBlockHandler::CanBePlacedOnSide()
-bool cBlockHandler::DropOnUnsuitable()
+bool cBlockHandler::DoesDropOnUnsuitable(void)
{
return true;
}