aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authoralexia <me@alexia.lol>2023-11-06 16:55:24 +0100
committerGitHub <noreply@github.com>2023-11-06 10:55:24 -0500
commit8731707bedea9ec7c59f9910214aec99cb4eab52 (patch)
tree24ebbf057aeb47008464e8c4a35dd35e022f137f /src/main
parent6768b769e99d9aef50a55ebe6f41dce091d29365 (diff)
downloadSkyblocker-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.java10
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)