Search in sources :

Example 26 with ParticleFadeOut

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

the class Drought 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, "ember", x + 0.5, y + 1, z + 0.5);
        if (particle != null) {
            particle.addRandomOffset(1, 0, 1);
            particle.AddParticleController(new ParticleFloatUpward(particle, 0, 0.1f, 1, false));
            particle.AddParticleController(new ParticleFadeOut(particle, 1, false).setFadeSpeed(0.05f));
            particle.setAffectedByGravity();
            particle.setRGBColorF(0.9f, 0.8f, 0.5f);
            particle.setMaxAge(40);
            particle.setParticleScale(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) ParticleFadeOut(am2.particles.ParticleFadeOut) ParticleFloatUpward(am2.particles.ParticleFloatUpward)

Example 27 with ParticleFadeOut

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

the class Haste 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, "mystic", x, y - 1, z);
        if (particle != null) {
            particle.addRandomOffset(1, 1, 1);
            particle.AddParticleController(new ParticleFloatUpward(particle, 0, 0.1f, 1, false));
            particle.AddParticleController(new ParticleOrbitPoint(particle, x, y, z, 2, false).setIgnoreYCoordinate(true).SetOrbitSpeed(0.1f).SetTargetDistance(0.3f + rand.nextDouble() * 0.3));
            particle.AddParticleController(new ParticleFadeOut(particle, 1, false).setFadeSpeed(0.05f).setKillParticleOnFinish(true));
            particle.setMaxAge(20);
            particle.setParticleScale(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) ParticleOrbitPoint(am2.particles.ParticleOrbitPoint) ParticleFadeOut(am2.particles.ParticleFadeOut) ParticleFloatUpward(am2.particles.ParticleFloatUpward) ParticleOrbitPoint(am2.particles.ParticleOrbitPoint)

Example 28 with ParticleFadeOut

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

the class TileEntityArcaneReconstructor method updateEntity.

@Override
public void updateEntity() {
    if (isFirstTick) {
        outerRingRotationSpeeds = new AMVector3(worldObj.rand.nextDouble() * 4 - 2, worldObj.rand.nextDouble() * 4 - 2, worldObj.rand.nextDouble() * 4 - 2);
        middleRingRotationSpeeds = new AMVector3(worldObj.rand.nextDouble() * 4 - 2, worldObj.rand.nextDouble() * 4 - 2, worldObj.rand.nextDouble() * 4 - 2);
        innerRingRotationSpeeds = new AMVector3(worldObj.rand.nextDouble() * 4 - 2, worldObj.rand.nextDouble() * 4 - 2, worldObj.rand.nextDouble() * 4 - 2);
        isFirstTick = false;
    }
    if (PowerNodeRegistry.For(this.worldObj).checkPower(this, this.getRepairCost())) {
        // has enough power
        if ((repairCounter++ % getRepairRate() == 0) && (!queueRepairableItem())) {
            // has ticked and already has item queued
            if (performRepair()) {
                // something to repair
                if (!worldObj.isRemote) {
                    PowerNodeRegistry.For(this.worldObj).consumePower(this, PowerNodeRegistry.For(worldObj).getHighestPowerType(this), this.getRepairCost());
                }
            }
        }
        deactivationDelayTicks = 0;
    } else if (!worldObj.isRemote && active) {
        // out of power, on server and active
        if (deactivationDelayTicks++ > 100) {
            // 5 seconds
            deactivationDelayTicks = 0;
            this.active = false;
            if (!worldObj.isRemote)
                worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
        }
    }
    if (worldObj.isRemote) {
        updateRotations();
        if (shouldRenderItemStack()) {
            AMParticle p = (AMParticle) AMCore.instance.proxy.particleManager.spawn(worldObj, "sparkle2", xCoord + 0.2 + (worldObj.rand.nextDouble() * 0.6), yCoord + 0.4, zCoord + 0.2 + (worldObj.rand.nextDouble() * 0.6));
            if (p != null) {
                p.AddParticleController(new ParticleFloatUpward(p, 0.0f, 0.02f, 1, false));
                p.setIgnoreMaxAge(true);
                p.setParticleScale(0.1f);
                p.AddParticleController(new ParticleFadeOut(p, 1, false).setFadeSpeed(0.035f).setKillParticleOnFinish(true));
                p.setRGBColorF(1, 0, 1);
            }
        }
    }
    super.updateEntity();
}
Also used : AMVector3(am2.api.math.AMVector3) AMParticle(am2.particles.AMParticle) ParticleFadeOut(am2.particles.ParticleFadeOut) ParticleFloatUpward(am2.particles.ParticleFloatUpward)

Example 29 with ParticleFadeOut

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

the class ParticleManagerClient method spawnAuraParticles.

@Override
public void spawnAuraParticles(EntityLivingBase ent) {
    if (!ent.worldObj.isRemote)
        return;
    int particleIndex = 15;
    int particleBehaviour = 0;
    float particleScale = 0;
    float particleAlpha = 0;
    boolean particleDefaultColor = true;
    boolean particleRandomColor = true;
    int particleColor = 0xFFFFFF;
    int particleQuantity = 2;
    float particleSpeed = 0.02f;
    if (Minecraft.getMinecraft().thePlayer == ent) {
        particleIndex = AMCore.config.getAuraIndex();
        particleBehaviour = AMCore.config.getAuraBehaviour();
        particleScale = AMCore.config.getAuraScale() / 10;
        particleAlpha = AMCore.config.getAuraAlpha();
        particleDefaultColor = AMCore.config.getAuraColorDefault();
        particleRandomColor = AMCore.config.getAuraColorRandom();
        particleColor = AMCore.config.getAuraColor();
        particleQuantity = AMCore.config.getAuraQuantity();
        particleSpeed = AMCore.config.getAuraSpeed() / 10;
    } else {
        ExtendedProperties entProperties = ExtendedProperties.For(ent);
        particleIndex = entProperties.getAuraIndex();
        particleBehaviour = entProperties.getAuraBehaviour();
        particleScale = entProperties.getAuraScale() / 10;
        particleAlpha = entProperties.getAuraAlpha();
        particleDefaultColor = entProperties.getAuraColorDefault();
        particleRandomColor = entProperties.getAuraColorRandomize();
        particleColor = entProperties.getAuraColor();
        particleQuantity = entProperties.getAuraQuantity();
        particleSpeed = entProperties.getAuraSpeed() / 10;
    }
    if (// fix radiant particle's scaling issues...
    particleIndex == 31)
        particleScale /= 10;
    if (ent.worldObj.isRemote && ent instanceof EntityPlayer && AMCore.proxy.playerTracker.hasAA((EntityPlayer) ent)) {
        if (Minecraft.getMinecraft().thePlayer != ent || Minecraft.getMinecraft().gameSettings.thirdPersonView > 0) {
            if (AMParticle.particleTypes[particleIndex].startsWith("lightning_bolts")) {
                int type = Integer.parseInt(new String(new char[] { AMParticle.particleTypes[particleIndex].charAt(AMParticle.particleTypes[particleIndex].length() - 1) }));
                if (ent.worldObj.rand.nextInt(100) < 90) {
                    BoltFromPointToPoint(ent.worldObj, ent.posX + (ent.worldObj.rand.nextFloat() - 0.5f), ent.posY + ent.getEyeHeight() - ent.height + (ent.worldObj.rand.nextFloat() * ent.height), ent.posZ + (ent.worldObj.rand.nextFloat() - 0.5f), ent.posX + (ent.worldObj.rand.nextFloat() - 0.5f), ent.posY + ent.getEyeHeight() - ent.height + (ent.worldObj.rand.nextFloat() * ent.height), ent.posZ + (ent.worldObj.rand.nextFloat() - 0.5f), type, -1);
                } else {
                    BoltFromPointToPoint(ent.worldObj, ent.posX, ent.posY + ent.getEyeHeight() - 0.4, ent.posZ, ent.posX + (ent.worldObj.rand.nextFloat() * 10 - 5), ent.posY + (ent.worldObj.rand.nextFloat() * 10 - 5), ent.posZ + (ent.worldObj.rand.nextFloat() * 10 - 5), type, -1);
                }
            } else {
                int offset = 0;
                for (int i = 0; i < particleQuantity; ++i) {
                    AMParticle effect = spawn(ent.worldObj, AMParticle.particleTypes[particleIndex], ent.posX + (ent.worldObj.rand.nextFloat() - 0.5f), ent.posY + ent.getEyeHeight() - 0.5f + offset - (ent.worldObj.rand.nextFloat() * 0.5), ent.posZ + (ent.worldObj.rand.nextFloat() - 0.5f));
                    if (effect != null) {
                        effect.setIgnoreMaxAge(false);
                        effect.setMaxAge(40);
                        effect.setParticleScale(particleScale);
                        effect.SetParticleAlpha(particleAlpha);
                        effect.noClip = false;
                        if (!particleDefaultColor) {
                            if (particleRandomColor) {
                                effect.setRGBColorF(ent.worldObj.rand.nextFloat(), ent.worldObj.rand.nextFloat(), ent.worldObj.rand.nextFloat());
                            } else {
                                effect.setRGBColorI(particleColor);
                            }
                        }
                        switch(particleBehaviour) {
                            case // fade
                            0:
                                effect.AddParticleController(new ParticleFadeOut(effect, 1, false).setFadeSpeed(particleSpeed));
                                break;
                            case // float
                            1:
                                effect.AddParticleController(new ParticleFloatUpward(effect, 0.2f, particleSpeed, 1, false));
                                break;
                            case // sink
                            2:
                                effect.AddParticleController(new ParticleFloatUpward(effect, 0.2f, -particleSpeed, 1, false));
                                break;
                            case // orbit
                            3:
                                effect.AddParticleController(new ParticleOrbitEntity(effect, ent, particleSpeed, 1, false));
                                break;
                            case // arc
                            4:
                                effect.AddParticleController(new ParticleArcToEntity(effect, 1, ent, false).generateControlPoints().SetSpeed(particleSpeed));
                                break;
                            case // flee
                            5:
                                effect.AddParticleController(new ParticleFleeEntity(effect, ent, particleSpeed, 2D, 1, false));
                                break;
                            case // forward
                            6:
                                effect.AddParticleController(new ParticleMoveOnHeading(effect, ent.rotationYaw + 90, ent.rotationPitch, particleSpeed, 1, false));
                                break;
                            case // pendulum
                            7:
                                effect.AddParticleController(new ParticlePendulum(effect, 0.2f, particleSpeed, 1, false));
                                break;
                            case // grow
                            8:
                                effect.AddParticleController(new ParticleGrow(effect, particleSpeed, 1, false));
                                break;
                        }
                    }
                }
            }
        }
    }
}
Also used : ExtendedProperties(am2.playerextensions.ExtendedProperties) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Aggregations

AMParticle (am2.particles.AMParticle)25 ParticleFadeOut (am2.particles.ParticleFadeOut)25 ParticleFloatUpward (am2.particles.ParticleFloatUpward)10 ParticleMoveOnHeading (am2.particles.ParticleMoveOnHeading)10 ParticleOrbitPoint (am2.particles.ParticleOrbitPoint)4 EntityLivingBase (net.minecraft.entity.EntityLivingBase)4 AMVector3 (am2.api.math.AMVector3)2 ISpellModifier (am2.api.spell.component.interfaces.ISpellModifier)2 Colour (am2.spell.modifiers.Colour)2 ItemStack (net.minecraft.item.ItemStack)2 AMDataReader (am2.network.AMDataReader)1 AMDataWriter (am2.network.AMDataWriter)1 ParticleExpandingCollapsingRingAtPoint (am2.particles.ParticleExpandingCollapsingRingAtPoint)1 ParticleHoldPosition (am2.particles.ParticleHoldPosition)1 ParticleOrbitEntity (am2.particles.ParticleOrbitEntity)1 ExtendedProperties (am2.playerextensions.ExtendedProperties)1 SideOnly (cpw.mods.fml.relauncher.SideOnly)1 List (java.util.List)1 EntityItem (net.minecraft.entity.item.EntityItem)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1