22declare(strict_types=1);
26use pocketmine\block\utils\AgeableTrait;
28use pocketmine\block\utils\StaticSupportTrait;
29use pocketmine\block\utils\SupportType;
38 use StaticSupportTrait;
40 public const MAX_AGE = 15;
51 return [
AxisAlignedBB::one()->contract($shrinkSize, 0, $shrinkSize)->trim(Facing::UP, $shrinkSize)];
55 return SupportType::NONE;
64 private function canBeSupportedAt(
Block $block) : bool{
65 $supportBlock = $block->getSide(
Facing::DOWN);
66 if(!$supportBlock->hasSameTypeId($this) && !$supportBlock->hasTypeTag(BlockTypeTags::SAND)){
69 foreach(Facing::HORIZONTAL as $side){
70 if($block->
getSide($side)->isSolid()){
83 if(!$this->getSide(
Facing::DOWN)->hasSameTypeId($this)){
84 $world = $this->position->getWorld();
85 if($this->age === self::MAX_AGE){
86 for($y = 1; $y < 3; ++$y){
87 if(!$world->isInWorld($this->position->x, $this->position->y + $y, $this->position->z)){
90 $b = $world->getBlockAt($this->position->x, $this->position->y + $y, $this->position->z);
91 if($b->getTypeId() === BlockTypeIds::AIR){
92 BlockEventHelper::grow($b, VanillaBlocks::CACTUS(),
null);
98 $world->setBlock($this->position, $this, update:
false);
101 $world->setBlock($this->position, $this, update:
false);
getSide(int $side, int $step=1)
getSupportType(int $facing)
recalculateCollisionBoxes()
onEntityInside(Entity $entity)