diff options
Diffstat (limited to 'source/ChunkMap.cpp')
-rw-r--r-- | source/ChunkMap.cpp | 16 |
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)); } |