package tconstruct.armor; import net.minecraft.entity.boss.EntityDragon; import net.minecraft.entity.boss.IBossDisplayData; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.event.entity.living.LivingDropsEvent; import tconstruct.TConstruct; import tconstruct.library.tools.ToolCore; import tconstruct.tools.TinkerTools; import tconstruct.util.ItemHelper; import tconstruct.util.config.PHConstruct; import tconstruct.world.entity.BlueSlime; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class TinkerArmorEvents { @SubscribeEvent public void onLivingDrop (LivingDropsEvent event) { if (event.entityLiving == null) return; if (TConstruct.random.nextInt(200) == 0 && event.entityLiving instanceof IMob && event.source.damageType.equals("player")) { if (event.entityLiving instanceof BlueSlime) { BlueSlime slime = (BlueSlime) event.entityLiving; if (slime.getSlimeSize() < 8) return; } int count = event.entityLiving instanceof EntityDragon ? 5 : 1; for (int i = 0; i < count; i++) { ItemStack dropStack = new ItemStack(TinkerArmor.heartCanister, 1, 1); EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack); entityitem.delayBeforeCanPickup = 10; event.drops.add(entityitem); } } if (event.entityLiving instanceof IBossDisplayData) { ItemStack dropStack = new ItemStack(TinkerArmor.heartCanister, 1, 3); EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack); entityitem.delayBeforeCanPickup = 10; event.drops.add(entityitem); } } }