use of org.bukkit.Material.AIR in project InfernalMobs by NyaaCat.
the class AbilityGravity method perCycleEffect.
@Override
public void perCycleEffect(LivingEntity mobEntity, Mob mob) {
if (!Helper.possibility(0.2))
return;
Location mobLocation = mobEntity.getLocation();
mobLocation.getWorld().getPlayers().stream().filter(p -> p.getLocation().distanceSquared(mobLocation) <= EFFECTIVE_RANGE_SQUARED).filter(p -> p.getGameMode() != GameMode.CREATIVE).filter(p -> {
Location t = p.getLocation().clone();
t.add(0, -2, 0);
Block b = p.getWorld().getBlockAt(t);
return b != null && b.getType() != AIR;
}).filter(p -> Helper.possibility(0.2)).forEach(p -> levitate(p, ConfigReader.getGravityLevitateLength()));
}
Aggregations