Skip to content

Commit 469a44c

Browse files
committed
TaskFlow ESP fix
1 parent c726f0c commit 469a44c

File tree

5 files changed

+23
-21
lines changed

5 files changed

+23
-21
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ class ChunkedESP private constructor(
3333

3434
init {
3535
concurrentListener<WorldEvent.BlockUpdate> { event ->
36-
world.getWorldChunk(event.pos).renderer.notify()
36+
world.getWorldChunk(event.pos).renderer.notifyChunks()
3737
}
3838

3939
concurrentListener<WorldEvent.ChunkEvent.Load> { event ->
40-
event.chunk.renderer.notify()
40+
event.chunk.renderer.notifyChunks()
4141
}
4242

4343
concurrentListener<WorldEvent.ChunkEvent.Unload> { event ->
44-
rendererMap.remove(event.chunk.pos.toLong())?.notify()
44+
rendererMap.remove(event.chunk.pos.toLong())?.notifyChunks()
4545
}
4646

4747
owner.concurrentListener<TickEvent.Pre> {
@@ -86,7 +86,7 @@ class ChunkedESP private constructor(
8686
ChunkPos(chunk.pos.x + it.first, chunk.pos.z + it.second)
8787
}.toTypedArray()
8888

89-
fun notify() {
89+
fun notifyChunks() {
9090
neighbors.forEach {
9191
owner.rendererMap[it.toLong()]?.let {
9292
owner.rebuildQueue.apply {

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,9 @@ class EspRenderer(
227227
x: Double, y: Double, z: Double,
228228
color: Color
229229
) = lazy {
230-
val newVertex = {
230+
faceVertices.getOrPut(Vertex(x, y, z, color)) {
231231
vec3(x, y, z).color(color).end()
232232
}
233-
234-
if (RenderSettings.vertexMapping) {
235-
faceVertices.getOrPut(Vertex(x, y, z, color), newVertex)
236-
} else newVertex()
237233
}
238234

239235
data class Vertex(val x: Double, val y: Double, val z: Double, val color: Color)

common/src/main/kotlin/com/lambda/module/modules/client/RenderSettings.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ object RenderSettings : Module(
2121
// ESP
2222
val uploadsPerTick by setting("Uploads", 16, 1..256, 1, unit = " chunk/tick") { page == Page.ESP }
2323
val rebuildsPerTick by setting("Rebuilds", 64, 1..256, 1, unit = " chunk/tick") { page == Page.ESP }
24-
val vertexMapping by setting("Vertex Mapping", true) { page == Page.ESP }
2524
val updateFrequency by setting("Update Frequency", 2, 1..10, 1, "Frequency of block updates", unit = " ticks") { page == Page.ESP }
2625
val outlineWidth by setting("Outline Width", 1.0, 0.1..5.0, 0.1, "Width of block outlines", unit = "px") { page == Page.ESP }
2726

common/src/main/kotlin/com/lambda/module/modules/client/TaskFlow.kt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ package com.lambda.module.modules.client
33
import com.lambda.config.groups.InteractionSettings
44
import com.lambda.config.groups.BuildSettings
55
import com.lambda.config.groups.RotationSettings
6-
import com.lambda.graphics.renderer.esp.ChunkedESP.Companion.newChunkedESP
6+
import com.lambda.event.events.RenderEvent
7+
import com.lambda.event.events.TickEvent
8+
import com.lambda.event.listener.SafeListener.Companion.listener
79
import com.lambda.graphics.renderer.esp.EspRenderer
810
import com.lambda.module.Module
911
import com.lambda.module.tag.ModuleTag
@@ -39,4 +41,18 @@ object TaskFlow : Module(
3941
val esp by mainThread {
4042
EspRenderer()
4143
}
44+
45+
init {
46+
listener<TickEvent.Pre>(Int.MAX_VALUE) {
47+
esp.clear()
48+
}
49+
50+
listener<TickEvent.Post> {
51+
esp.upload()
52+
}
53+
54+
listener<RenderEvent.World> {
55+
esp.render()
56+
}
57+
}
4258
}

common/src/main/kotlin/com/lambda/task/tasks/BuildStructure.kt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ class BuildStructure @Ta5kBuilder constructor(
3232
private val cancelOnUnsolvable: Boolean = true,
3333
) : Task<Unit>() {
3434

35-
abstract class PathingStrategy {
36-
37-
}
35+
abstract class PathingStrategy
3836

3937
override fun SafeContext.onStart() {
4038
(blueprint as? DynamicBlueprint)?.create(this)
@@ -52,8 +50,6 @@ class BuildStructure @Ta5kBuilder constructor(
5250
val results = blueprint.simulate(player.getCameraPosVec(mc.tickDelta))
5351
val resBlock = results.associateBy { it.blockPos }
5452

55-
TaskFlow.esp.clear()
56-
5753
var sides = DirectionMask.ALL
5854

5955
resBlock.forEach { (pos, res) ->
@@ -69,7 +65,6 @@ class BuildStructure @Ta5kBuilder constructor(
6965
DirectionMask.OutlineMode.AND
7066
)
7167
}
72-
TaskFlow.esp.upload()
7368

7469
val instantResults = results.filterIsInstance<BreakResult.Success>()
7570
.filter { it.context.instantBreak }
@@ -104,10 +99,6 @@ class BuildStructure @Ta5kBuilder constructor(
10499
}
105100
}
106101
}
107-
108-
listener<RenderEvent.World> {
109-
TaskFlow.esp.render()
110-
}
111102
}
112103

113104
private fun SafeContext.checkDone() {

0 commit comments

Comments
 (0)