summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockLeaves.h
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-11-30 15:58:27 +0100
committermadmaxoft <github@xoft.cz>2013-11-30 15:58:27 +0100
commitc70c2fa42fa9336958e7b66a8813d075963f3463 (patch)
tree52ef965eb191c81aca95fd56146d10478496d645 /src/Blocks/BlockLeaves.h
parentAdded IsBiomeNoDownfall() function. (diff)
downloadcuberite-c70c2fa42fa9336958e7b66a8813d075963f3463.tar
cuberite-c70c2fa42fa9336958e7b66a8813d075963f3463.tar.gz
cuberite-c70c2fa42fa9336958e7b66a8813d075963f3463.tar.bz2
cuberite-c70c2fa42fa9336958e7b66a8813d075963f3463.tar.lz
cuberite-c70c2fa42fa9336958e7b66a8813d075963f3463.tar.xz
cuberite-c70c2fa42fa9336958e7b66a8813d075963f3463.tar.zst
cuberite-c70c2fa42fa9336958e7b66a8813d075963f3463.zip
Diffstat (limited to 'src/Blocks/BlockLeaves.h')
-rw-r--r--src/Blocks/BlockLeaves.h25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h
index 6e015b8fa..539d12a49 100644
--- a/src/Blocks/BlockLeaves.h
+++ b/src/Blocks/BlockLeaves.h
@@ -77,9 +77,9 @@ public:
}
- virtual void OnUpdate(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
+ void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
- NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
+ NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
if ((Meta & 0x04) != 0)
{
// Player-placed leaves, don't decay
@@ -93,12 +93,14 @@ public:
}
// Get the data around the leaves:
+ int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width;
+ int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width;
cBlockArea Area;
if (!Area.Read(
- a_World,
- a_BlockX - LEAVES_CHECK_DISTANCE, a_BlockX + LEAVES_CHECK_DISTANCE,
- a_BlockY - LEAVES_CHECK_DISTANCE, a_BlockY + LEAVES_CHECK_DISTANCE,
- a_BlockZ - LEAVES_CHECK_DISTANCE, a_BlockZ + LEAVES_CHECK_DISTANCE,
+ a_Chunk.GetWorld(),
+ BlockX - LEAVES_CHECK_DISTANCE, BlockX + LEAVES_CHECK_DISTANCE,
+ a_RelY - LEAVES_CHECK_DISTANCE, a_RelY + LEAVES_CHECK_DISTANCE,
+ BlockZ - LEAVES_CHECK_DISTANCE, BlockZ + LEAVES_CHECK_DISTANCE,
cBlockArea::baTypes)
)
{
@@ -106,17 +108,16 @@ public:
return;
}
- if (HasNearLog(Area, a_BlockX, a_BlockY, a_BlockZ))
+ if (HasNearLog(Area, BlockX, a_RelY, BlockZ))
{
// Wood found, the leaves stay; mark them as checked:
- a_World->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta | 0x8);
+ a_Chunk.SetMeta(a_RelX, a_RelY, a_RelZ, Meta | 0x8);
return;
}
- // Decay the leaves:
- DropBlock(a_World, NULL, a_BlockX, a_BlockY, a_BlockZ);
- a_World->DigBlock(a_BlockX, a_BlockY, a_BlockZ);
-
+ // Decay the leaves:
+ DropBlock(a_Chunk.GetWorld(), NULL, BlockX, a_RelY, BlockZ);
+ a_Chunk.GetWorld()->DigBlock(BlockX, a_RelY, BlockZ);
}