2015-08-29 14:33:25 +02:00
|
|
|
/*
|
|
|
|
* This file ("LivingDropEvent.java") is part of the Actually Additions Mod for Minecraft.
|
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
|
|
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2015-11-02 20:55:19 +01:00
|
|
|
* © 2015 Ellpeck
|
2015-08-29 14:33:25 +02:00
|
|
|
*/
|
|
|
|
|
2015-03-07 12:51:28 +01:00
|
|
|
package ellpeck.actuallyadditions.event;
|
2015-03-07 02:23:31 +01:00
|
|
|
|
|
|
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
2015-07-17 07:38:55 +02:00
|
|
|
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
|
2015-03-07 12:51:28 +01:00
|
|
|
import ellpeck.actuallyadditions.items.InitItems;
|
2015-07-17 11:17:55 +02:00
|
|
|
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
2015-11-22 18:58:23 +01:00
|
|
|
import ellpeck.actuallyadditions.util.Util;
|
2015-12-28 15:05:56 +01:00
|
|
|
import net.minecraft.entity.EntityCreature;
|
2015-07-17 07:38:55 +02:00
|
|
|
import net.minecraft.entity.monster.EntitySpider;
|
2015-07-17 11:17:55 +02:00
|
|
|
import net.minecraft.entity.passive.EntityBat;
|
2015-03-07 02:23:31 +01:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2015-07-17 07:38:55 +02:00
|
|
|
import net.minecraft.init.Blocks;
|
2015-03-07 02:23:31 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
|
|
|
|
2015-07-02 19:03:44 +02:00
|
|
|
public class LivingDropEvent{
|
2015-03-29 15:29:05 +02:00
|
|
|
|
2015-03-07 02:23:31 +01:00
|
|
|
@SubscribeEvent
|
|
|
|
public void onEntityDropEvent(LivingDropsEvent event){
|
|
|
|
if(event.source.getEntity() instanceof EntityPlayer){
|
2015-12-28 15:05:56 +01:00
|
|
|
//Drop Solidified XP
|
|
|
|
if(event.entityLiving instanceof EntityCreature){
|
|
|
|
if(Util.RANDOM.nextInt(15) <= 0){
|
|
|
|
event.entityLiving.entityDropItem(new ItemStack(InitItems.itemSolidifiedExperience, Util.RANDOM.nextInt(2)+1), 0);
|
2015-03-07 02:23:31 +01:00
|
|
|
}
|
|
|
|
}
|
2015-07-17 07:38:55 +02:00
|
|
|
|
|
|
|
//Drop Cobwebs from Spiders
|
|
|
|
if(ConfigBoolValues.DO_SPIDER_DROPS.isEnabled() && event.entityLiving instanceof EntitySpider){
|
2015-12-28 14:45:36 +01:00
|
|
|
if(Util.RANDOM.nextInt(80) <= 0){
|
2015-11-22 18:58:23 +01:00
|
|
|
event.entityLiving.entityDropItem(new ItemStack(Blocks.web, Util.RANDOM.nextInt(2)+1), 0);
|
2015-07-17 07:38:55 +02:00
|
|
|
}
|
|
|
|
}
|
2015-07-17 11:17:55 +02:00
|
|
|
|
|
|
|
//Drop Wings from Bats
|
|
|
|
if(ConfigBoolValues.DO_BAT_DROPS.isEnabled() && event.entityLiving instanceof EntityBat){
|
2015-11-28 19:02:01 +01:00
|
|
|
if(Util.RANDOM.nextInt(30) <= 0){
|
2015-11-22 18:58:23 +01:00
|
|
|
event.entityLiving.entityDropItem(new ItemStack(InitItems.itemMisc, Util.RANDOM.nextInt(2)+1, TheMiscItems.BAT_WING.ordinal()), 0);
|
2015-07-17 11:17:55 +02:00
|
|
|
}
|
|
|
|
}
|
2015-03-07 02:23:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|