diff options
author | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2023-11-13 18:45:18 -0500 |
---|---|---|
committer | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2023-11-17 10:27:40 -0500 |
commit | cf18647e45afd41995bf1a06d1a0f9862e56e5fc (patch) | |
tree | 3d4108da39aa3bcb147a600c4476e5f9484493b2 /src/main/java/de/hysky/skyblocker/skyblock/waypoint/FairySouls.java | |
parent | 4f04a35ae3300656a4ef92e0a62304d58aa582a2 (diff) | |
download | Skyblocker-cf18647e45afd41995bf1a06d1a0f9862e56e5fc.tar.gz Skyblocker-cf18647e45afd41995bf1a06d1a0f9862e56e5fc.tar.bz2 Skyblocker-cf18647e45afd41995bf1a06d1a0f9862e56e5fc.zip |
Refactor Relics
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/skyblock/waypoint/FairySouls.java')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/waypoint/FairySouls.java | 24 |
1 files changed, 11 insertions, 13 deletions
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<String, Map<String, Set<BlockPos>>> foundFairies = new HashMap<>(); - for (Map.Entry<String, Map<BlockPos, ProfileAwareWaypoint>> 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<String, Map<String, Set<BlockPos>>> foundFairies = new HashMap<>(); + for (Map.Entry<String, Map<BlockPos, ProfileAwareWaypoint>> 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<String, Map<String, Set<BlockPos>>> 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() { |