diff options
Diffstat (limited to 'src')
3 files changed, 27 insertions, 11 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java index 4225c698..58fc690c 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java @@ -314,6 +314,8 @@ public class SkyblockerConfig implements ConfigData { public static class FairySouls { public boolean enableFairySoulsHelper = false; + public boolean highlightFoundSouls = true; + public boolean highlightOnlyNearbySouls = false; } public static class Shortcuts { diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/FairySouls.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/FairySouls.java index ab6fa767..e6b75152 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/FairySouls.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/FairySouls.java @@ -85,6 +85,7 @@ public class FairySouls { LOGGER.error("Encountered unknown exception loading fairy souls", e); } }); + ClientLifecycleEvents.CLIENT_STOPPING.register(FairySouls::saveFoundFairySouls); WorldRenderEvents.AFTER_TRANSLUCENT.register(FairySouls::render); ClientReceiveMessageEvents.GAME.register(FairySouls::onChatMessage); @@ -130,15 +131,21 @@ public class FairySouls { } public static void render(WorldRenderContext context) { - if (SkyblockerConfig.get().general.fairySouls.enableFairySoulsHelper && fairySoulsLoaded.isDone() && fairySouls.containsKey(Utils.getLocationRaw())) { - for (BlockPos fairySoul : fairySouls.get(Utils.getLocationRaw())) { - float[] colorComponents = isFairySoulNotFound(fairySoul) ? DyeColor.GREEN.getColorComponents() : DyeColor.RED.getColorComponents(); - RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, fairySoul, colorComponents, 0.5F); + SkyblockerConfig.FairySouls fairySoulsConfig = SkyblockerConfig.get().general.fairySouls; + + if (fairySoulsConfig.enableFairySoulsHelper && fairySoulsLoaded.isDone() && fairySouls.containsKey(Utils.getLocationRaw())) { + for (BlockPos fairySoulPos : fairySouls.get(Utils.getLocationRaw())) { + boolean fairySoulNotFound = isFairySoulNotFound(fairySoulPos); + if (!fairySoulsConfig.highlightFoundSouls && !fairySoulNotFound || fairySoulsConfig.highlightOnlyNearbySouls && fairySoulPos.getSquaredDistance(context.camera().getPos()) > 2500) { + continue; + } + float[] colorComponents = fairySoulNotFound ? DyeColor.GREEN.getColorComponents() : DyeColor.RED.getColorComponents(); + RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, fairySoulPos, colorComponents, 0.5F); } } } - private static boolean isFairySoulNotFound(BlockPos fairySoul) { + private static boolean isFairySoulNotFound(BlockPos fairySoulPos) { Map<String, Set<BlockPos>> foundFairiesForProfile = foundFairies.get(Utils.getProfile()); if (foundFairiesForProfile == null) { return true; @@ -147,12 +154,12 @@ public class FairySouls { if (foundFairiesForProfileAndLocation == null) { return true; } - return !foundFairiesForProfileAndLocation.contains(fairySoul); + return !foundFairiesForProfileAndLocation.contains(fairySoulPos); } public static void onChatMessage(Text text, boolean overlay) { String message = text.getString(); - if (message.equals("You have already found that Fairy Soul!") || message.equals("SOUL! You found a Fairy Soul!")) { + if (message.equals("You have already found that Fairy Soul!") || message.equals("§d§lSOUL! §fYou found a §dFairy Soul§f!")) { markClosestFairyFound(); } } @@ -163,10 +170,14 @@ public class FairySouls { LOGGER.warn("Failed to mark closest fairy soul as found because player is null."); return; } - fairySouls.get(Utils.getLocationRaw()).stream().filter(FairySouls::isFairySoulNotFound).min(Comparator.comparingDouble(fairySoul -> fairySoul.getSquaredDistance(player.getPos()))).ifPresent(fairySoul -> { - initializeFoundFairiesForCurrentProfileAndLocation(); - foundFairies.get(Utils.getProfile()).get(Utils.getLocationRaw()).add(fairySoul); - }); + fairySouls.get(Utils.getLocationRaw()).stream() + .filter(FairySouls::isFairySoulNotFound) + .min(Comparator.comparingDouble(fairySoulPos -> fairySoulPos.getSquaredDistance(player.getPos()))) + .filter(fairySoulPos -> fairySoulPos.getSquaredDistance(player.getPos()) <= 16) + .ifPresent(fairySoulPos -> { + initializeFoundFairiesForCurrentProfileAndLocation(); + foundFairies.get(Utils.getProfile()).get(Utils.getLocationRaw()).add(fairySoulPos); + }); } public static void markAllFairiesFound() { diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 974379af..cdaa7602 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -30,6 +30,9 @@ "text.autoconfig.skyblocker.option.general.fishing.enableFishingHelper": "Enable Fishing Helper", "text.autoconfig.skyblocker.option.general.fairySouls": "Fairy Souls Helper", "text.autoconfig.skyblocker.option.general.fairySouls.enableFairySoulsHelper": "Enable Fairy Souls Helper", + "text.autoconfig.skyblocker.option.general.fairySouls.highlightFoundSouls": "Highlight found fairy souls", + "text.autoconfig.skyblocker.option.general.fairySouls.highlightOnlyNearbySouls": "Only highlight nearby fairy souls", + "text.autoconfig.skyblocker.option.general.fairySouls.highlightOnlyNearbySouls.@Tooltip": "When enabled only fairy souls in a radius of 50 blocks are highlighted", "text.autoconfig.skyblocker.option.general.shortcuts": "Shortcuts", "text.autoconfig.skyblocker.option.general.shortcuts.enableShortcuts": "Enable Shortcuts", "text.autoconfig.skyblocker.option.general.shortcuts.enableShortcuts.@Tooltip": "Only works on Hypixel. Edit shortcuts with \"/skyblocker shortcuts\". At least one of the following options must be enabled for this to take effect.", |