From cc83c4641d50818bf4fd830653438515ed5264d3 Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Wed, 19 Aug 2015 10:45:53 -0600 Subject: * Logic for handling plant growth has been centralized into cBlockPlant, and all growable plants now inherit from it. * Blocks now have an effect upon plant growth, just like in vanilla. --- src/Blocks/BlockNetherWart.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/Blocks/BlockNetherWart.h') diff --git a/src/Blocks/BlockNetherWart.h b/src/Blocks/BlockNetherWart.h index 6a76e0828..b10150a92 100644 --- a/src/Blocks/BlockNetherWart.h +++ b/src/Blocks/BlockNetherWart.h @@ -1,7 +1,7 @@ #pragma once -#include "BlockHandler.h" +#include "BlockPlant.h" #include "../FastRandom.h" #include "../World.h" @@ -10,11 +10,12 @@ class cBlockNetherWartHandler : - public cBlockHandler + public cBlockPlant { + typedef cBlockPlant Super; public: cBlockNetherWartHandler(BLOCKTYPE a_BlockType) - : cBlockHandler(a_BlockType) + : Super(a_BlockType, false) { } @@ -36,7 +37,7 @@ public: virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override { NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); - if (Meta < 7) + if ((Meta < 7) && (CanGrow(a_Chunk, a_RelX, a_RelY, a_RelZ) == paGrowth)) { a_Chunk.FastSetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_NETHER_WART, ++Meta); } -- cgit v1.2.3