ok so im trying to make it so when you break a block it breaks block around it example xxx xox xxx ok lets say o is the block you broke and x is the blocks that are around it. how do i make it break the x
dont want to copy paste, i figured a way out out a few moments after sending this shouldve put it as solved
I know it's solved, but i'll just leave this here for the future: PHP: /** * @param Position $position * @param int $radius * @param bool $includeAir * * @return array */public function getBlocksAroundPosition(Position $position, int $radius = 1, bool $includeAir = false): array{ $blocksAround = []; for($i = -$radius; $i < $radius; $i++){ for($j = -$radius; $j < $radius; $j++){ for($k = -$radius; $k < $radius; $k++){ $x = $position->x + $i; $y = $position->y + $j; $z = $position->z + $k; $block = $position->level->getBlockAt($x, $y, $z); if(($block instanceof Air) && $includeAir){ $blocksAround[] = $block; }elseif(!($block instanceof Air)){ $blocksAround[] = $block; } } } } return $blocksAround;}