From 7250fe2e35008876b6c7b88720ff36923bab39b1 Mon Sep 17 00:00:00 2001 From: cheaterpaul Date: Sat, 26 Oct 2024 09:23:16 +0200 Subject: [PATCH] make sure path is not null in case MeleeAttackGoal set it to null fix #1443 --- .../vampirism/entity/ai/goals/AttackMeleeNoSunGoal.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/de/teamlapen/vampirism/entity/ai/goals/AttackMeleeNoSunGoal.java b/src/main/java/de/teamlapen/vampirism/entity/ai/goals/AttackMeleeNoSunGoal.java index 0a91dfae2..b11dc498d 100644 --- a/src/main/java/de/teamlapen/vampirism/entity/ai/goals/AttackMeleeNoSunGoal.java +++ b/src/main/java/de/teamlapen/vampirism/entity/ai/goals/AttackMeleeNoSunGoal.java @@ -40,6 +40,12 @@ public boolean canUse() { if (avoidSun) { Path path = ((MeleeAttackGoalAccessor) this).getPath(); + + //for some reason the path is null in some cases + if (path == null) { + return false; + } + if (mob.getCommandSenderWorld().canSeeSkyFromBelowWater(new BlockPos(Mth.floor(this.mob.getX()), (int) (this.mob.getBoundingBox().minY + 0.5D), Mth.floor(this.mob.getZ())))) { return false; }