Search in sources :

Example 1 with Spider

use of org.bukkit.entity.Spider in project InfernalMobs by NyaaCat.

the class AbilityWebber method onAttackPlayer.

@Override
public void onAttackPlayer(LivingEntity mobEntity, Mob mob, Player victim, boolean isDirectAttack, EntityDamageByEntityEvent ev) {
    if (Helper.possibility(0.7))
        return;
    boolean webJail = false;
    if (mobEntity instanceof Spider && Helper.possibility(0.1))
        webJail = true;
    Location loc = victim.getLocation();
    if (!webJail) {
        setWebWithDecay(loc.getBlock(), 60, false);
    } else {
        for (Block b : Helper.getSphere(loc.getBlock(), 4)) {
            setWebWithDecay(b, 30, true);
        }
    }
}
Also used : Spider(org.bukkit.entity.Spider) Block(org.bukkit.block.Block) Location(org.bukkit.Location)

Example 2 with Spider

use of org.bukkit.entity.Spider in project InfernalMobs by NyaaCat.

the class AbilityWebber method onPlayerAttack.

@Override
public void onPlayerAttack(LivingEntity mobEntity, Mob mob, Player attacker, boolean isDirectAttack, EntityDamageByEntityEvent ev) {
    if (Helper.possibility(0.7))
        return;
    boolean webJail = false;
    if (mobEntity instanceof Spider && Helper.possibility(0.1))
        webJail = true;
    Location loc = attacker.getLocation();
    if (!webJail) {
        setWebWithDecay(loc.getBlock(), 60, false);
    } else {
        for (Block b : Helper.getSphere(loc.getBlock(), 4)) {
            setWebWithDecay(b, 30, true);
        }
    }
}
Also used : Spider(org.bukkit.entity.Spider) Block(org.bukkit.block.Block) Location(org.bukkit.Location)

Aggregations

Location (org.bukkit.Location)2 Block (org.bukkit.block.Block)2 Spider (org.bukkit.entity.Spider)2