1818package com.lambda.module.modules.render
1919
2020import com.lambda.Lambda.mc
21+ import com.lambda.context.SafeContext
22+ import com.lambda.event.events.TickEvent
23+ import com.lambda.event.listener.SafeListener.Companion.listen
2124import com.lambda.graphics.pipeline.VertexBuilder
2225import com.lambda.graphics.renderer.esp.ChunkedESP.Companion.newChunkedESP
2326import com.lambda.graphics.renderer.esp.DirectionMask
@@ -26,9 +29,12 @@ import com.lambda.graphics.renderer.esp.ShapeBuilder
2629import com.lambda.module.Module
2730import com.lambda.module.tag.ModuleTag
2831import com.lambda.threading.runSafe
32+ import com.lambda.util.Communication.info
2933import com.lambda.util.extension.blockColor
3034import com.lambda.util.extension.getBlockState
3135import com.lambda.util.extension.outlineShape
36+ import com.lambda.util.world.blockSearch
37+ import com.lambda.util.world.distSq
3238import com.lambda.util.world.toBlockPos
3339import net.minecraft.block.BlockState
3440import net.minecraft.block.Blocks
@@ -41,17 +47,17 @@ object BlockESP : Module(
4147 description = " Render block ESP" ,
4248 tag = ModuleTag .RENDER ,
4349) {
44- private var drawFaces: Boolean by setting(" Draw Faces" , true , " Draw faces of blocks" ).onValueSet (::rebuildMesh).onValueSet { _, to -> if (! to) drawOutlines = true }
45- private var drawOutlines: Boolean by setting(" Draw Outlines" , true , " Draw outlines of blocks" ).onValueSet (::rebuildMesh).onValueSet { _, to -> if (! to) drawFaces = true }
46- private val mesh by setting(" Mesh" , true , " Connect similar adjacent blocks" ).onValueSet (::rebuildMesh)
50+ private var drawFaces: Boolean by setting(" Draw Faces" , true , " Draw faces of blocks" ).onValueChange (::rebuildMesh).onValueChange { _, to -> if (! to) drawOutlines = true }
51+ private var drawOutlines: Boolean by setting(" Draw Outlines" , true , " Draw outlines of blocks" ).onValueChange (::rebuildMesh).onValueChange { _, to -> if (! to) drawFaces = true }
52+ private val mesh by setting(" Mesh" , true , " Connect similar adjacent blocks" ).onValueChange (::rebuildMesh)
4753
48- private val useBlockColor by setting(" Use Block Color" , false , " Use the color of the block instead" ).onValueSet (::rebuildMesh)
49- private val faceColor by setting(" Face Color" , Color (100 , 150 , 255 , 51 ), " Color of the surfaces" ) { drawFaces && ! useBlockColor }.onValueSet (::rebuildMesh)
50- private val outlineColor by setting(" Outline Color" , Color (100 , 150 , 255 , 128 ), " Color of the outlines" ) { drawOutlines && ! useBlockColor }.onValueSet (::rebuildMesh)
54+ private val useBlockColor by setting(" Use Block Color" , false , " Use the color of the block instead" ).onValueChange (::rebuildMesh)
55+ private val faceColor by setting(" Face Color" , Color (100 , 150 , 255 , 51 ), " Color of the surfaces" ) { drawFaces && ! useBlockColor }.onValueChange (::rebuildMesh)
56+ private val outlineColor by setting(" Outline Color" , Color (100 , 150 , 255 , 128 ), " Color of the outlines" ) { drawOutlines && ! useBlockColor }.onValueChange (::rebuildMesh)
5157
52- private val outlineMode by setting(" Outline Mode" , DirectionMask .OutlineMode .AND , " Outline mode" ).onValueSet (::rebuildMesh)
58+ private val outlineMode by setting(" Outline Mode" , DirectionMask .OutlineMode .AND , " Outline mode" ).onValueChange (::rebuildMesh)
5359
54- private val blocks by setting(" Blocks" , setOf (Blocks .BEDROCK ), setOf (Blocks .BEDROCK ), " Render blocks" ).onValueSet (::rebuildMesh)
60+ private val blocks by setting(" Blocks" , setOf (Blocks .BEDROCK ), setOf (Blocks .BEDROCK ), " Render blocks" ).onValueChange (::rebuildMesh)
5561
5662 @JvmStatic
5763 val barrier by setting(" Solid Barrier Block" , true , " Render barrier blocks" )
@@ -63,12 +69,6 @@ object BlockESP : Module(
6369 @JvmStatic
6470 val model: BlockStateModel get() = mc.bakedModelManager.missingModel
6571
66- init {
67- onToggle {
68- if (barrier) mc.worldRenderer.reload()
69- }
70- }
71-
7272 private val esp = newChunkedESP { world, position ->
7373 val state = world.getBlockState(position)
7474 if (state.block !in blocks) return @newChunkedESP
@@ -94,5 +94,5 @@ object BlockESP : Module(
9494 if (drawOutlines) outline(shape, if (useBlockColor) blockColor else outlineColor, sides, outlineMode)
9595 }
9696
97- private fun rebuildMesh (from : Any , to : Any ): Unit = esp.rebuild()
97+ private fun rebuildMesh (ctx : SafeContext , from : Any , to : Any ): Unit = esp.rebuild()
9898}
0 commit comments