Search in sources :

Example 11 with EntityEquipment

use of org.bukkit.inventory.EntityEquipment in project InfernalMobs by NyaaCat.

the class AbilityArmoured method onMobSpawn.

@Override
public void onMobSpawn(InfernalMobSpawnEvent ev) {
    Mob mob = ev.mob;
    LivingEntity mobEntity = ev.mobEntity;
    mobEntity.setCanPickupItems(false);
    EntityEquipment ee = mobEntity.getEquipment();
    boolean isCloaked = mob.abilityList.contains(EnumAbilities.CLOAKED);
    // helmet & chestplate required for all mobs
    ee.setHelmetDropChance(0.0f);
    ee.setChestplateDropChance(0.0f);
    ee.setHelmet(new ItemStack(Material.DIAMOND_HELMET, 1));
    ee.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE, 1));
    // leggings & boots for all visible mobs
    ee.setLeggingsDropChance(0.0f);
    ee.setBootsDropChance(0.0f);
    ee.setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS, 1));
    ee.setBoots(new ItemStack(Material.DIAMOND_BOOTS, 1));
    // skeletons use bow
    if (mobEntity.getType() == EntityType.SKELETON) {
        ee.setItemInMainHand(new ItemStack(Material.BOW, 1));
        ee.setItemInMainHandDropChance(0);
    } else {
        // else use sword
        ItemStack sword = new ItemStack(Material.DIAMOND_SWORD, 1);
        sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 4);
        ee.setItemInMainHand(sword);
        ee.setItemInMainHandDropChance(0);
    }
}
Also used : Mob(com.jacob_vejvoda.infernal_mobs.persist.Mob) EntityEquipment(org.bukkit.inventory.EntityEquipment) ItemStack(org.bukkit.inventory.ItemStack)

Aggregations

EntityEquipment (org.bukkit.inventory.EntityEquipment)11 ItemStack (org.bukkit.inventory.ItemStack)4 AttributeManager (net.glowstone.entity.AttributeManager)2 Modifier (net.glowstone.entity.AttributeManager.Modifier)2 CompoundTag (net.glowstone.util.nbt.CompoundTag)2 PotionEffect (org.bukkit.potion.PotionEffect)2 Message (com.flowpowered.network.Message)1 Mob (com.jacob_vejvoda.infernal_mobs.persist.Mob)1 Property (net.glowstone.entity.AttributeManager.Property)1 EntityEquipmentMessage (net.glowstone.net.message.play.entity.EntityEquipmentMessage)1 EntityHeadRotationMessage (net.glowstone.net.message.play.entity.EntityHeadRotationMessage)1 SpawnPlayerMessage (net.glowstone.net.message.play.entity.SpawnPlayerMessage)1 PotionEffectType (org.bukkit.potion.PotionEffectType)1