Search in sources :

Example 6 with IHoardDemon

use of WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon in project BloodMagic by WayofTime.

the class AlchemicalWizardryEventHooks method onEntityDeath.

@SubscribeEvent
public void onEntityDeath(LivingDeathEvent event) {
    EntityLivingBase entityLiving = event.entityLiving;
    if (entityLiving instanceof IDemon && event.source.getEntity() instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.source.getEntity();
        player.addStat(ModAchievements.demonSpawn, 1);
    }
    if (entityLiving instanceof IHoardDemon && event.source.getEntity() instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.source.getEntity();
        player.addStat(ModAchievements.demons, 1);
    }
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) IHoardDemon(WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 7 with IHoardDemon

use of WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon in project BloodMagic by WayofTime.

the class DaggerOfSacrifice method hitEntity.

@Override
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) {
    if (par3EntityLivingBase == null || par2EntityLivingBase == null || par3EntityLivingBase.worldObj.isRemote || (par3EntityLivingBase instanceof EntityPlayer && SpellHelper.isFakePlayer(par3EntityLivingBase.worldObj, (EntityPlayer) par3EntityLivingBase))) {
        return false;
    }
    if (par2EntityLivingBase instanceof IHoardDemon) {
        return false;
    }
    if (par2EntityLivingBase.isChild() || par2EntityLivingBase instanceof EntityPlayer || par2EntityLivingBase instanceof IBossDisplayData) {
        return false;
    }
    World world = par2EntityLivingBase.worldObj;
    if (par2EntityLivingBase.isDead || par2EntityLivingBase.getHealth() < 0.5f) {
        return false;
    }
    if (par2EntityLivingBase instanceof IDemon) {
        ((IDemon) par2EntityLivingBase).setDropCrystal(false);
        this.findAndNotifyAltarOfDemon(world, par2EntityLivingBase);
    }
    int lifeEssence = 500;
    if (par2EntityLivingBase instanceof EntityVillager)
        lifeEssence = 2000;
    else if (par2EntityLivingBase instanceof EntitySlime)
        lifeEssence = 150;
    else if (par2EntityLivingBase instanceof EntityEnderman)
        lifeEssence = 200;
    else if (par2EntityLivingBase instanceof EntityAnimal)
        lifeEssence = 250;
    if (findAndFillAltar(par2EntityLivingBase.worldObj, par2EntityLivingBase, lifeEssence)) {
        double posX = par2EntityLivingBase.posX;
        double posY = par2EntityLivingBase.posY;
        double posZ = par2EntityLivingBase.posZ;
        for (int i = 0; i < 8; i++) {
            SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 1, posX, posY, posZ);
        }
        par2EntityLivingBase.setHealth(-1);
        par2EntityLivingBase.onDeath(DamageSource.generic);
    }
    return false;
}
Also used : EntityVillager(net.minecraft.entity.passive.EntityVillager) EntitySlime(net.minecraft.entity.monster.EntitySlime) IBossDisplayData(net.minecraft.entity.boss.IBossDisplayData) EntityPlayer(net.minecraft.entity.player.EntityPlayer) World(net.minecraft.world.World) EntityAnimal(net.minecraft.entity.passive.EntityAnimal) IHoardDemon(WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon) IDemon(WayofTime.alchemicalWizardry.common.IDemon) EntityEnderman(net.minecraft.entity.monster.EntityEnderman)

Aggregations

IHoardDemon (WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon)7 EntityLivingBase (net.minecraft.entity.EntityLivingBase)3 EntityCreature (net.minecraft.entity.EntityCreature)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 World (net.minecraft.world.World)2 Int3 (WayofTime.alchemicalWizardry.api.Int3)1 LocalRitualStorage (WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage)1 IDemon (WayofTime.alchemicalWizardry.common.IDemon)1 EntityMinorDemonGrunt (WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt)1 TEDemonPortal (WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal)1 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1 Block (net.minecraft.block.Block)1 IBossDisplayData (net.minecraft.entity.boss.IBossDisplayData)1 EntityEnderman (net.minecraft.entity.monster.EntityEnderman)1 EntitySlime (net.minecraft.entity.monster.EntitySlime)1 EntityAnimal (net.minecraft.entity.passive.EntityAnimal)1 EntityVillager (net.minecraft.entity.passive.EntityVillager)1 TileEntity (net.minecraft.tileentity.TileEntity)1