diff options
author | cedeel@gmail.com <cedeel@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-06-16 20:12:43 +0200 |
---|---|---|
committer | cedeel@gmail.com <cedeel@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-06-16 20:12:43 +0200 |
commit | 861fa61dfcbab0aaa27d70bb47eff27ace8e7c3f (patch) | |
tree | 5069936a3f57c440940391d3ab7cff5c9daa6dc3 | |
parent | Quick fix to support authentication. (diff) | |
download | cuberite-861fa61dfcbab0aaa27d70bb47eff27ace8e7c3f.tar cuberite-861fa61dfcbab0aaa27d70bb47eff27ace8e7c3f.tar.gz cuberite-861fa61dfcbab0aaa27d70bb47eff27ace8e7c3f.tar.bz2 cuberite-861fa61dfcbab0aaa27d70bb47eff27ace8e7c3f.tar.lz cuberite-861fa61dfcbab0aaa27d70bb47eff27ace8e7c3f.tar.xz cuberite-861fa61dfcbab0aaa27d70bb47eff27ace8e7c3f.tar.zst cuberite-861fa61dfcbab0aaa27d70bb47eff27ace8e7c3f.zip |
-rw-r--r-- | source/cChunk.cpp | 21 | ||||
-rw-r--r-- | source/cClientHandle.cpp | 5 |
2 files changed, 25 insertions, 1 deletions
diff --git a/source/cChunk.cpp b/source/cChunk.cpp index 02d60b6bd..70ece5893 100644 --- a/source/cChunk.cpp +++ b/source/cChunk.cpp @@ -591,8 +591,27 @@ void cChunk::TickBlocks(MTRand & a_TickRandom) break; } - case E_BLOCK_LEAVES: //todo, http://www.minecraftwiki.net/wiki/Data_values#Leaves + case E_BLOCK_LEAVES: { + NIBBLETYPE Meta = GetMeta(m_BlockTickX, m_BlockTickY, m_BlockTickZ); + if (((Meta & 0x04) == 0) && ((Meta & 0x08) == 1)){ + int x,y,z,f = 0; + for( y = 4; y > - 5; y-- ) { + for( x = - 4; x < 5; x++ ){ + for( z = - 4; z < 5; z++ ){ + if((x<0 ? -x : x) + (y<0 ? -y : y) + (z<0 ? -z : z) > 4) continue; + if(GetBlock(m_BlockTickX + x, m_BlockTickY + y, m_BlockTickZ + z) == E_BLOCK_LOG){ + f = 1; + } + } + } + } + if(f==0){ + SetBlock(m_BlockTickX, m_BlockTickY, m_BlockTickZ, 0, 0); + }else{ + SetMeta(m_BlockTickX, m_BlockTickY, m_BlockTickZ, Meta -= 8); + } + } break; } diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index bd02e31c3..e4c501a4f 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -1270,6 +1270,11 @@ void cClientHandle::HandleBlockPlace(cPacket_BlockPlace * a_Packet) bRemoveItem = false; break; } + case E_BLOCK_LEAVES: + { + MetaData += 0x4; + break; + } case E_ITEM_SEEDS: { if (ClickedBlock != E_BLOCK_FARMLAND) |