use of net.minecraft.entity.ai.goal.RestrictSunGoal in project Vampirism by TeamLapen.
the class CurableConvertedCreature method registerGoalsC.
/**
* call in {@link CreatureEntity#registerGoals()}
*/
default void registerGoalsC() {
CreatureEntity entity = ((CreatureEntity) this);
entity.goalSelector.addGoal(1, new AvoidEntityGoal<>(entity, CreatureEntity.class, 10, 1, 1.1, VampirismAPI.factionRegistry().getPredicate(getFaction(), false, true, false, false, VReference.HUNTER_FACTION)));
entity.goalSelector.addGoal(4, new RestrictSunGoal(entity));
entity.targetSelector.addGoal(1, new HurtByTargetGoal(entity));
entity.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(entity, PlayerEntity.class, 5, true, false, VampirismAPI.factionRegistry().getPredicate(getFaction(), true, false, true, false, null)));
entity.targetSelector.addGoal(6, new NearestAttackableTargetGoal<>(entity, CreatureEntity.class, 5, true, false, VampirismAPI.factionRegistry().getPredicate(getFaction(), false, false, false, false, null)));
}
use of net.minecraft.entity.ai.goal.RestrictSunGoal 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