summaryrefslogtreecommitdiffstats
path: root/source/Blocks
diff options
context:
space:
mode:
authorSamuel Barney <samjbarney@gmail.com>2013-10-12 23:25:47 +0200
committerSamuel Barney <samjbarney@gmail.com>2013-10-12 23:25:47 +0200
commitc74d1ffb91bc9af406599dfba00062efa6e47643 (patch)
treeb0126bfd2e039f0d17b84dc5716b85ab2b20443a /source/Blocks
parentFix: Wrong arg name (diff)
downloadcuberite-c74d1ffb91bc9af406599dfba00062efa6e47643.tar
cuberite-c74d1ffb91bc9af406599dfba00062efa6e47643.tar.gz
cuberite-c74d1ffb91bc9af406599dfba00062efa6e47643.tar.bz2
cuberite-c74d1ffb91bc9af406599dfba00062efa6e47643.tar.lz
cuberite-c74d1ffb91bc9af406599dfba00062efa6e47643.tar.xz
cuberite-c74d1ffb91bc9af406599dfba00062efa6e47643.tar.zst
cuberite-c74d1ffb91bc9af406599dfba00062efa6e47643.zip
Diffstat (limited to '')
-rw-r--r--source/Blocks/BlockCrops.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/Blocks/BlockCrops.h b/source/Blocks/BlockCrops.h
index 9e19b14ec..81d35a06c 100644
--- a/source/Blocks/BlockCrops.h
+++ b/source/Blocks/BlockCrops.h
@@ -78,10 +78,17 @@ public:
void OnUpdate(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
- if (Meta < 7)
+ NIBBLETYPE Water = a_World->GetBlockMeta(a_BlockX, a_BlockY - 1, a_BlockZ);
+ NIBBLETYPE Light = a_World->GetBlockBlockLight(a_BlockX, a_BlockY, a_BlockZ);
+
+ if ((Meta < 7) && (Water > 0) && (Light > 8))
{
a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_CROPS, ++Meta);
}
+ else if ((!Water) || (Light < 9))
+ {
+ a_World->DigBlock(a_BlockX, a_BlockY, a_BlockZ);
+ }
}