diff options
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/utils')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/utils/waypoint/ProfileAwareWaypoint.java | 44 | ||||
-rw-r--r-- | src/main/java/de/hysky/skyblocker/utils/waypoint/Waypoint.java | 12 |
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); } } |