Search in sources :

Example 1 with EntityAIGuardSpawnLocation

use of am2.entities.ai.EntityAIGuardSpawnLocation in project ArsMagica2 by Mithion.

the class EntityUtilities method setGuardSpawnLocation.

public static void setGuardSpawnLocation(EntityCreature entity, double x, double y, double z) {
    float speed = entity.getAIMoveSpeed();
    if (speed <= 0)
        speed = 1.0f;
    entity.tasks.addTask(1, new EntityAIGuardSpawnLocation(entity, speed, 3, 16, new AMVector3(x, y, z)));
}
Also used : AMVector3(am2.api.math.AMVector3) EntityAIGuardSpawnLocation(am2.entities.ai.EntityAIGuardSpawnLocation)

Example 2 with EntityAIGuardSpawnLocation

use of am2.entities.ai.EntityAIGuardSpawnLocation in project ArsMagica2 by Mithion.

the class EntityAirGuardian method onUpdate.

@SuppressWarnings("incomplete-switch")
@Override
public void onUpdate() {
    if (firstTick) {
        this.tasks.addTask(0, new EntityAIGuardSpawnLocation(this, 0.5F, 5, 16, new AMVector3(this)));
        this.firstTick = false;
    }
    this.orbitRotation += 2f;
    this.orbitRotation %= 360;
    switch(currentAction) {
        case IDLE:
            break;
        case SPINNING:
            this.spinRotation = (this.spinRotation - 40) % 360;
            if (this.worldObj.isRemote) {
                for (int i = 0; i < AMCore.config.getGFXLevel(); ++i) {
                    AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "wind", posX + worldObj.rand.nextDouble() * 4 - 2, posY, posZ + worldObj.rand.nextDouble() * 4 - 2);
                    if (particle != null) {
                        if (ticksInCurrentAction < BossActions.SPINNING.getMaxActionTime() - 10) {
                            particle.AddParticleController(new ParticleApproachEntity(particle, this, 0.2f, 0.5f, 1, true));
                            particle.AddParticleController(new ParticleFloatUpward(particle, 0.01f, 0.2f, 2, true));
                        } else {
                            particle.AddParticleController(new ParticleFloatUpward(particle, 0.1f, 1, 1, false));
                        }
                        particle.setMaxAge(30);
                    }
                }
            }
            break;
    }
    if (this.motionY < 0) {
        this.motionY *= 0.8999999f;
    }
    if (this.posY < 150) {
        if (worldObj.isRemote) {
            for (int i = 0; i < 25; ++i) {
                AMParticle wind = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "wind", posX, posY, posZ);
                if (wind != null) {
                    wind.setIgnoreMaxAge(false);
                    wind.setMaxAge(10 + rand.nextInt(10));
                    wind.setDontRequireControllers();
                    wind.addRandomOffset(1, 1, 1);
                // wind.AddParticleController(new PaticleFleePoint(wind, new AMVector3(this), rand.nextInt() * 0.1f + 0.01f, 10, 1, false));
                }
            }
        } else {
            if (this.posY < 145)
                this.setDead();
        }
    }
    super.onUpdate();
}
Also used : AMVector3(am2.api.math.AMVector3) AMParticle(am2.particles.AMParticle) ParticleFloatUpward(am2.particles.ParticleFloatUpward) EntityAIGuardSpawnLocation(am2.entities.ai.EntityAIGuardSpawnLocation) ParticleApproachEntity(am2.particles.ParticleApproachEntity)

Aggregations

AMVector3 (am2.api.math.AMVector3)2 EntityAIGuardSpawnLocation (am2.entities.ai.EntityAIGuardSpawnLocation)2 AMParticle (am2.particles.AMParticle)1 ParticleApproachEntity (am2.particles.ParticleApproachEntity)1 ParticleFloatUpward (am2.particles.ParticleFloatUpward)1