package com.teraxus.mod.events;
import java.util.Random;
import com.teraxus.mod.init.ModItems;
import net.minecraft.entity.passive.EntityBat;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class BatDeathEvent {
@SubscribeEvent
public void onBatDeath(LivingDeathEvent event)
{
if(!(event.getEntity() instanceof EntityBat))
{
return;
}
else
{
EntityBat bat = (EntityBat) event.getEntity();
Random rand = new Random();
int randomInt = rand.nextInt(2) + 1;
bat.setDropItemsWhenDead(false);
bat.dropItem(ModItems.rawBat, randomInt);
}
}
}
When I kill a bat, it drops 2-5 items. ~40% of the items can be picked up, and the others cant be picked up. Why does this happen?