Skip to content

Commit

Permalink
fix: inverted function (CCBlueX#4259)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccetl authored Oct 26, 2024
1 parent 37b8126 commit 6971377
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ inline fun searchBlocksInRadius(
@Suppress("NestedBlockDepth")
fun BlockPos.getSphere(radius: Float): Sequence<DoubleObjectPair<BlockPos>> = sequence {
val radiusSq = radius * radius

val radiusCeil = MathHelper.ceil(radius)

val range = radiusCeil downTo -radiusCeil
Expand All @@ -208,7 +207,7 @@ fun BlockPos.getSphere(radius: Float): Sequence<DoubleObjectPair<BlockPos>> = se
for (y in range) {
for (z in range) {
val distanceSq = getSquaredDistance(x.toDouble(), y.toDouble(), z.toDouble())
if (distanceSq <= radiusSq) {
if (distanceSq > radiusSq) {
continue
}

Expand Down

0 comments on commit 6971377

Please sign in to comment.