22declare(strict_types=1);
26use pocketmine\block\utils\AgeableTrait;
29use pocketmine\block\utils\StaticSupportTrait;
39 use StaticSupportTrait;
41 public const MAX_AGE = 7;
43 private function canBeSupportedAt(
Block $block) :
bool{
44 return $block->
getSide(Facing::DOWN)->getTypeId() === BlockTypeIds::FARMLAND;
48 if($this->age < self::MAX_AGE && $item instanceof
Fertilizer){
50 $tempAge = $block->age + mt_rand(2, 5);
51 if($tempAge > self::MAX_AGE){
52 $tempAge = self::MAX_AGE;
54 $block->age = $tempAge;
55 if(BlockEventHelper::grow($this, $block, $player)){
66 return $this->age < self::MAX_AGE;
73 BlockEventHelper::grow($this, $block,
null);
getSide(int $side, int $step=1)
onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player=null, array &$returnedItems=[])