diff options
author | Mattes D <github@xoft.cz> | 2014-06-18 18:23:18 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-06-18 18:23:18 +0200 |
commit | c30b7b87354cd7868dd986008ac91187390a08b2 (patch) | |
tree | 5f7222853d649ca5e66a2640462b4468be6fd79e /src/ClientHandle.cpp | |
parent | Merge pull request #1100 from Howaner/Slabs (diff) | |
parent | Merge branch 'master' into GlobalFixes (diff) | |
download | cuberite-c30b7b87354cd7868dd986008ac91187390a08b2.tar cuberite-c30b7b87354cd7868dd986008ac91187390a08b2.tar.gz cuberite-c30b7b87354cd7868dd986008ac91187390a08b2.tar.bz2 cuberite-c30b7b87354cd7868dd986008ac91187390a08b2.tar.lz cuberite-c30b7b87354cd7868dd986008ac91187390a08b2.tar.xz cuberite-c30b7b87354cd7868dd986008ac91187390a08b2.tar.zst cuberite-c30b7b87354cd7868dd986008ac91187390a08b2.zip |
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r-- | src/ClientHandle.cpp | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index e4bb9d8e9..ade7e20ac 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -953,6 +953,26 @@ void cClientHandle::HandleBlockDigStarted(int a_BlockX, int a_BlockY, int a_Bloc m_LastDigBlockY = a_BlockY; m_LastDigBlockZ = a_BlockZ; + // Check for clickthrough-blocks: + /* When the user breaks a fire block, the client send the wrong block location. + We must find the right block with the face direction. */ + if (a_BlockFace != BLOCK_FACE_NONE) + { + int pX = a_BlockX; + int pY = a_BlockY; + int pZ = a_BlockZ; + + AddFaceDirection(pX, pY, pZ, a_BlockFace); // Get the block in front of the clicked coordinates (m_bInverse defaulted to false) + cBlockHandler * Handler = cBlockInfo::GetHandler(m_Player->GetWorld()->GetBlock(pX, pY, pZ)); + + if (Handler->IsClickedThrough()) + { + cChunkInterface ChunkInterface(m_Player->GetWorld()->GetChunkMap()); + Handler->OnDigging(ChunkInterface, *m_Player->GetWorld(), m_Player, pX, pY, pZ); + return; + } + } + if ( (m_Player->IsGameModeCreative()) || // In creative mode, digging is done immediately cBlockInfo::IsOneHitDig(a_OldBlock) // One-hit blocks get destroyed immediately, too @@ -979,22 +999,6 @@ void cClientHandle::HandleBlockDigStarted(int a_BlockX, int a_BlockY, int a_Bloc cItemHandler * ItemHandler = cItemHandler::GetItemHandler(m_Player->GetEquippedItem()); ItemHandler->OnDiggingBlock(World, m_Player, m_Player->GetEquippedItem(), a_BlockX, a_BlockY, a_BlockZ, a_BlockFace); - - // Check for clickthrough-blocks: - if (a_BlockFace != BLOCK_FACE_NONE) - { - int pX = a_BlockX; - int pY = a_BlockY; - int pZ = a_BlockZ; - - AddFaceDirection(pX, pY, pZ, a_BlockFace); // Get the block in front of the clicked coordinates (m_bInverse defaulted to false) - Handler = cBlockInfo::GetHandler(World->GetBlock(pX, pY, pZ)); - - if (Handler->IsClickedThrough()) - { - Handler->OnDigging(ChunkInterface, *World, m_Player, pX, pY, pZ); - } - } } |