summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
author12xx12 <44411062+12xx12@users.noreply.github.com>2020-10-08 21:13:44 +0200
committerGitHub <noreply@github.com>2020-10-08 21:13:44 +0200
commit3381c0f6d6671a485283c889b036c0a431e2a2b9 (patch)
treebf32b4d9c8d8e6c4c8d232ca6ad16975ee6d17c6 /src/ClientHandle.cpp
parentFix cmake not adding Werror on clang, and _lots_ of warnings (#4963) (diff)
downloadcuberite-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/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 0ef041f32..2dd622b93 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1398,7 +1398,12 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
return;
}
+ // Apply hunger:
m_Player->AddFoodExhaustion(0.025);
+
+ // Damage the tool, but not for 0 hardness blocks:
+ m_Player->UseEquippedItem(cBlockInfo::IsOneHitDig(a_OldBlock) ? cItemHandler::dlaBreakBlockInstant : cItemHandler::dlaBreakBlock);
+
cChunkInterface ChunkInterface(World->GetChunkMap());
Vector3i absPos(a_BlockX, a_BlockY, a_BlockZ);
if (m_Player->IsGameModeSurvival())
@@ -1407,15 +1412,10 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
}
else
{
- World->DigBlock(absPos);
+ World->DigBlock(absPos, m_Player);
}
- // Damage the tool, but not for 0 hardness blocks:
- auto dlAction = cBlockInfo::IsOneHitDig(a_OldBlock) ? cItemHandler::dlaBreakBlockInstant : cItemHandler::dlaBreakBlock;
- m_Player->UseEquippedItem(dlAction);
-
World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, absPos, a_OldBlock, this);
- cBlockHandler::For(a_OldBlock).OnPlayerBrokeBlock(ChunkInterface, *World, *m_Player, absPos, a_OldBlock, a_OldMeta);
cRoot::Get()->GetPluginManager()->CallHookPlayerBrokenBlock(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_OldBlock, a_OldMeta);
}