83 $up = $this->getSide(
Facing::UP);
84 if($up->getTypeId() !== BlockTypeIds::AIR){
88 $world = $this->position->getWorld();
90 if(!$world->isInWorld($up->position->x, $up->position->y, $up->position->z)){
95 while($height < self::MAX_HEIGHT && $this->getSide(Facing::DOWN, $height)->hasSameTypeId($this)){
100 $canGrowFlower =
true;
101 foreach(Facing::HORIZONTAL as $side){
102 if($up->getSide($side)->isSolid()){
103 $canGrowFlower =
false;
109 $chance = $height >= self::MAX_HEIGHT ? 25 : 10;
110 if(mt_rand(1, 100) <= $chance){
111 if(BlockEventHelper::grow($up, VanillaBlocks::CACTUS_FLOWER(),
null)){
113 $world->setBlock($this->position, $this, update:
false);
120 if($this->age === self::MAX_AGE){
123 if($height < self::MAX_HEIGHT){
124 BlockEventHelper::grow($up, VanillaBlocks::CACTUS(),
null);
129 $world->setBlock($this->position, $this, update:
false);