Call BlockGrowEvent when sugarcane grows (#3780)

This commit is contained in:
KingOfTurkey38 2020-08-31 17:03:38 +02:00 committed by GitHub
parent 81c1613e5d
commit 0af08a7375
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}
}