use of net.minecraft.entity.ai.goal.FleeSunGoal in project Champions by TheIllusiveC4.
the class MoltenAffix method onSpawn.
@Override
public void onSpawn(IChampion champion) {
LivingEntity livingEntity = champion.getLivingEntity();
livingEntity.addPotionEffect(new EffectInstance(Effects.FIRE_RESISTANCE, 40, 0, true, false));
if (livingEntity instanceof MobEntity) {
MobEntity mobEntity = (MobEntity) livingEntity;
mobEntity.setPathPriority(PathNodeType.WATER, -1.0F);
mobEntity.setPathPriority(PathNodeType.LAVA, 8.0F);
mobEntity.setPathPriority(PathNodeType.DANGER_FIRE, 0.0F);
mobEntity.setPathPriority(PathNodeType.DAMAGE_FIRE, 0.0F);
try {
@SuppressWarnings("unchecked") Set<PrioritizedGoal> goals = (Set<PrioritizedGoal>) GOALS.get(mobEntity.goalSelector);
Iterator<PrioritizedGoal> iter = goals.iterator();
while (iter.hasNext()) {
PrioritizedGoal goal = iter.next();
Goal baseGoal = goal.getGoal();
if (baseGoal instanceof FleeSunGoal || baseGoal instanceof RestrictSunGoal) {
iter.remove();
}
}
} catch (Exception e) {
Champions.LOGGER.error("Error accessing goals!");
}
if (mobEntity.getNavigator() instanceof GroundPathNavigator) {
((GroundPathNavigator) mobEntity.getNavigator()).setAvoidSun(false);
}
}
}
Aggregations