summaryrefslogtreecommitdiffstats
path: root/source/ChunkMap.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-10-24 00:40:59 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-10-24 00:40:59 +0200
commit442c428f5bb1b36ae2662ecf86b4e62d7666a7b5 (patch)
tree9b6086dad8a258fe8f8cbec7d960fd6d7aab7fbd /source/ChunkMap.cpp
parentMerge remote-tracking branch 'upstream/master' (diff)
downloadcuberite-442c428f5bb1b36ae2662ecf86b4e62d7666a7b5.tar
cuberite-442c428f5bb1b36ae2662ecf86b4e62d7666a7b5.tar.gz
cuberite-442c428f5bb1b36ae2662ecf86b4e62d7666a7b5.tar.bz2
cuberite-442c428f5bb1b36ae2662ecf86b4e62d7666a7b5.tar.lz
cuberite-442c428f5bb1b36ae2662ecf86b4e62d7666a7b5.tar.xz
cuberite-442c428f5bb1b36ae2662ecf86b4e62d7666a7b5.tar.zst
cuberite-442c428f5bb1b36ae2662ecf86b4e62d7666a7b5.zip
Diffstat (limited to '')
-rw-r--r--source/ChunkMap.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/source/ChunkMap.cpp b/source/ChunkMap.cpp
index 3c098fdfe..8f451fce9 100644
--- a/source/ChunkMap.cpp
+++ b/source/ChunkMap.cpp
@@ -12,6 +12,7 @@
#include "BlockArea.h"
#include "PluginManager.h"
#include "Entities/TNTEntity.h"
+#include "Blocks/BlockHandler.h"
#ifndef _WIN32
#include <cstdlib> // abs
@@ -1608,7 +1609,9 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_
// Too far away
continue;
}
- switch (area.GetBlockType(bx + x, by + y, bz + z))
+
+ BLOCKTYPE Block = area.GetBlockType(bx + x, by + y, bz + z);
+ switch (Block)
{
case E_BLOCK_TNT:
{
@@ -1644,6 +1647,17 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_
default:
{
+ if (Block != E_BLOCK_AIR) // No pickups for air
+ {
+ if (m_World->GetTickRandomNumber(10) == 5)
+ {
+ cItems Drops;
+ cBlockHandler * Handler = BlockHandler(Block);
+
+ Handler->ConvertToPickups(Drops, area.GetBlockMeta(bx + x, by + y, bz + z)); // Saves us from a massive switch
+ m_World->SpawnItemPickups(Drops, bx + x, by + y, bz + z);
+ }
+ }
area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_AIR);
a_BlocksAffected.push_back(Vector3i(bx + x, by + y, bz + z));
}