From 861fa61dfcbab0aaa27d70bb47eff27ace8e7c3f Mon Sep 17 00:00:00 2001 From: "cedeel@gmail.com" Date: Sat, 16 Jun 2012 18:12:43 +0000 Subject: Leaves: Applied patch by Luksor. git-svn-id: http://mc-server.googlecode.com/svn/trunk@624 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cChunk.cpp | 21 ++++++++++++++++++++- source/cClientHandle.cpp | 5 +++++ 2 files changed, 25 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3