Programming Minecraft Plugins Mob Dropchance?

ne
- in Plugins
1

How do I make a spigot plugin so that a pig has a 24% chance of dropping a certain item? (E.g. Pig's head)

gl

@EventHandler void onEntityDeath (EntityDeathEvent e) {

if (! (e.getEntity () instanceof Pig)) return;

int r = new Random (). NextInt (100);

if (r <24) e.getWorld (). DropItem (e.getEntity (). GetLocation (), PIG HEAD);

What is the dropchance hy? Pr Productivehusky
Minecraft mob farm? - 1 Ju JuniperPickle