asItem() ]; } public function isAffectedBySilkTouch() : bool{ return true; } public function ticksRandomly() : bool{ return true; } public function onRandomTick() : void{ //TODO: light levels $x = mt_rand($this->position->x - 1, $this->position->x + 1); $y = mt_rand($this->position->y - 2, $this->position->y + 2); $z = mt_rand($this->position->z - 1, $this->position->z + 1); $block = $this->position->getWorld()->getBlockAt($x, $y, $z); if($block instanceof Dirt && !$block->isCoarse()){ if($block->getSide(Facing::UP) instanceof Transparent){ $ev = new BlockSpreadEvent($block, $this, VanillaBlocks::MYCELIUM()); $ev->call(); if(!$ev->isCancelled()){ $this->position->getWorld()->setBlock($block->position, $ev->getNewState()); } } } } }