diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-05-28 16:59:51 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-05-28 16:59:51 +0200 |
commit | 421588d25dd4e2e293d48daece27444bfbc318bf (patch) | |
tree | b198d998bb5a1c6a8de98aa58727be335a5bc9cb /src | |
parent | Add throw sound and fix arrow server crash. (diff) | |
download | cuberite-421588d25dd4e2e293d48daece27444bfbc318bf.tar cuberite-421588d25dd4e2e293d48daece27444bfbc318bf.tar.gz cuberite-421588d25dd4e2e293d48daece27444bfbc318bf.tar.bz2 cuberite-421588d25dd4e2e293d48daece27444bfbc318bf.tar.lz cuberite-421588d25dd4e2e293d48daece27444bfbc318bf.tar.xz cuberite-421588d25dd4e2e293d48daece27444bfbc318bf.tar.zst cuberite-421588d25dd4e2e293d48daece27444bfbc318bf.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/Blocks/BlockFire.h | 4 | ||||
-rw-r--r-- | src/ClientHandle.cpp | 33 |
2 files changed, 19 insertions, 18 deletions
diff --git a/src/Blocks/BlockFire.h b/src/Blocks/BlockFire.h index f9f32eb50..147e4b53e 100644 --- a/src/Blocks/BlockFire.h +++ b/src/Blocks/BlockFire.h @@ -36,8 +36,8 @@ public: - Loop through boundary variables, and fill with portal blocks based on Dir with meta from Dir */ - a_BlockY--; // Because we want the block below the fire - FindAndSetPortalFrame(a_BlockX, a_BlockY, a_BlockZ, a_ChunkInterface, a_WorldInterface); + // a_BlockY - 1: Because we want the block below the fire + FindAndSetPortalFrame(a_BlockX, a_BlockY - 1, a_BlockZ, a_ChunkInterface, a_WorldInterface); } virtual void OnDigging(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index ce7ce0cea..9a7d1cd62 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -954,6 +954,23 @@ void cClientHandle::HandleBlockDigStarted(int a_BlockX, int a_BlockY, int a_Bloc m_LastDigBlockY = a_BlockY; m_LastDigBlockZ = a_BlockZ; + 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 @@ -980,22 +997,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); - } - } } |