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/Blocks/BlockMobSpawner.h | |
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 'src/Blocks/BlockMobSpawner.h')
-rw-r--r-- | src/Blocks/BlockMobSpawner.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/Blocks/BlockMobSpawner.h b/src/Blocks/BlockMobSpawner.h index a002a4eb9..27d3d61de 100644 --- a/src/Blocks/BlockMobSpawner.h +++ b/src/Blocks/BlockMobSpawner.h @@ -54,21 +54,27 @@ private: - virtual void OnPlayerBrokeBlock( + virtual void OnBroken( cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, - cPlayer & a_Player, Vector3i a_BlockPos, - BLOCKTYPE a_OldBlockType, NIBBLETYPE a_OldBlockMeta + BLOCKTYPE a_OldBlockType, NIBBLETYPE a_OldBlockMeta, + const cEntity * a_Digger ) const override { - auto handler = a_Player.GetEquippedItem().GetHandler(); - if (!a_Player.IsGameModeSurvival() || !handler->CanHarvestBlock(E_BLOCK_MOB_SPAWNER)) + if (!a_Digger->IsPlayer()) + { + return; + } + + const auto Player = static_cast<const cPlayer *>(a_Digger); + auto Handler = Player->GetEquippedItem().GetHandler(); + if (!Player->IsGameModeSurvival() || !Handler->CanHarvestBlock(E_BLOCK_MOB_SPAWNER)) { return; } - auto & random = GetRandomProvider(); - int reward = 15 + random.RandInt(14) + random.RandInt(14); - a_WorldInterface.SpawnSplitExperienceOrbs(Vector3d(0.5, 0.5, 0.5) + a_BlockPos, reward); + auto & Random = GetRandomProvider(); + int Reward = 15 + Random.RandInt(14) + Random.RandInt(14); + a_WorldInterface.SpawnSplitExperienceOrbs(Vector3d(0.5, 0.5, 0.5) + a_BlockPos, Reward); } } ; |