Search in sources :

Example 1 with EntityShockwave

use of am2.entities.EntityShockwave in project ArsMagica2 by Mithion.

the class EntityAISmash method updateTask.

@Override
public void updateTask() {
    host.getLookHelper().setLookPositionWithEntity(host.getAttackTarget(), 30, 30);
    host.getNavigator().tryMoveToEntityLiving(target, moveSpeed);
    if (host.getDistanceSqToEntity(target) < 16)
        if (((IArsMagicaBoss) host).getCurrentAction() != BossActions.SMASH)
            ((IArsMagicaBoss) host).setCurrentAction(BossActions.SMASH);
    if (((IArsMagicaBoss) host).getCurrentAction() == BossActions.SMASH && ((IArsMagicaBoss) host).getTicksInCurrentAction() == 18) {
        if (!host.worldObj.isRemote)
            host.worldObj.playSoundAtEntity(host, ((IArsMagicaBoss) host).getAttackSound(), 1.0f, 1.0f);
        List<EntityLivingBase> aoeEntities = host.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, host.boundingBox.expand(4, 2, 4));
        for (EntityLivingBase ent : aoeEntities) {
            if (ent == host)
                continue;
            ent.attackEntityFrom(DamageSources.causeDamage(damageType, host, true), 8);
            if (ent instanceof EntityPlayer) {
                AMNetHandler.INSTANCE.sendVelocityAddPacket(host.worldObj, ent, 0, 1.3f, 0);
            } else {
                ent.addVelocity(0, 1.4f, 0);
            }
        }
        if (!host.worldObj.isRemote) {
            for (int i = 0; i < 4; ++i) {
                EntityShockwave shockwave = new EntityShockwave(host.worldObj);
                shockwave.setPosition(host.posX, host.posY, host.posZ);
                shockwave.setMoveSpeedAndAngle(0.5f, MathHelper.wrapAngleTo180_float(host.rotationYaw + (90 * i)));
                host.worldObj.spawnEntityInWorld(shockwave);
            }
        }
    }
}
Also used : EntityShockwave(am2.entities.EntityShockwave) IArsMagicaBoss(am2.bosses.IArsMagicaBoss) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Aggregations

IArsMagicaBoss (am2.bosses.IArsMagicaBoss)1 EntityShockwave (am2.entities.EntityShockwave)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1