2014-01-17 19:12:49 +00:00
|
|
|
package WayofTime.alchemicalWizardry.common;
|
|
|
|
|
2014-01-17 21:54:58 +00:00
|
|
|
import WayofTime.alchemicalWizardry.ModItems;
|
2014-01-17 19:12:49 +00:00
|
|
|
import net.minecraft.entity.passive.EntityAnimal;
|
|
|
|
import net.minecraft.potion.Potion;
|
|
|
|
import net.minecraft.potion.PotionEffect;
|
|
|
|
import net.minecraftforge.event.ForgeSubscribe;
|
|
|
|
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
|
|
|
|
2014-01-17 21:43:13 +00:00
|
|
|
public class ModLivingDropsEvent
|
|
|
|
{
|
2014-01-17 19:12:49 +00:00
|
|
|
public static double rand;
|
|
|
|
|
|
|
|
@ForgeSubscribe
|
|
|
|
public void onEntityDrop(LivingDropsEvent event)
|
|
|
|
{
|
|
|
|
if (event.source.getDamageType().equals("player"))
|
|
|
|
{
|
|
|
|
rand = Math.random();
|
|
|
|
|
|
|
|
if (!(event.entityLiving instanceof EntityAnimal))
|
|
|
|
{
|
|
|
|
PotionEffect effect = event.entityLiving.getActivePotionEffect(Potion.weakness);
|
|
|
|
|
|
|
|
if (effect != null)
|
|
|
|
{
|
|
|
|
if (effect.getAmplifier() >= 2)
|
|
|
|
if (rand < 0.50d)
|
|
|
|
{
|
2014-01-17 21:05:38 +00:00
|
|
|
event.entityLiving.dropItem(ModItems.weakBloodShard.itemID, 1);
|
2014-01-17 19:12:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|