summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockHandler.cpp
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-09-17 19:47:33 +0200
committerTycho <work.tycho+git@gmail.com>2014-09-17 19:47:33 +0200
commit045d54e0e28a9338b171c93c5bbc9ccba4c79ef1 (patch)
tree58e083f5b1f97baf6de712485d3629bdcac275a8 /src/Blocks/BlockHandler.cpp
parentAdded first test to show the object can be created (diff)
parentBungeeCord compatibility: don't overwrite UUID / properties. (diff)
downloadcuberite-045d54e0e28a9338b171c93c5bbc9ccba4c79ef1.tar
cuberite-045d54e0e28a9338b171c93c5bbc9ccba4c79ef1.tar.gz
cuberite-045d54e0e28a9338b171c93c5bbc9ccba4c79ef1.tar.bz2
cuberite-045d54e0e28a9338b171c93c5bbc9ccba4c79ef1.tar.lz
cuberite-045d54e0e28a9338b171c93c5bbc9ccba4c79ef1.tar.xz
cuberite-045d54e0e28a9338b171c93c5bbc9ccba4c79ef1.tar.zst
cuberite-045d54e0e28a9338b171c93c5bbc9ccba4c79ef1.zip
Diffstat (limited to 'src/Blocks/BlockHandler.cpp')
-rw-r--r--src/Blocks/BlockHandler.cpp70
1 files changed, 30 insertions, 40 deletions
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp
index 34925a252..cee2f4b99 100644
--- a/src/Blocks/BlockHandler.cpp
+++ b/src/Blocks/BlockHandler.cpp
@@ -47,6 +47,7 @@
#include "BlockLilypad.h"
#include "BlockLever.h"
#include "BlockMelon.h"
+#include "BlockMobSpawner.h"
#include "BlockMushroom.h"
#include "BlockMycelium.h"
#include "BlockNetherWart.h"
@@ -244,6 +245,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_LOG: return new cBlockSidewaysHandler (a_BlockType);
case E_BLOCK_MELON: return new cBlockMelonHandler (a_BlockType);
case E_BLOCK_MELON_STEM: return new cBlockStemsHandler (a_BlockType);
+ case E_BLOCK_MOB_SPAWNER: return new cBlockMobSpawnerHandler (a_BlockType);
case E_BLOCK_MYCELIUM: return new cBlockMyceliumHandler (a_BlockType);
case E_BLOCK_NETHER_BRICK_STAIRS: return new cBlockStairsHandler (a_BlockType);
case E_BLOCK_NETHER_PORTAL: return new cBlockPortalHandler (a_BlockType);
@@ -417,57 +419,45 @@ void cBlockHandler::ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta)
-void cBlockHandler::DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop, bool a_DropVerbatim)
+void cBlockHandler::DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop)
{
cItems Pickups;
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
if (a_CanDrop)
{
- if (!a_DropVerbatim)
- {
- ConvertToPickups(Pickups, Meta);
- }
- else
- {
- // TODO: Add a proper overridable function for this
- if (a_Digger != NULL)
+ if ((a_Digger != NULL) && (a_Digger->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchSilkTouch) > 0))
+ {
+ switch (m_BlockType)
{
- cEnchantments Enchantments = a_Digger->GetEquippedWeapon().m_Enchantments;
- if ((Enchantments.GetLevel(cEnchantments::enchSilkTouch) > 0) && a_Digger->IsPlayer())
+ case E_BLOCK_CAKE:
+ case E_BLOCK_CARROTS:
+ case E_BLOCK_COCOA_POD:
+ case E_BLOCK_DOUBLE_STONE_SLAB:
+ case E_BLOCK_DOUBLE_WOODEN_SLAB:
+ case E_BLOCK_FIRE:
+ case E_BLOCK_FARMLAND:
+ case E_BLOCK_MELON_STEM:
+ case E_BLOCK_MOB_SPAWNER:
+ case E_BLOCK_NETHER_WART:
+ case E_BLOCK_POTATOES:
+ case E_BLOCK_PUMPKIN_STEM:
+ case E_BLOCK_SNOW:
+ case E_BLOCK_SUGARCANE:
+ case E_BLOCK_TALL_GRASS:
+ case E_BLOCK_CROPS:
{
- switch (m_BlockType)
- {
- case E_BLOCK_CAKE:
- case E_BLOCK_CARROTS:
- case E_BLOCK_COCOA_POD:
- case E_BLOCK_DOUBLE_STONE_SLAB:
- case E_BLOCK_DOUBLE_WOODEN_SLAB:
- case E_BLOCK_FIRE:
- case E_BLOCK_FARMLAND:
- case E_BLOCK_MELON_STEM:
- case E_BLOCK_MOB_SPAWNER:
- case E_BLOCK_NETHER_WART:
- case E_BLOCK_POTATOES:
- case E_BLOCK_PUMPKIN_STEM:
- case E_BLOCK_SNOW:
- case E_BLOCK_SUGARCANE:
- case E_BLOCK_TALL_GRASS:
- case E_BLOCK_CROPS:
- {
- // Silktouch can't be used for this blocks
- ConvertToPickups(Pickups, Meta);
- break;
- };
- default: Pickups.Add(m_BlockType, 1, Meta);
- }
- }
- else
- {
- Pickups.Add(m_BlockType, 1, Meta);
+ // Silktouch can't be used for these blocks
+ ConvertToPickups(Pickups, Meta);
+ break;
}
+ default: Pickups.Add(m_BlockType, 1, Meta); break;
}
}
+ else
+ {
+ ConvertToPickups(Pickups, Meta);
+ }
}
// Allow plugins to modify the pickups: