@@ -41,9 +41,11 @@ object BlockESP : Module(
4141 description = " Render block ESP" ,
4242 tag = ModuleTag .RENDER ,
4343) {
44- // ToDo: Toggle searching, solve memory leak
4544 private val searchBlocks by setting(" Search Blocks" , true , " Search for blocks around the player" )
46- private val blocks by setting(" Blocks" , setOf (Blocks .BEDROCK ), description = " Render blocks" ) { searchBlocks }.onValueChange(::rebuildMesh)
45+ private val blocks by setting(" Blocks" , setOf (Blocks .BEDROCK ), description = " Render blocks" ) { searchBlocks }
46+ .onSelect { rebuildMesh(this , null , null ) }
47+ .onDeselect { rebuildMesh(this , null , null ) }
48+
4749 private var drawFaces: Boolean by setting(" Draw Faces" , true , " Draw faces of blocks" ) { searchBlocks }.onValueChange(::rebuildMesh).onValueChange { _, to -> if (! to) drawOutlines = true }
4850 private var drawOutlines: Boolean by setting(" Draw Outlines" , true , " Draw outlines of blocks" ) { searchBlocks }.onValueChange(::rebuildMesh).onValueChange { _, to -> if (! to) drawFaces = true }
4951 private val mesh by setting(" Mesh" , true , " Connect similar adjacent blocks" ) { searchBlocks }.onValueChange(::rebuildMesh)
@@ -88,5 +90,5 @@ object BlockESP : Module(
8890 if (drawOutlines) outline(pos, state, if (useBlockColor) blockColor else outlineColor, sides, outlineMode)
8991 }
9092
91- private fun rebuildMesh (ctx : SafeContext , from : Any , to : Any ): Unit = esp.rebuild()
93+ private fun rebuildMesh (ctx : SafeContext , from : Any? , to : Any? ): Unit = esp.rebuild()
9294}
0 commit comments