Skip to content

Commit 07b4f41

Browse files
committed
Proper FastVector mesh
1 parent c650089 commit 07b4f41

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

common/src/main/kotlin/com/lambda/graphics/renderer/esp/DirectionMask.kt

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ package com.lambda.graphics.renderer.esp
1919

2020
import com.lambda.util.world.FastVector
2121
import com.lambda.util.world.offset
22+
import com.lambda.util.world.toBlockPos
23+
import com.lambda.util.world.toFastVec
2224
import net.minecraft.util.math.BlockPos
2325
import net.minecraft.util.math.Direction
2426

@@ -41,15 +43,8 @@ object DirectionMask {
4143
fun Int.exclude(direction: Direction) = exclude(direction.mask)
4244
fun Int.hasDirection(dir: Int) = (this and dir) != 0
4345

44-
fun buildSideMesh(position: BlockPos, filter: (BlockPos) -> Boolean): Int {
45-
var sides = ALL
46-
47-
Direction.entries
48-
.filter { filter(position.offset(it)) }
49-
.forEach { sides = sides.exclude(it.mask) }
50-
51-
return sides
52-
}
46+
fun buildSideMesh(position: BlockPos, filter: (BlockPos) -> Boolean) =
47+
buildSideMesh(position.toFastVec()) { filter(it.toBlockPos()) }
5348

5449
fun buildSideMesh(position: FastVector, filter: (FastVector) -> Boolean): Int {
5550
var sides = ALL

0 commit comments

Comments
 (0)