use of org.bukkit.entity.Chicken in project EliteMobs by MagmaGuy.
the class ChickenHandler method superEggs.
public static void superEggs(Entity entity, int passiveStackAmount) {
List<Chicken> tempChickenList = new ArrayList<>();
if (entity instanceof Chicken && entity.hasMetadata(MetadataHandler.PASSIVE_ELITE_MOB_MD)) {
tempChickenList.add((Chicken) entity);
}
if (tempChickenList.size() > 0) {
Random random = new Random();
int eggChance = random.nextInt(12000 / passiveStackAmount);
//should spawn 1 by 1 but the odds of it spawning are scaled to fit config passivemob stack size
if (eggChance == 1) {
for (Chicken chicken : tempChickenList) {
ItemStack eggStack = new ItemStack(EGG, 1);
chicken.getWorld().dropItem(chicken.getLocation(), eggStack).setVelocity(ItemDropVelocity.ItemDropVelocity());
}
}
}
}