Search in sources :

Example 1 with MobCode

use of xyz.derkades.ublisk.mob.MobCode in project Ublisk by Derkades.

the class Zombie method getMobCode.

@Override
public MobCode getMobCode() {
    return new MobCode() {

        @Override
        public void mobCode(LivingEntity entity) {
            // We can safely cast, because this code will only run on zombies
            org.bukkit.entity.Zombie zombie = (org.bukkit.entity.Zombie) entity;
            // Clear equipment
            EntityEquipment equipment = zombie.getEquipment();
            ItemStack air = new ItemStack(Material.AIR);
            equipment.setBoots(air);
            equipment.setLeggings(air);
            equipment.setChestplate(air);
            equipment.setHelmet(air);
            equipment.setItemInMainHand(air);
            equipment.setItemInOffHand(air);
            zombie.setBaby(isBaby());
        }
    };
}
Also used : LivingEntity(org.bukkit.entity.LivingEntity) MobCode(xyz.derkades.ublisk.mob.MobCode) EntityEquipment(org.bukkit.inventory.EntityEquipment) ItemStack(org.bukkit.inventory.ItemStack)

Aggregations

LivingEntity (org.bukkit.entity.LivingEntity)1 EntityEquipment (org.bukkit.inventory.EntityEquipment)1 ItemStack (org.bukkit.inventory.ItemStack)1 MobCode (xyz.derkades.ublisk.mob.MobCode)1