Search in sources :

Example 56 with EntityLivingBase

use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.

the class Haste method applyEffectEntity.

@Override
public boolean applyEffectEntity(ItemStack stack, World world, EntityLivingBase caster, Entity target) {
    if (target instanceof EntityLivingBase) {
        int duration = SpellUtils.instance.getModifiedInt_Mul(BuffList.default_buff_duration, stack, caster, target, world, 0, SpellModifiers.DURATION);
        duration = SpellUtils.instance.modifyDurationBasedOnArmor(caster, duration);
        int x = (int) Math.floor(target.posX);
        int y = (int) Math.floor(target.posY);
        int z = (int) Math.floor(target.posZ);
        if (RitualShapeHelper.instance.checkForRitual(this, world, x, y, z) != null) {
            duration += (3600 * (SpellUtils.instance.countModifiers(SpellModifiers.BUFF_POWER, stack, 0) + 1));
            RitualShapeHelper.instance.consumeRitualReagents(this, world, x, y, z);
        }
        if (!world.isRemote)
            ((EntityLivingBase) target).addPotionEffect(new BuffEffectHaste(duration, SpellUtils.instance.countModifiers(SpellModifiers.BUFF_POWER, stack, 0)));
        return true;
    }
    return false;
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) BuffEffectHaste(am2.buffs.BuffEffectHaste) ParticleOrbitPoint(am2.particles.ParticleOrbitPoint)

Example 57 with EntityLivingBase

use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.

the class BossSpawnHelper method tick.

public void tick() {
    ticksSinceLastDryadDeath++;
    if (ticksSinceLastDryadDeath >= 400) {
        ticksSinceLastDryadDeath = 0;
        dryadsKilled = 0;
    }
    for (EntityLivingBase ent : queuedBosses.keySet()) {
        World world = queuedBosses.get(ent);
        if (!world.isRemote) {
            world.spawnEntityInWorld(ent);
            onBossSpawn(ent, world, (int) Math.floor(ent.posX), (int) Math.floor(ent.posY), (int) Math.floor(ent.posZ));
        }
    }
    queuedBosses.clear();
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) World(net.minecraft.world.World)

Example 58 with EntityLivingBase

use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.

the class EntityAISummonFollowOwner method getOwner.

private EntityLivingBase getOwner() {
    int entityID = EntityUtilities.getOwner(theSummon);
    if (entityID == -1)
        return null;
    Entity e = theSummon.worldObj.getEntityByID(entityID);
    if (e instanceof EntityLivingBase)
        return (EntityLivingBase) e;
    return null;
}
Also used : Entity(net.minecraft.entity.Entity) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 59 with EntityLivingBase

use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.

the class EntitySpellProjectile method findHomingTarget.

private void findHomingTarget() {
    List<EntityLivingBase> entities = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(this.posX - 15, this.posY - 15, this.posZ - 15, this.posX + 15, this.posY + 15, this.posZ + 15));
    EntityLivingBase closest = null;
    double curShortestDistance = 900;
    AMVector3 me = new AMVector3(this);
    for (EntityLivingBase e : entities) {
        if (e == this.getShootingEntity())
            continue;
        double distance = new AMVector3(e).distanceSqTo(me);
        if (distance < curShortestDistance) {
            curShortestDistance = distance;
            closest = e;
        }
    }
    if (closest != null) {
        setHomingTarget(closest);
    }
}
Also used : AMVector3(am2.api.math.AMVector3) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 60 with EntityLivingBase

use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.

the class EntitySpellProjectile method getHomingEntity.

private EntityLivingBase getHomingEntity() {
    int entityID = this.dataWatcher.getWatchableObjectInt(DW_HOMING_TARGET);
    Entity e = this.worldObj.getEntityByID(entityID);
    if (e != null && e instanceof EntityLivingBase)
        return (EntityLivingBase) e;
    return null;
}
Also used : Entity(net.minecraft.entity.Entity) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Aggregations

EntityLivingBase (net.minecraft.entity.EntityLivingBase)270 EntityPlayer (net.minecraft.entity.player.EntityPlayer)100 Entity (net.minecraft.entity.Entity)72 PotionEffect (net.minecraft.potion.PotionEffect)43 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)39 ItemStack (net.minecraft.item.ItemStack)36 Vec3d (net.minecraft.util.math.Vec3d)25 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)25 BlockPos (net.minecraft.util.math.BlockPos)24 TileEntity (net.minecraft.tileentity.TileEntity)23 World (net.minecraft.world.World)20 IBlockState (net.minecraft.block.state.IBlockState)19 AMVector3 (am2.api.math.AMVector3)15 IArsMagicaBoss (am2.bosses.IArsMagicaBoss)15 ArrayList (java.util.ArrayList)15 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)15 Block (net.minecraft.block.Block)12 EntityItem (net.minecraft.entity.item.EntityItem)11 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)11 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)10