diff options
author | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2023-10-18 22:11:32 -0400 |
---|---|---|
committer | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2023-10-18 22:11:32 -0400 |
commit | 7773e425d3e2da1e4d4c0368be3067052f35139e (patch) | |
tree | b4dfd06e2fc2f705083e7822da607e0c051a6fb5 /src/main/java/de | |
parent | 343984a38fca6c1015b7230a5109fb3aaa6c15ef (diff) | |
download | Skyblocker-7773e425d3e2da1e4d4c0368be3067052f35139e.tar.gz Skyblocker-7773e425d3e2da1e4d4c0368be3067052f35139e.tar.bz2 Skyblocker-7773e425d3e2da1e4d4c0368be3067052f35139e.zip |
More Waypoint Customization
Diffstat (limited to 'src/main/java/de')
3 files changed, 38 insertions, 12 deletions
diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 6622fa83..d7279bc8 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -575,6 +575,9 @@ public class SkyblockerConfig { @SerialEntry public WaypointType waypointType = WaypointType.WAYPOINT; + + @SerialEntry + public boolean showSecretText = true; @SerialEntry public boolean enableEntranceWaypoints = true; @@ -609,15 +612,19 @@ public class SkyblockerConfig { public enum WaypointType { WAYPOINT, - OUTLINE, - OUTLINED_WAYPOINT; + OUTLINED_WAYPOINT, + HIGHLIGHT, + OUTLINED_HIGHLIGHT, + OUTLINE; @Override public String toString() { return switch (this) { case WAYPOINT -> "Waypoint"; - case OUTLINE -> "Outline"; case OUTLINED_WAYPOINT -> "Outlined Waypoint"; + case HIGHLIGHT -> "Highlight"; + case OUTLINED_HIGHLIGHT -> "Outlined Highlight"; + case OUTLINE -> "Outline"; }; } } diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java index 89ac6f8e..7b32cb78 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java @@ -53,6 +53,13 @@ public class DungeonsCategory { .controller(ConfigUtils::createEnumCyclingListController) .build()) .option(Option.<Boolean>createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.showSecretText")) + .binding(defaults.locations.dungeons.secretWaypoints.showSecretText, + () -> config.locations.dungeons.secretWaypoints.showSecretText, + newValue -> config.locations.dungeons.secretWaypoints.showSecretText = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) + .option(Option.<Boolean>createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableEntranceWaypoints")) .binding(defaults.locations.dungeons.secretWaypoints.enableEntranceWaypoints, () -> config.locations.dungeons.secretWaypoints.enableEntranceWaypoints, diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java index 9fc2e778..0d9bdff1 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java @@ -18,6 +18,8 @@ import java.util.function.Predicate; import java.util.function.ToDoubleFunction; public class SecretWaypoint { + private static final float HIGHLIGHT_ALPHA = 0.5f; + private static final float LINE_WIDTH = 5f; static final List<String> SECRET_ITEMS = List.of("Decoy", "Defuse Kit", "Dungeon Chest Key", "Healing VIII", "Inflatable Jerry", "Spirit Leap", "Training Weights", "Trap", "Treasure Talisman"); final int secretIndex; final Category category; @@ -75,19 +77,29 @@ public class SecretWaypoint { * Renders the secret waypoint, including a filled cube, a beacon beam, the name, and the distance from the player. */ void render(WorldRenderContext context) { - switch (SkyblockerConfigManager.get().locations.dungeons.secretWaypoints.waypointType) { - case WAYPOINT -> RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, category.colorComponents, 0.5F); - case OUTLINE -> RenderHelper.renderOutline(context, new Box(pos), category.colorComponents, 5F, true); + SkyblockerConfig.SecretWaypoints config = SkyblockerConfigManager.get().locations.dungeons.secretWaypoints; + + switch (config.waypointType) { + case WAYPOINT -> RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, category.colorComponents, HIGHLIGHT_ALPHA); case OUTLINED_WAYPOINT -> { - RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, category.colorComponents, 0.5F); - RenderHelper.renderOutline(context, new Box(pos), category.colorComponents, 5F, true); + RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, category.colorComponents, HIGHLIGHT_ALPHA); + RenderHelper.renderOutline(context, new Box(pos), category.colorComponents, LINE_WIDTH, true); + } + case HIGHLIGHT -> RenderHelper.renderFilledThroughWalls(context, pos, category.colorComponents, HIGHLIGHT_ALPHA); + case OUTLINED_HIGHLIGHT -> { + RenderHelper.renderFilledThroughWalls(context, pos, category.colorComponents, HIGHLIGHT_ALPHA); + RenderHelper.renderOutline(context, new Box(pos), category.colorComponents, LINE_WIDTH, true); } + //TODO In the future, shrink the box for wither essence and items so its more realistic + case OUTLINE -> RenderHelper.renderOutline(context, new Box(pos), category.colorComponents, LINE_WIDTH, true); } - Vec3d posUp = centerPos.add(0, 1, 0); - RenderHelper.renderText(context, name, posUp, true); - double distance = context.camera().getPos().distanceTo(centerPos); - RenderHelper.renderText(context, Text.literal(Math.round(distance) + "m").formatted(Formatting.YELLOW), posUp, 1, MinecraftClient.getInstance().textRenderer.fontHeight + 1, true); + if (config.showSecretText) { + Vec3d posUp = centerPos.add(0, 1, 0); + RenderHelper.renderText(context, name, posUp, true); + double distance = context.camera().getPos().distanceTo(centerPos); + RenderHelper.renderText(context, Text.literal(Math.round(distance) + "m").formatted(Formatting.YELLOW), posUp, 1, MinecraftClient.getInstance().textRenderer.fontHeight + 1, true); + } } enum Category { |