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);
}
}
Aggregations