use of com.jacob_vejvoda.infernal_mobs.Helper in project InfernalMobs by NyaaCat.
the class AbilityProjectile method perCycleEffect.
@Override
public void perCycleEffect(LivingEntity mobEntity, Mob mob) {
if (!Helper.possibility(perCycleChance))
return;
List<Player> nearbyPlayers = mobEntity.getNearbyEntities(effectiveRange, effectiveRange, effectiveRange).stream().filter(entity -> entity instanceof Player).map(entity -> ((Player) entity)).filter(Helper::validGamemode).collect(Collectors.toList());
if (!nearbyPlayers.isEmpty()) {
nearbyPlayers.forEach(player -> {
if (!mobEntity.hasLineOfSight(player))
return;
Vector vector = Helper.unitDirectionVector(mobEntity.getEyeLocation().toVector(), player.getEyeLocation().toVector()).multiply(mainSpeed);
Projectile pro = launch(mobEntity, player, vector, false);
postLaunch(pro, mobEntity, player);
launchExtraProjectiles(vector, mobEntity, player);
});
}
}
Aggregations