Skip to content

Commit fe004bd

Browse files
committed
ref: blockesp
1 parent e63ad91 commit fe004bd

File tree

1 file changed

+10
-10
lines changed
  • common/src/main/kotlin/com/lambda/module/modules/render

1 file changed

+10
-10
lines changed

common/src/main/kotlin/com/lambda/module/modules/render/BlockESP.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import com.lambda.util.extension.blockOutlineMesh
3333
import com.lambda.util.extension.getBlockState
3434
import com.lambda.util.world.fastVectorOf
3535
import com.lambda.util.world.toBlockPos
36-
import net.minecraft.block.Block
3736
import net.minecraft.block.BlockState
3837
import net.minecraft.block.Blocks
3938
import net.minecraft.client.render.model.BakedModel
@@ -45,18 +44,17 @@ object BlockESP : Module(
4544
description = "Render block ESP",
4645
defaultTags = setOf(ModuleTag.RENDER)
4746
) {
48-
private var drawFaces: Boolean by setting("Draw Faces", true, "Draw faces of blocks").apply { onValueSet { _, to -> esp.rebuild(); if (!to) drawOutlines = true } }
49-
private var drawOutlines: Boolean by setting("Draw Outlines", true, "Draw outlines of blocks").apply { onValueSet { _, to -> esp.rebuild(); if (!to) drawFaces = true } }
47+
private var drawFaces: Boolean by setting("Draw Faces", true, "Draw faces of blocks").apply { onValueSet(::rebuildMesh); onValueSet { _, to -> if (!to) drawOutlines = true } }
48+
private var drawOutlines: Boolean by setting("Draw Outlines", true, "Draw outlines of blocks").apply { onValueSet(::rebuildMesh); onValueSet { _, to -> if (!to) drawFaces = true } }
49+
private val mesh by setting("Mesh", true, "Connect similar adjacent blocks").apply { onValueSet(::rebuildMesh) }
5050

51-
private val useBlockColor: Boolean by setting("Use Block Color", false, "Use the color of the block instead").apply { onValueSet { _, _ -> esp.rebuild() } }
52-
private val faceColor: Color by setting("Face Color", Color(100, 150, 255, 51), "Color of the surfaces") { drawFaces && !useBlockColor }.apply { onValueSet { _, _ -> esp.rebuild() } }
53-
private val outlineColor: Color by setting("Outline Color", Color(100, 150, 255, 128), "Color of the outlines") { drawOutlines && !useBlockColor }.apply { onValueSet { _, _ -> esp.rebuild() } }
51+
private val useBlockColor by setting("Use Block Color", false, "Use the color of the block instead").apply { onValueSet(::rebuildMesh) }
52+
private val faceColor by setting("Face Color", Color(100, 150, 255, 51), "Color of the surfaces") { drawFaces && !useBlockColor }.apply { onValueSet(::rebuildMesh) }
53+
private val outlineColor by setting("Outline Color", Color(100, 150, 255, 128), "Color of the outlines") { drawOutlines && !useBlockColor }.apply { onValueSet(::rebuildMesh) }
5454

55-
private val outlineMode: DirectionMask.OutlineMode by setting("Outline Mode", DirectionMask.OutlineMode.AND, "Outline mode").apply { onValueSet { _, _ -> esp.rebuild() } }
55+
private val outlineMode by setting("Outline Mode", DirectionMask.OutlineMode.AND, "Outline mode").apply { onValueSet(::rebuildMesh) }
5656

57-
private val mesh: Boolean by setting("Mesh", true, "Connect similar adjacent blocks").apply { onValueSet { _, _ -> esp.rebuild() } }
58-
59-
private val blocks: Set<Block> by setting("Blocks", setOf(Blocks.BEDROCK), "Render blocks").apply { onValueSet { _, _ -> esp.rebuild() } }
57+
private val blocks by setting("Blocks", setOf(Blocks.BEDROCK), "Render blocks").apply { onValueSet(::rebuildMesh) }
6058

6159
@JvmStatic
6260
val barrier by setting("Solid Barrier Block", true, "Render barrier blocks")
@@ -100,4 +98,6 @@ object BlockESP : Module(
10098
if (drawFaces) buildFilledMesh(filledMesh, if (useBlockColor) blockColor else faceColor, sides)
10199
if (drawOutlines) buildOutlineMesh(outlineMesh, if (useBlockColor) blockColor else outlineColor, sides, outlineMode)
102100
}
101+
102+
private fun rebuildMesh(from: Any, to: Any): Unit = esp.rebuild()
103103
}

0 commit comments

Comments
 (0)