diff options
author | alexia <me@alexia.lol> | 2023-11-06 16:55:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-06 10:55:24 -0500 |
commit | 8731707bedea9ec7c59f9910214aec99cb4eab52 (patch) | |
tree | 24ebbf057aeb47008464e8c4a35dd35e022f137f /src/main | |
parent | 6768b769e99d9aef50a55ebe6f41dce091d29365 (diff) | |
download | Skyblocker-8731707bedea9ec7c59f9910214aec99cb4eab52.tar.gz Skyblocker-8731707bedea9ec7c59f9910214aec99cb4eab52.tar.bz2 Skyblocker-8731707bedea9ec7c59f9910214aec99cb4eab52.zip |
Fix fairy soul solver NPE if we can't connect to NEU repo (#409)
Co-authored-by: Kevin <92656833+kevinthegreat1@users.noreply.github.com>
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/FairySouls.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/FairySouls.java b/src/main/java/de/hysky/skyblocker/skyblock/FairySouls.java index 3e1220b0..e9bc3ebd 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/FairySouls.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/FairySouls.java @@ -153,12 +153,20 @@ public class FairySouls { private static void markClosestFairyFound() { if (!fairySoulsLoaded.isDone()) return; + PlayerEntity player = MinecraftClient.getInstance().player; if (player == null) { LOGGER.warn("[Skyblocker] Failed to mark closest fairy soul as found because player is null"); return; } - fairySouls.get(Utils.getLocationRaw()).stream() + + Set<BlockPos> fairiesOnCurrentIsland = fairySouls.get(Utils.getLocationRaw()); + if (fairiesOnCurrentIsland == null) { + LOGGER.warn("[Skyblocker] Failed to mark closest fairy soul as found because there are no fairy souls loaded on the current island. NEU repo probably failed to load."); + return; + } + + fairiesOnCurrentIsland.stream() .filter(FairySouls::isFairySoulMissing) .min(Comparator.comparingDouble(fairySoulPos -> fairySoulPos.getSquaredDistance(player.getPos()))) .filter(fairySoulPos -> fairySoulPos.getSquaredDistance(player.getPos()) <= 16) |