Merge pull request #2312 from SamJBarney/master
Fixes grass dying at night
This commit is contained in:
commit
fa100d9345
@ -86,7 +86,7 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info)
|
|||||||
a_Info[E_BLOCK_ENDER_CHEST ].m_SpreadLightFalloff = 1;
|
a_Info[E_BLOCK_ENDER_CHEST ].m_SpreadLightFalloff = 1;
|
||||||
a_Info[E_BLOCK_END_PORTAL ].m_SpreadLightFalloff = 1;
|
a_Info[E_BLOCK_END_PORTAL ].m_SpreadLightFalloff = 1;
|
||||||
a_Info[E_BLOCK_END_PORTAL_FRAME ].m_SpreadLightFalloff = 1;
|
a_Info[E_BLOCK_END_PORTAL_FRAME ].m_SpreadLightFalloff = 1;
|
||||||
a_Info[E_BLOCK_FARMLAND ].m_SpreadLightFalloff = 15;
|
a_Info[E_BLOCK_FARMLAND ].m_SpreadLightFalloff = 1;
|
||||||
a_Info[E_BLOCK_FENCE ].m_SpreadLightFalloff = 1;
|
a_Info[E_BLOCK_FENCE ].m_SpreadLightFalloff = 1;
|
||||||
a_Info[E_BLOCK_FENCE_GATE ].m_SpreadLightFalloff = 1;
|
a_Info[E_BLOCK_FENCE_GATE ].m_SpreadLightFalloff = 1;
|
||||||
a_Info[E_BLOCK_FIRE ].m_SpreadLightFalloff = 1;
|
a_Info[E_BLOCK_FIRE ].m_SpreadLightFalloff = 1;
|
||||||
@ -204,7 +204,6 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info)
|
|||||||
a_Info[E_BLOCK_ENDER_CHEST ].m_Transparent = true;
|
a_Info[E_BLOCK_ENDER_CHEST ].m_Transparent = true;
|
||||||
a_Info[E_BLOCK_END_PORTAL ].m_Transparent = true;
|
a_Info[E_BLOCK_END_PORTAL ].m_Transparent = true;
|
||||||
a_Info[E_BLOCK_END_PORTAL_FRAME ].m_Transparent = true;
|
a_Info[E_BLOCK_END_PORTAL_FRAME ].m_Transparent = true;
|
||||||
a_Info[E_BLOCK_FARMLAND ].m_Transparent = true;
|
|
||||||
a_Info[E_BLOCK_FENCE ].m_Transparent = true;
|
a_Info[E_BLOCK_FENCE ].m_Transparent = true;
|
||||||
a_Info[E_BLOCK_FENCE_GATE ].m_Transparent = true;
|
a_Info[E_BLOCK_FENCE_GATE ].m_Transparent = true;
|
||||||
a_Info[E_BLOCK_FIRE ].m_Transparent = true;
|
a_Info[E_BLOCK_FIRE ].m_Transparent = true;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "BlockHandler.h"
|
#include "BlockHandler.h"
|
||||||
#include "../FastRandom.h"
|
#include "../FastRandom.h"
|
||||||
|
#include "../BlockInfo.h"
|
||||||
#include "Root.h"
|
#include "Root.h"
|
||||||
#include "Bindings/PluginManager.h"
|
#include "Bindings/PluginManager.h"
|
||||||
|
|
||||||
@ -48,13 +49,16 @@ public:
|
|||||||
}
|
}
|
||||||
else if ((a_RelY < cChunkDef::Height - 1))
|
else if ((a_RelY < cChunkDef::Height - 1))
|
||||||
{
|
{
|
||||||
NIBBLETYPE light = std::max(a_Chunk.GetBlockLight(a_RelX, a_RelY + 1, a_RelZ), a_Chunk.GetTimeAlteredLight(a_Chunk.GetSkyLight(a_RelX, a_RelY + 1, a_RelZ)));
|
BLOCKTYPE above = a_Chunk.GetBlock(a_RelX, a_RelY + 1, a_RelZ);
|
||||||
// Grass turns back to dirt when light levels are below 5
|
|
||||||
if (light < 5)
|
// Grass turns back to dirt when the block above is not transparent
|
||||||
|
if (!cBlockInfo::IsTransparent(above))
|
||||||
{
|
{
|
||||||
a_Chunk.FastSetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_DIRT, E_META_DIRT_NORMAL);
|
a_Chunk.FastSetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_DIRT, E_META_DIRT_NORMAL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NIBBLETYPE light = std::max(a_Chunk.GetBlockLight(a_RelX, a_RelY + 1, a_RelZ), a_Chunk.GetTimeAlteredLight(a_Chunk.GetSkyLight(a_RelX, a_RelY + 1, a_RelZ)));
|
||||||
// Source block is not bright enough to spread
|
// Source block is not bright enough to spread
|
||||||
if (light < 9)
|
if (light < 9)
|
||||||
{
|
{
|
||||||
@ -93,10 +97,10 @@ public:
|
|||||||
// Not a regular dirt block
|
// Not a regular dirt block
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
BLOCKTYPE above = a_Chunk.GetBlock(BlockX, BlockY + 1, BlockZ);
|
||||||
NIBBLETYPE light = std::max(a_Chunk.GetBlockLight(BlockX, BlockY + 1, BlockZ), a_Chunk.GetTimeAlteredLight(a_Chunk.GetSkyLight(BlockX, BlockY + 1, BlockZ)));
|
NIBBLETYPE light = std::max(a_Chunk.GetBlockLight(BlockX, BlockY + 1, BlockZ), a_Chunk.GetTimeAlteredLight(a_Chunk.GetSkyLight(BlockX, BlockY + 1, BlockZ)));
|
||||||
// Grass does not spread to blocks with a light level less than 5
|
// Grass does not spread to blocks with a light level less than 5
|
||||||
if (light > 4)
|
if ((light > 4) && cBlockInfo::IsTransparent(above))
|
||||||
{
|
{
|
||||||
if (!cRoot::Get()->GetPluginManager()->CallHookBlockSpread(*Chunk->GetWorld(), Chunk->GetPosX() * cChunkDef::Width + BlockX, BlockY, Chunk->GetPosZ() * cChunkDef::Width + BlockZ, ssGrassSpread))
|
if (!cRoot::Get()->GetPluginManager()->CallHookBlockSpread(*Chunk->GetWorld(), Chunk->GetPosX() * cChunkDef::Width + BlockX, BlockY, Chunk->GetPosZ() * cChunkDef::Width + BlockZ, ssGrassSpread))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user