Skip to content

Commit fc86013

Browse files
committed
Funny path renderer
1 parent 314dd36 commit fc86013

File tree

1 file changed

+25
-4
lines changed
  • common/src/main/kotlin/com/lambda/pathing

1 file changed

+25
-4
lines changed

common/src/main/kotlin/com/lambda/pathing/Path.kt

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,17 @@
1717

1818
package com.lambda.pathing
1919

20-
import com.lambda.graphics.renderer.esp.builders.buildLine
20+
import com.lambda.graphics.renderer.esp.builders.ofBox
2121
import com.lambda.graphics.renderer.esp.global.StaticESP
2222
import com.lambda.pathing.move.Move
2323
import com.lambda.util.collections.updatableLazy
24+
import com.lambda.util.math.component1
25+
import com.lambda.util.math.component2
26+
import com.lambda.util.math.component3
27+
import com.lambda.util.math.setAlpha
2428
import com.lambda.util.world.dist
2529
import com.lambda.util.world.toBlockPos
30+
import net.minecraft.util.math.Box
2631
import java.awt.Color
2732

2833
data class Path(
@@ -44,9 +49,25 @@ data class Path(
4449

4550
fun render(renderer: StaticESP, color: Color) {
4651
moves.zipWithNext { current, next ->
47-
val currentPos = current.pos.toBlockPos().toCenterPos()
48-
val nextPos = next.pos.toBlockPos().toCenterPos()
49-
renderer.buildLine(currentPos, nextPos, color)
52+
val start = current.pos.toBlockPos().toCenterPos()
53+
val end = next.pos.toBlockPos().toCenterPos()
54+
val direction = end.subtract(start)
55+
val distance = direction.length()
56+
if (distance <= 0) return@zipWithNext
57+
58+
val stepSize = 0.2
59+
val steps = (distance / stepSize).toInt()
60+
val stepDirection = direction.normalize().multiply(stepSize)
61+
62+
var currentPos = start
63+
64+
(0 until steps).forEach { _ ->
65+
val (x, y, z) = currentPos
66+
val d = 0.03
67+
val box = Box(x - d, y - d, z - d, x + d, y + d, z + d)
68+
renderer.ofBox(box, color.brighter().setAlpha(0.25), color.darker())
69+
currentPos = currentPos.add(stepDirection)
70+
}
5071
}
5172
}
5273

0 commit comments

Comments
 (0)