use of net.minecraft.world.entity.ai.goal.Goal in project MagicPlugin by elBukkit.
the class MagicGoal method getSubDescription.
protected String getSubDescription() {
List<String> goalDescriptions = new ArrayList<>();
for (Goal goal : goals) {
String goalDescription = goal.toString();
if (goal == currentGoal) {
goalDescription = ChatColor.AQUA + goalDescription;
} else {
goalDescription = ChatColor.DARK_AQUA + goalDescription;
}
goalDescriptions.add(goalDescription);
}
return ChatColor.DARK_GRAY + " [" + StringUtils.join(goalDescriptions, " ") + ChatColor.DARK_GRAY + "]";
}
use of net.minecraft.world.entity.ai.goal.Goal in project MagicPlugin by elBukkit.
the class MagicGoal method canContinueToUse.
@Override
public boolean canContinueToUse() {
boolean interrupt = false;
boolean continuing = false;
for (Goal goal : goals) {
if (goal == currentGoal) {
boolean canContinue = goal.canContinueToUse();
if (canContinue) {
continuing = true;
} else {
interrupt = true;
}
} else {
// A higher-priority goal can interrupt
boolean canUse = goal.canUse();
if (canUse && !continuing && (currentGoal == null || currentGoal.isInterruptable())) {
interrupt = true;
}
}
if (interrupt) {
return false;
}
}
return true;
}
use of net.minecraft.world.entity.ai.goal.Goal in project MagicPlugin by elBukkit.
the class MobUtils method getGoalDescriptions.
protected Collection<String> getGoalDescriptions(GoalSelector selector) {
List<String> descriptions = new ArrayList<>();
Collection<WrappedGoal> available = selector.getAvailableGoals();
for (WrappedGoal wrappedGoal : available) {
Goal goal = wrappedGoal.getGoal();
String description = goal.toString();
String parentDescription = getGoalParentDescriptions(goal);
if (parentDescription != null) {
description += " " + parentDescription;
}
if (wrappedGoal.isRunning()) {
description = ChatColor.AQUA + description;
} else {
description = ChatColor.GOLD + description;
}
descriptions.add(ChatColor.BLUE + Integer.toString(wrappedGoal.getPriority()) + ChatColor.DARK_GRAY + ": " + description);
}
return descriptions;
}
Aggregations