Skip to content

Commit c11dd2f

Browse files
committed
feat: pass in voxels for static esp
1 parent 04c476c commit c11dd2f

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,45 @@ package com.lambda.graphics.renderer.esp.builders
2020
import com.lambda.graphics.renderer.esp.DirectionMask
2121
import com.lambda.graphics.renderer.esp.DirectionMask.hasDirection
2222
import com.lambda.graphics.renderer.esp.impl.StaticESPRenderer
23+
import com.lambda.threading.runSafe
24+
import com.lambda.util.BlockUtils.blockState
2325
import com.lambda.util.extension.max
2426
import com.lambda.util.extension.min
27+
import net.minecraft.block.BlockState
28+
import net.minecraft.util.math.BlockPos
2529
import net.minecraft.util.math.Box
30+
import net.minecraft.util.shape.VoxelShape
2631
import java.awt.Color
2732

33+
fun StaticESPRenderer.buildVoxel(
34+
pos: BlockPos,
35+
state: BlockState,
36+
color: Color,
37+
sides: Int = DirectionMask.ALL,
38+
) = runSafe {
39+
val shape = state.getOutlineShape(world, pos)
40+
buildVoxel(shape, color, sides)
41+
}
42+
43+
fun StaticESPRenderer.buildVoxel(
44+
pos: BlockPos,
45+
color: Color,
46+
sides: Int = DirectionMask.ALL,
47+
) = runSafe {
48+
val shape = pos.blockState(world).getOutlineShape(world, pos)
49+
buildVoxel(shape, color, sides)
50+
}
51+
52+
fun StaticESPRenderer.buildVoxel(
53+
shape: VoxelShape,
54+
color: Color,
55+
sides: Int = DirectionMask.ALL,
56+
) {
57+
shape.boundingBoxes
58+
.forEach { buildFilled(it, color, sides) }
59+
}
60+
61+
2862
fun StaticESPRenderer.build(
2963
box: Box,
3064
filledColor: Color,

0 commit comments

Comments
 (0)