Search in sources :

Example 1 with ParticleApproachEntity

use of am2.particles.ParticleApproachEntity in project ArsMagica2 by Mithion.

the class LifeTap method spawnParticles.

@Override
public void spawnParticles(World world, double x, double y, double z, EntityLivingBase caster, Entity target, Random rand, int colorModifier) {
    for (int i = 0; i < 25; ++i) {
        AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(world, "sparkle2", x, y, z);
        if (particle != null) {
            particle.addRandomOffset(2, 2, 2);
            particle.setMaxAge(15);
            particle.setParticleScale(0.1f);
            particle.AddParticleController(new ParticleApproachEntity(particle, target, 0.1, 0.1, 1, false));
            if (rand.nextBoolean())
                particle.setRGBColorF(0.4f, 0.1f, 0.5f);
            else
                particle.setRGBColorF(0.1f, 0.5f, 0.1f);
            if (colorModifier > -1) {
                particle.setRGBColorF(((colorModifier >> 16) & 0xFF) / 255.0f, ((colorModifier >> 8) & 0xFF) / 255.0f, (colorModifier & 0xFF) / 255.0f);
            }
        }
    }
}
Also used : AMParticle(am2.particles.AMParticle) ParticleApproachEntity(am2.particles.ParticleApproachEntity)

Example 2 with ParticleApproachEntity

use of am2.particles.ParticleApproachEntity 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)

Example 3 with ParticleApproachEntity

use of am2.particles.ParticleApproachEntity in project ArsMagica2 by Mithion.

the class EntityWinterGuardian method onUpdate.

@Override
public void onUpdate() {
    if (worldObj.getBiomeGenForCoords((int) posX, (int) posZ).getEnableSnow() && worldObj.getWorldInfo().isRaining()) {
        if (worldObj.isRemote) {
            AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "ember", posX + (rand.nextFloat() * 6 - 3), posY + 2 + (rand.nextFloat() * 2 - 1), posZ + (rand.nextFloat() * 6 - 3));
            if (particle != null) {
                particle.AddParticleController(new ParticleApproachEntity(particle, this, 0.15f, 0.1, 1, false));
                particle.setIgnoreMaxAge(false);
                particle.setMaxAge(30);
                particle.setParticleScale(0.35f);
                particle.setRGBColorF(0.7843f, 0.5098f, 0.5098f);
            }
        } else {
            this.heal(0.1f);
        }
    }
    if (worldObj.isRemote) {
        updateRotations();
        spawnParticles();
    } else {
        if (this.ticksExisted % 100 == 0) {
            List<EntityLivingBase> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.boundingBox.expand(2, 2, 2));
            for (EntityLivingBase entity : entities) {
                if (entity == this)
                    continue;
                entity.addPotionEffect(new BuffEffectFrostSlowed(220, 1));
                entity.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 220, 3));
            }
        }
    }
    super.onUpdate();
}
Also used : BuffEffectFrostSlowed(am2.buffs.BuffEffectFrostSlowed) PotionEffect(net.minecraft.potion.PotionEffect) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 4 with ParticleApproachEntity

use of am2.particles.ParticleApproachEntity in project ArsMagica2 by Mithion.

the class ItemFrameWatcher method spawnCompendiumProgressParticles.

@SideOnly(Side.CLIENT)
public void spawnCompendiumProgressParticles(EntityItemFrame frame, int x, int y, int z) {
    AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(frame.worldObj, "symbols", x + 0.5, y + 0.5, z + 0.5);
    if (particle != null) {
        particle.setIgnoreMaxAge(true);
        //particle.AddParticleController(new ParticleApproachEntity(particle, frame, 0.02f, 0.04f, 1, false).setKillParticleOnFinish(true));
        particle.AddParticleController(new ParticleArcToEntity(particle, 1, frame, false).SetSpeed(0.02f).setKillParticleOnFinish(true));
        particle.setRandomScale(0.05f, 0.12f);
    }
}
Also used : AMParticle(am2.particles.AMParticle) ParticleArcToEntity(am2.particles.ParticleArcToEntity) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 5 with ParticleApproachEntity

use of am2.particles.ParticleApproachEntity in project ArsMagica2 by Mithion.

the class ItemFrameWatcher method spawnCompendiumCompleteParticles.

@SideOnly(Side.CLIENT)
public void spawnCompendiumCompleteParticles(EntityItemFrame frame) {
    AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(frame.worldObj, "radiant", frame.posX, frame.posY, frame.posZ);
    if (particle != null) {
        particle.setIgnoreMaxAge(false);
        particle.setMaxAge(40);
        particle.setParticleScale(0.3f);
        //particle.AddParticleController(new ParticleApproachEntity(particle, frame, 0.02f, 0.04f, 1, false).setKillParticleOnFinish(true));
        particle.AddParticleController(new ParticleHoldPosition(particle, 40, 1, false));
        particle.AddParticleController(new ParticleColorShift(particle, 1, false).SetShiftSpeed(0.2f));
    }
}
Also used : AMParticle(am2.particles.AMParticle) ParticleColorShift(am2.particles.ParticleColorShift) ParticleHoldPosition(am2.particles.ParticleHoldPosition) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Aggregations

AMParticle (am2.particles.AMParticle)5 ParticleApproachEntity (am2.particles.ParticleApproachEntity)3 SideOnly (cpw.mods.fml.relauncher.SideOnly)2 AMVector3 (am2.api.math.AMVector3)1 BuffEffectFrostSlowed (am2.buffs.BuffEffectFrostSlowed)1 EntityAIGuardSpawnLocation (am2.entities.ai.EntityAIGuardSpawnLocation)1 ParticleArcToEntity (am2.particles.ParticleArcToEntity)1 ParticleColorShift (am2.particles.ParticleColorShift)1 ParticleFloatUpward (am2.particles.ParticleFloatUpward)1 ParticleHoldPosition (am2.particles.ParticleHoldPosition)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 PotionEffect (net.minecraft.potion.PotionEffect)1