aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker/utils/waypoint
diff options
context:
space:
mode:
authorKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2023-11-13 18:28:15 -0500
committerKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2023-11-17 10:27:40 -0500
commit4f04a35ae3300656a4ef92e0a62304d58aa582a2 (patch)
treede071ef76e47c49a2813e18d80f484b170fe1a63 /src/main/java/de/hysky/skyblocker/utils/waypoint
parente440bb72d80da655d99a35a618230036883b6e0b (diff)
downloadSkyblocker-4f04a35ae3300656a4ef92e0a62304d58aa582a2.tar.gz
Skyblocker-4f04a35ae3300656a4ef92e0a62304d58aa582a2.tar.bz2
Skyblocker-4f04a35ae3300656a4ef92e0a62304d58aa582a2.zip
Add Profile Aware Waypoint
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/utils/waypoint')
-rw-r--r--src/main/java/de/hysky/skyblocker/utils/waypoint/ProfileAwareWaypoint.java44
-rw-r--r--src/main/java/de/hysky/skyblocker/utils/waypoint/Waypoint.java12
2 files changed, 53 insertions, 3 deletions
diff --git a/src/main/java/de/hysky/skyblocker/utils/waypoint/ProfileAwareWaypoint.java b/src/main/java/de/hysky/skyblocker/utils/waypoint/ProfileAwareWaypoint.java
new file mode 100644
index 00000000..7aa99d14
--- /dev/null
+++ b/src/main/java/de/hysky/skyblocker/utils/waypoint/ProfileAwareWaypoint.java
@@ -0,0 +1,44 @@
+package de.hysky.skyblocker.utils.waypoint;
+
+import de.hysky.skyblocker.utils.Utils;
+import net.minecraft.util.math.BlockPos;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.function.Supplier;
+
+public class ProfileAwareWaypoint extends Waypoint {
+ public final Set<String> foundProfiles = new HashSet<>();
+ private final float[] missingColor;
+ private final float[] foundColor;
+
+ public ProfileAwareWaypoint(BlockPos pos, Supplier<Type> typeSupplier, float[] missingColor, float[] foundColor) {
+ super(pos, typeSupplier, null);
+ this.missingColor = missingColor;
+ this.foundColor = foundColor;
+ }
+
+ @Override
+ public boolean shouldRender() {
+ return !foundProfiles.contains(Utils.getProfile());
+ }
+
+ @Override
+ public void setFound() {
+ foundProfiles.add(Utils.getProfile());
+ }
+
+ public void setFound(String profile) {
+ foundProfiles.add(profile);
+ }
+
+ @Override
+ public void setMissing() {
+ foundProfiles.remove(Utils.getProfile());
+ }
+
+ @Override
+ protected float[] getColorComponents() {
+ return foundProfiles.contains(Utils.getProfile()) ? foundColor : missingColor;
+ }
+}
diff --git a/src/main/java/de/hysky/skyblocker/utils/waypoint/Waypoint.java b/src/main/java/de/hysky/skyblocker/utils/waypoint/Waypoint.java
index a8e62a94..f65e20f7 100644
--- a/src/main/java/de/hysky/skyblocker/utils/waypoint/Waypoint.java
+++ b/src/main/java/de/hysky/skyblocker/utils/waypoint/Waypoint.java
@@ -62,19 +62,25 @@ public class Waypoint {
this.shouldRender = true;
}
+ protected float[] getColorComponents() {
+ return colorComponents;
+ }
+
public void render(WorldRenderContext context) {
switch (typeSupplier.get()) {
- case WAYPOINT -> RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, colorComponents, alpha);
+ case WAYPOINT -> RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, getColorComponents(), alpha);
case OUTLINED_WAYPOINT -> {
+ float[] colorComponents = getColorComponents();
RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, colorComponents, alpha);
RenderHelper.renderOutline(context, box, colorComponents, lineWidth, throughWalls);
}
- case HIGHLIGHT -> RenderHelper.renderFilledThroughWalls(context, pos, colorComponents, alpha);
+ case HIGHLIGHT -> RenderHelper.renderFilledThroughWalls(context, pos, getColorComponents(), alpha);
case OUTLINED_HIGHLIGHT -> {
+ float[] colorComponents = getColorComponents();
RenderHelper.renderFilledThroughWalls(context, pos, colorComponents, alpha);
RenderHelper.renderOutline(context, box, colorComponents, lineWidth, throughWalls);
}
- case OUTLINE -> RenderHelper.renderOutline(context, box, colorComponents, lineWidth, throughWalls);
+ case OUTLINE -> RenderHelper.renderOutline(context, box, getColorComponents(), lineWidth, throughWalls);
}
}