Skip to content

Commit

Permalink
Fix null check for wrappedGoal in goal evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
SihenZhang committed Dec 24, 2024
1 parent 0b2b384 commit 3784c81
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ public static void onAnimalAppear(EntityJoinLevelEvent event) {
var hasTemptGoal = false;
var hasEatGoal = false;
for (var wrappedGoal : animal.goalSelector.getAvailableGoals()) {
var goal = wrappedGoal.getGoal();
hasTemptGoal = hasTemptGoal || isTemptGoal(goal);
hasEatGoal = hasEatGoal || isEatGoal(goal);
if (wrappedGoal != null) {
var goal = wrappedGoal.getGoal();
hasTemptGoal = hasTemptGoal || isTemptGoal(goal);
hasEatGoal = hasEatGoal || isEatGoal(goal);
}
}
// Avoid adding duplicate TemptGoal
if (!hasTemptGoal) {
Expand Down

0 comments on commit 3784c81

Please sign in to comment.