searchBlocksInRangeSorted

inline fun Vec3.searchBlocksInRangeSorted(range: Float, shapeGetter: ClipContext.ShapeGetter = ClipContext.Block.OUTLINE, collisionContext: CollisionContext = CollisionContext.of(player), crossinline filter: (BlockPos, BlockState) -> Boolean): List<Pair<BlockPos, BlockState>>

Scan blocks around the position in a cuboid, filtered and sorted by shape distance from this Vec3. Distance calculation is based on outline shape: shapeGetter.get(state, level, pos, collisionContext).move(pos).distanceToSqr(eyesPos).

Return

pairs of BlockPos and its BlockState, sorted by distance to the center