1
0

Change SetBlock to FastSetBlock in cRedstone.cpp and grass will now grow if any one hit block is above it.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@65 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
admin@omencraft.com 2011-11-05 19:31:25 +00:00
parent b7bff510f9
commit 7fe70356b9
2 changed files with 27 additions and 22 deletions

View File

@ -323,22 +323,27 @@ void cChunk::Tick(float a_Dt)
case E_BLOCK_DIRT: case E_BLOCK_DIRT:
{ {
char AboveBlock = GetBlock( Index+1 ); char AboveBlock = GetBlock( Index+1 );
if( AboveBlock == 0 && GetLight( m_BlockSkyLight, Index ) > 0xf/2 ) // Half lit if ( (AboveBlock == 0) && GetLight( m_BlockSkyLight, Index ) > 0xf/2 ) // Half lit //changed to not allow grass if any one hit object is on top
{ {
FastSetBlock( m_BlockTickX, m_BlockTickY, m_BlockTickZ, E_BLOCK_GRASS, GetLight( m_BlockMeta, Index ) ); FastSetBlock( m_BlockTickX, m_BlockTickY, m_BlockTickZ, E_BLOCK_GRASS, GetLight( m_BlockMeta, Index ) );
} }
if ( (g_BlockOneHitDig[AboveBlock]) && GetLight( m_BlockSkyLight, Index+1 ) > 0xf/2 ) // Half lit //ch$
{
FastSetBlock( m_BlockTickX, m_BlockTickY, m_BlockTickZ, E_BLOCK_GRASS, GetLight( m_BlockMeta, Index ) );
}
} }
break; break;
case E_BLOCK_GRASS: case E_BLOCK_GRASS:
{ {
char AboveBlock = GetBlock( Index+1 ); char AboveBlock = GetBlock( Index+1 );
if( AboveBlock != 0 ) if (!( (AboveBlock == 0) || (g_BlockOneHitDig[AboveBlock]) ) ) //changed to not allow grass if any one hit object is on top
{ {
FastSetBlock( m_BlockTickX, m_BlockTickY, m_BlockTickZ, E_BLOCK_DIRT, GetLight( m_BlockMeta, Index ) ); FastSetBlock( m_BlockTickX, m_BlockTickY, m_BlockTickZ, E_BLOCK_DIRT, GetLight( m_BlockMeta, Index ) );
} }
} }
break; break;
case E_BLOCK_SAPLING: case E_BLOCK_SAPLING: //todo: check meta of sapling. change m_World->GrowTree to look change trunk and leaves based on meta of sapling
{ {
FastSetBlock( m_BlockTickX, m_BlockTickY, m_BlockTickZ, E_BLOCK_AIR, GetLight( m_BlockMeta, Index ) ); FastSetBlock( m_BlockTickX, m_BlockTickY, m_BlockTickZ, E_BLOCK_AIR, GetLight( m_BlockMeta, Index ) );
m_World->GrowTree( m_BlockTickX + m_PosX*16, m_BlockTickY, m_BlockTickZ + m_PosZ*16 ); m_World->GrowTree( m_BlockTickX + m_PosX*16, m_BlockTickY, m_BlockTickZ + m_PosZ*16 );

View File

@ -18,53 +18,53 @@ void cRedstone::ChangeRedstoneTorch( int fillx, int filly, int fillz, bool added
metadata = 0; metadata = 0;
} }
cWorld* World = cRoot::Get()->GetWorld(); //cWorld* World = cRoot::Get()->GetWorld();
if ( ( (int)World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) { if ( ( (int)m_World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx+1, filly, fillz, metadata ); LightRedstone( fillx+1, filly, fillz, metadata );
} }
if ( ( (int)World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) { if ( ( (int)m_World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx-1, filly, fillz, metadata ); LightRedstone( fillx-1, filly, fillz, metadata );
} }
if ( ( (int)World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) ) { if ( ( (int)m_World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx, filly, fillz+1, metadata ); LightRedstone( fillx, filly, fillz+1, metadata );
} }
if ( ( (int)World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) ) { if ( ( (int)m_World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx, filly, fillz-1, metadata ); LightRedstone( fillx, filly, fillz-1, metadata );
} }
if ( ( (int)World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) { if ( ( (int)m_World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx+1, filly-1, fillz, metadata ); LightRedstone( fillx+1, filly-1, fillz, metadata );
} }
if ( ( (int)World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) { if ( ( (int)m_World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx-1, filly-1, fillz, metadata ); LightRedstone( fillx-1, filly-1, fillz, metadata );
} }
if ( ( (int)World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) ) { if ( ( (int)m_World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx, filly-1, fillz+1, metadata ); LightRedstone( fillx, filly-1, fillz+1, metadata );
} }
if ( ( (int)World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) ) { if ( ( (int)m_World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx, filly-1, fillz-1, metadata ); LightRedstone( fillx, filly-1, fillz-1, metadata );
} }
if ( ( (int)World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) { if ( ( (int)m_World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx+1, filly+1, fillz, metadata ); LightRedstone( fillx+1, filly+1, fillz, metadata );
} }
if ( ( (int)World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) { if ( ( (int)m_World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx-1, filly+1, fillz, metadata ); LightRedstone( fillx-1, filly+1, fillz, metadata );
} }
if ( ( (int)World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) ) { if ( ( (int)m_World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx, filly+1, fillz+1, metadata ); LightRedstone( fillx, filly+1, fillz+1, metadata );
} }
if ( ( (int)World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) ) { if ( ( (int)m_World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) ) {
LightRedstone( fillx, filly+1, fillz-1, metadata ); LightRedstone( fillx, filly+1, fillz-1, metadata );
} }
} }
void cRedstone::LightRedstone( int fillx, int filly, int fillz, char metadata) void cRedstone::LightRedstone( int fillx, int filly, int fillz, char metadata)
{ {
cWorld* World = cRoot::Get()->GetWorld(); //cWorld* World = cRoot::Get()->GetWorld();
if ( ( (int)World->GetBlock( fillx, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)World->GetBlockMeta( fillx, filly, fillz) != metadata ) ) { if ( ( (int)m_World->GetBlock( fillx, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz) != metadata ) ) {
World->SetBlock( fillx, filly, fillz, (char)E_BLOCK_REDSTONE_WIRE, metadata ); m_World->FastSetBlock( fillx, filly, fillz, (char)E_BLOCK_REDSTONE_WIRE, metadata );
LightRedstone(fillx-1,filly,fillz,metadata); LightRedstone(fillx-1,filly,fillz,metadata);
LightRedstone(fillx+1,filly,fillz,metadata); LightRedstone(fillx+1,filly,fillz,metadata);
LightRedstone(fillx,filly,fillz-1,metadata); LightRedstone(fillx,filly,fillz-1,metadata);