Search in sources :

Example 1 with Drowned

use of org.bukkit.entity.Drowned in project StackMob-2 by Nathat23.

the class DrownedTrait method applyTrait.

@Override
public void applyTrait(Entity original, Entity spawned) {
    if (original instanceof Drowned) {
        Drowned oriDrowned = (Drowned) original;
        Drowned spawnDrowned = (Drowned) spawned;
        if (materials.contains(oriDrowned.getEquipment().getItemInMainHand().getType())) {
            spawnDrowned.getEquipment().setItemInMainHand(oriDrowned.getEquipment().getItemInMainHand());
        }
        if (materials.contains(oriDrowned.getEquipment().getItemInOffHand().getType())) {
            spawnDrowned.getEquipment().setItemInOffHand(oriDrowned.getEquipment().getItemInOffHand());
        }
    }
}
Also used : Drowned(org.bukkit.entity.Drowned)

Example 2 with Drowned

use of org.bukkit.entity.Drowned in project StackMob-2 by Nathat23.

the class DrownedTrait method checkTrait.

@Override
public boolean checkTrait(Entity original, Entity nearby) {
    if (original instanceof Drowned) {
        Drowned oriDrowned = (Drowned) original;
        Drowned nearDrowned = (Drowned) nearby;
        if (materials.contains(oriDrowned.getEquipment().getItemInMainHand().getType()) || materials.contains(nearDrowned.getEquipment().getItemInMainHand().getType())) {
            if (oriDrowned.getEquipment().getItemInMainHand().getType() != nearDrowned.getEquipment().getItemInMainHand().getType()) {
                return true;
            }
        }
        if (materials.contains(oriDrowned.getEquipment().getItemInOffHand().getType()) || materials.contains(nearDrowned.getEquipment().getItemInOffHand().getType())) {
            return oriDrowned.getEquipment().getItemInOffHand().getType() != nearDrowned.getEquipment().getItemInOffHand().getType();
        }
    }
    return false;
}
Also used : Drowned(org.bukkit.entity.Drowned)

Aggregations

Drowned (org.bukkit.entity.Drowned)2