diff options
author | 12xx12 <44411062+12xx12@users.noreply.github.com> | 2020-10-08 21:13:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-08 21:13:44 +0200 |
commit | 3381c0f6d6671a485283c889b036c0a431e2a2b9 (patch) | |
tree | bf32b4d9c8d8e6c4c8d232ca6ad16975ee6d17c6 /src/World.cpp | |
parent | Fix cmake not adding Werror on clang, and _lots_ of warnings (#4963) (diff) | |
download | cuberite-3381c0f6d6671a485283c889b036c0a431e2a2b9.tar cuberite-3381c0f6d6671a485283c889b036c0a431e2a2b9.tar.gz cuberite-3381c0f6d6671a485283c889b036c0a431e2a2b9.tar.bz2 cuberite-3381c0f6d6671a485283c889b036c0a431e2a2b9.tar.lz cuberite-3381c0f6d6671a485283c889b036c0a431e2a2b9.tar.xz cuberite-3381c0f6d6671a485283c889b036c0a431e2a2b9.tar.zst cuberite-3381c0f6d6671a485283c889b036c0a431e2a2b9.zip |
Diffstat (limited to '')
-rw-r--r-- | src/World.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/World.cpp b/src/World.cpp index 32ce7b4f9..88e76c817 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1394,7 +1394,27 @@ void cWorld::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_Blo if (!cPluginManager::Get()->CallHookExploding(*this, a_ExplosionSize, a_CanCauseFire, a_BlockX, a_BlockY, a_BlockZ, a_Source, a_SourceData) && (a_ExplosionSize > 0)) { // TODO: CanCauseFire gets reset to false for some reason - Explodinator::Kaboom(*this, Vector3d(a_BlockX, a_BlockY, a_BlockZ), FloorC<unsigned>(a_ExplosionSize), a_CanCauseFire); + + const cEntity * Entity; + switch (a_Source) + { + case eExplosionSource::esEnderCrystal: + case eExplosionSource::esGhastFireball: + case eExplosionSource::esMonster: + case eExplosionSource::esPrimedTNT: + case eExplosionSource::esWitherBirth: + case eExplosionSource::esWitherSkull: + { + Entity = static_cast<const cEntity *>(a_SourceData); + break; + } + default: + { + Entity = nullptr; + } + } + + Explodinator::Kaboom(*this, Vector3d(a_BlockX, a_BlockY, a_BlockZ), FloorC<unsigned>(a_ExplosionSize), a_CanCauseFire, Entity); cPluginManager::Get()->CallHookExploded(*this, a_ExplosionSize, a_CanCauseFire, a_BlockX, a_BlockY, a_BlockZ, a_Source, a_SourceData); } } @@ -2166,7 +2186,7 @@ bool cWorld::GetBlocks(sSetBlockVector & a_Blocks, bool a_ContinueOnFailure) -bool cWorld::DigBlock(Vector3i a_BlockPos) +bool cWorld::DigBlock(Vector3i a_BlockPos, const cEntity * a_Digger) { BLOCKTYPE BlockType; NIBBLETYPE BlockMeta; @@ -2178,7 +2198,7 @@ bool cWorld::DigBlock(Vector3i a_BlockPos) } cChunkInterface ChunkInterface(GetChunkMap()); - cBlockHandler::For(BlockType).OnBroken(ChunkInterface, *this, a_BlockPos, BlockType, BlockMeta); + cBlockHandler::For(BlockType).OnBroken(ChunkInterface, *this, a_BlockPos, BlockType, BlockMeta, a_Digger); return true; } @@ -2190,7 +2210,7 @@ bool cWorld::DigBlock(Vector3i a_BlockPos) bool cWorld::DropBlockAsPickups(Vector3i a_BlockPos, const cEntity * a_Digger, const cItem * a_Tool) { auto pickups = PickupsFromBlock(a_BlockPos, a_Digger, a_Tool); - if (!DigBlock(a_BlockPos)) + if (!DigBlock(a_BlockPos, a_Digger)) { return false; } |