aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker/skyblock/waypoint
diff options
context:
space:
mode:
authorAaron <51387595+AzureAaron@users.noreply.github.com>2024-04-05 03:54:47 -0400
committerAaron <51387595+AzureAaron@users.noreply.github.com>2024-04-05 03:54:47 -0400
commit9d7f6aeb1fa157d4b0ba07c22aec07ea8cfb0ca1 (patch)
tree9668f9eb89a723ccdce7da5e4dab2d9660d8a6eb /src/main/java/de/hysky/skyblocker/skyblock/waypoint
parent8585afb20fb11d9349a3b9e079e037301c11c602 (diff)
downloadSkyblocker-9d7f6aeb1fa157d4b0ba07c22aec07ea8cfb0ca1.tar.gz
Skyblocker-9d7f6aeb1fa157d4b0ba07c22aec07ea8cfb0ca1.tar.bz2
Skyblocker-9d7f6aeb1fa157d4b0ba07c22aec07ea8cfb0ca1.zip
Fix line rendering & fix colour components
Co-authored-by: olim <bobq4582@gmail.com>
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/skyblock/waypoint')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/waypoint/OrderedWaypoints.java27
1 files changed, 2 insertions, 25 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/waypoint/OrderedWaypoints.java b/src/main/java/de/hysky/skyblocker/skyblock/waypoint/OrderedWaypoints.java
index 7f9e1ba2..93c6b3f4 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/waypoint/OrderedWaypoints.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/waypoint/OrderedWaypoints.java
@@ -138,7 +138,7 @@ public class OrderedWaypoints {
}
int rgb = hex != null ? Integer.decode("0x" + hex.replace("#", "")) : Integer.MIN_VALUE;
- float[] colorComponents = rgb != Integer.MIN_VALUE ? new float[] { (rgb >> 16) & 0xFF, (rgb >> 8) & 0xFF, rgb & 0xFF } : new float[0];
+ float[] colorComponents = rgb != Integer.MIN_VALUE ? new float[] { ((rgb >> 16) & 0xFF) / 255f, ((rgb >> 8) & 0xFF) / 255f, (rgb & 0xFF) / 255f } : new float[0];
OrderedWaypointGroup group = WAYPOINTS.computeIfAbsent(groupName, name -> new OrderedWaypointGroup(name, true, new ObjectArrayList<>()));
OrderedWaypoint waypoint = new OrderedWaypoint(pos, colorComponents);
@@ -247,11 +247,7 @@ public class OrderedWaypoints {
current.render(wrc, RelativeIndex.CURRENT, currentIndex);
next.render(wrc, RelativeIndex.NEXT, nextIndex);
- //Chunk the line
- //Idk why but the line is glitchy when moving sideways
- Vec3d[] line = splitLine(player.getPos().add(0, 1, 0), Vec3d.ofCenter(next.getPos().up()));
-
- RenderHelper.renderLinesFromPoints(wrc, line, LIGHT_GRAY, 1f, 5f, true);
+ RenderHelper.renderLineFromCursor(wrc, Vec3d.ofCenter(next.getPos().up()), LIGHT_GRAY, 1f, 5f);
}
}
@@ -259,25 +255,6 @@ public class OrderedWaypoints {
}
}
- private static Vec3d[] splitLine(Vec3d start, Vec3d end) {
- ObjectArrayList<Vec3d> segments = new ObjectArrayList<>();
-
- Vec3d direction = end.subtract(start).normalize();
- double length = start.subtract(end).length();
- int numSegments = (int) Math.ceil(length);
-
- Vec3d currentPoint = start;
-
- for (int i = 0; i < numSegments; i++) {
- segments.add(currentPoint);
- currentPoint = currentPoint.add(direction);
- }
-
- segments.add(end);
-
- return segments.toArray(Vec3d[]::new);
- }
-
private static void load() {
loaded = CompletableFuture.runAsync(() -> {
try (BufferedReader reader = Files.newBufferedReader(PATH)) {