getSide(Facing::DOWN)->getTypeId() === BlockTypeIds::FARMLAND; } public function onInteract(Item $item, Facing $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{ if($this->age < self::MAX_AGE && $item instanceof Fertilizer){ $block = clone $this; $tempAge = $block->age + mt_rand(2, 5); if($tempAge > self::MAX_AGE){ $tempAge = self::MAX_AGE; } $block->age = $tempAge; if(BlockEventHelper::grow($this, $block, $player)){ $item->pop(); } return true; } return false; } public function ticksRandomly() : bool{ return $this->age < self::MAX_AGE; } public function onRandomTick() : void{ if($this->age < self::MAX_AGE && CropGrowthHelper::canGrow($this)){ $block = clone $this; ++$block->age; BlockEventHelper::grow($this, $block, null); } } }