From 0af08a73756e3d22caa9a596f87343441a7db714 Mon Sep 17 00:00:00 2001 From: KingOfTurkey38 <51199432+KingOfTurkey38@users.noreply.github.com> Date: Mon, 31 Aug 2020 17:03:38 +0200 Subject: [PATCH] Call BlockGrowEvent when sugarcane grows (#3780) --- src/pocketmine/block/Sugarcane.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/block/Sugarcane.php b/src/pocketmine/block/Sugarcane.php index cdda01f8e..a8fa2e8f1 100644 --- a/src/pocketmine/block/Sugarcane.php +++ b/src/pocketmine/block/Sugarcane.php @@ -87,7 +87,12 @@ class Sugarcane extends Flowable{ for($y = 1; $y < 3; ++$y){ $b = $this->getLevelNonNull()->getBlockAt($this->x, $this->y + $y, $this->z); if($b->getId() === self::AIR){ - $this->getLevelNonNull()->setBlock($b, BlockFactory::get(Block::SUGARCANE_BLOCK), true); + $ev = new BlockGrowEvent($b, BlockFactory::get(Block::SUGARCANE_BLOCK)); + $ev->call(); + if($ev->isCancelled()){ + break; + } + $this->getLevelNonNull()->setBlock($b, $ev->getNewState(), true); break; } }