public function getCollisionCubes(Entity $entity, AxisAlignedBB $bb, bool $entities = true) : array
{
$minX = Math::floorFloat($bb->minX);
$minY = Math::floorFloat($bb->minY);
$minZ = Math::floorFloat($bb->minZ);
$maxX = Math::ceilFloat($bb->maxX);
$maxY = Math::ceilFloat($bb->maxY);
$maxZ = Math::ceilFloat($bb->maxZ);
$collides = [];
for ($z = $minZ; $z <= $maxZ; ++$z) {
for ($x = $minX; $x <= $maxX; ++$x) {
for ($y = $minY; $y <= $maxY; ++$y) {
$block = $this->getBlock($this->temporalVector->setComponents($x, $y, $z));
if (!$block->canPassThrough() and $block->collidesWithBB($bb)) {
$collides[] = $block->getBoundingBox();
}
}
}
}
if ($entities) {
foreach ($this->getCollidingEntities($bb->grow(0.25, 0.25, 0.25), $entity) as $ent) {
$collides[] = clone $ent->boundingBox;
}
}
return $collides;
}