From cf18647e45afd41995bf1a06d1a0f9862e56e5fc Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:45:18 -0500 Subject: Refactor Relics --- .../skyblocker/skyblock/waypoint/FairySouls.java | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock/waypoint/FairySouls.java') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/waypoint/FairySouls.java b/src/main/java/de/hysky/skyblocker/skyblock/waypoint/FairySouls.java index c3cd6fe2..f0e94770 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/waypoint/FairySouls.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/waypoint/FairySouls.java @@ -12,7 +12,6 @@ import de.hysky.skyblocker.utils.Constants; import de.hysky.skyblocker.utils.NEURepoManager; import de.hysky.skyblocker.utils.PosUtils; import de.hysky.skyblocker.utils.Utils; -import de.hysky.skyblocker.utils.render.RenderHelper; import de.hysky.skyblocker.utils.waypoint.ProfileAwareWaypoint; import de.hysky.skyblocker.utils.waypoint.Waypoint; import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; @@ -97,18 +96,18 @@ public class FairySouls { } private static void saveFoundFairySouls(MinecraftClient client) { - try (BufferedWriter writer = Files.newBufferedWriter(SkyblockerMod.CONFIG_DIR.resolve("found_fairy_souls.json"))) { - Map>> foundFairies = new HashMap<>(); - for (Map.Entry> fairiesForLocation : fairySouls.entrySet()) { - for (ProfileAwareWaypoint fairySoul : fairiesForLocation.getValue().values()) { - for (String profile : fairySoul.foundProfiles) { - foundFairies.putIfAbsent(profile, new HashMap<>()); - foundFairies.get(profile).putIfAbsent(fairiesForLocation.getKey(), new HashSet<>()); - foundFairies.get(profile).get(fairiesForLocation.getKey()).add(fairySoul.pos); - } + Map>> foundFairies = new HashMap<>(); + for (Map.Entry> fairiesForLocation : fairySouls.entrySet()) { + for (ProfileAwareWaypoint fairySoul : fairiesForLocation.getValue().values()) { + for (String profile : fairySoul.foundProfiles) { + foundFairies.computeIfAbsent(profile, profile_ -> new HashMap<>()); + foundFairies.get(profile).computeIfAbsent(fairiesForLocation.getKey(), location_ -> new HashSet<>()); + foundFairies.get(profile).get(fairiesForLocation.getKey()).add(fairySoul.pos); } } + } + try (BufferedWriter writer = Files.newBufferedWriter(SkyblockerMod.CONFIG_DIR.resolve("found_fairy_souls.json"))) { JsonObject foundFairiesJson = new JsonObject(); for (Map.Entry>> foundFairiesForProfile : foundFairies.entrySet()) { JsonObject foundFairiesForProfileJson = new JsonObject(); @@ -152,8 +151,7 @@ public class FairySouls { if (!fairySoulsConfig.highlightFoundSouls && !fairySoulNotFound || fairySoulsConfig.highlightOnlyNearbySouls && fairySoul.pos.getSquaredDistance(context.camera().getPos()) > 2500) { continue; } - float[] colorComponents = fairySoulNotFound ? DyeColor.GREEN.getColorComponents() : DyeColor.RED.getColorComponents(); - RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, fairySoul.pos, colorComponents, 0.5F); + fairySoul.render(context); } } } @@ -184,7 +182,7 @@ public class FairySouls { .filter(Waypoint::shouldRender) .min(Comparator.comparingDouble(fairySoul -> fairySoul.pos.getSquaredDistance(player.getPos()))) .filter(fairySoul -> fairySoul.pos.getSquaredDistance(player.getPos()) <= 16) - .ifPresent(ProfileAwareWaypoint::setFound); + .ifPresent(Waypoint::setFound); } public static void markAllFairiesOnCurrentIslandFound() { -- cgit