Search in sources :

Example 71 with AMParticle

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

the class TileEntityInscriptionTable method candleUpdate.

private void candleUpdate() {
    ticksToNextParticle--;
    if (isRenderingLeft()) {
        if (ticksToNextParticle == 0 || ticksToNextParticle == 15) {
            int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord) & ~0x8;
            double particleX = 0;
            double particleZ = 0;
            switch(meta) {
                case 1:
                    particleX = this.xCoord + 0.15;
                    particleZ = this.zCoord + 0.22;
                    break;
                case 2:
                    particleX = this.xCoord + 0.22;
                    particleZ = this.zCoord + 0.85;
                    break;
                case 3:
                    particleX = this.xCoord + 0.83;
                    particleZ = this.zCoord + 0.78;
                    break;
                case 4:
                    particleX = this.xCoord + 0.79;
                    particleZ = this.zCoord + 0.15;
                    break;
            }
            ticksToNextParticle = 30;
            AMParticle effect = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "fire", particleX, yCoord + 1.32, particleZ);
            if (effect != null) {
                effect.setParticleScale(0.025f, 0.1f, 0.025f);
                effect.AddParticleController(new ParticleHoldPosition(effect, 29, 1, false));
                effect.setIgnoreMaxAge(false);
                effect.setMaxAge(400);
            }
            if (worldObj.rand.nextInt(100) > 80) {
                AMParticle smoke = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "smoke", particleX, yCoord + 1.4, particleZ);
                if (smoke != null) {
                    smoke.setParticleScale(0.025f);
                    smoke.AddParticleController(new ParticleFloatUpward(smoke, 0.01f, 0.01f, 1, false));
                    smoke.setIgnoreMaxAge(false);
                    smoke.setMaxAge(20 + worldObj.rand.nextInt(10));
                }
            }
        }
        if (ticksToNextParticle == 10 || ticksToNextParticle == 25) {
            int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord) & ~0x8;
            double particleX = 0;
            double particleZ = 0;
            switch(meta) {
                case 1:
                    particleX = this.xCoord + 0.59;
                    particleZ = this.zCoord - 0.72;
                    break;
                case 2:
                    particleX = this.xCoord - 0.72;
                    particleZ = this.zCoord + 0.41;
                    break;
                case 3:
                    particleX = this.xCoord + 0.41;
                    particleZ = this.zCoord + 1.72;
                    break;
                case 4:
                    particleX = this.xCoord + 1.72;
                    particleZ = this.zCoord + 0.60;
                    break;
            }
            AMParticle effect = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "fire", particleX, yCoord + 1.26, particleZ);
            if (effect != null) {
                effect.setParticleScale(0.025f, 0.1f, 0.025f);
                effect.AddParticleController(new ParticleHoldPosition(effect, 29, 1, false));
                effect.setIgnoreMaxAge(false);
                effect.setMaxAge(400);
            }
            if (worldObj.rand.nextInt(100) > 80) {
                AMParticle smoke = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "smoke", particleX, yCoord + 1.4, particleZ);
                if (smoke != null) {
                    smoke.setParticleScale(0.025f);
                    smoke.AddParticleController(new ParticleFloatUpward(smoke, 0.01f, 0.01f, 1, false));
                    smoke.setIgnoreMaxAge(false);
                    smoke.setMaxAge(20 + worldObj.rand.nextInt(10));
                }
            }
        }
    }
}
Also used : AMParticle(am2.particles.AMParticle) ParticleHoldPosition(am2.particles.ParticleHoldPosition) ParticleFloatUpward(am2.particles.ParticleFloatUpward)

Example 72 with AMParticle

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

the class TileEntitySlipstreamGenerator method spawnParticles.

private void spawnParticles(EntityPlayer player) {
    AMParticle wind = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "wind", player.posX, player.posY - player.height, player.posZ);
    float pitch = player.rotationPitch;
    float factor = (pitch > 0 ? (pitch - 10) : (pitch + 10)) / -180.0f;
    if (player.isSneaking())
        factor = 0.01f;
    if (wind != null) {
        wind.setMaxAge(10);
        wind.addRandomOffset(1, 1, 1);
        wind.setParticleScale(0.1f);
        wind.AddParticleController(new ParticleFloatUpward(wind, 0, Math.abs(factor) * 2, 1, false));
    }
}
Also used : AMParticle(am2.particles.AMParticle) ParticleFloatUpward(am2.particles.ParticleFloatUpward)

Example 73 with AMParticle

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

the class Disarm 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(1, 2, 1);
            particle.AddParticleController(new ParticleMoveOnHeading(particle, MathHelper.wrapAngleTo180_double((target instanceof EntityLivingBase ? ((EntityLivingBase) target).rotationYawHead : target.rotationYaw) + 90), MathHelper.wrapAngleTo180_double(target.rotationPitch), 0.1 + rand.nextDouble() * 0.5, 1, false));
            particle.AddParticleController(new ParticleFadeOut(particle, 1, false).setFadeSpeed(0.05f));
            particle.setAffectedByGravity();
            if (rand.nextBoolean())
                particle.setRGBColorF(0.7f, 0.7f, 0.1f);
            else
                particle.setRGBColorF(0.1f, 0.7f, 0.1f);
            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) EntityLivingBase(net.minecraft.entity.EntityLivingBase) ParticleFadeOut(am2.particles.ParticleFadeOut) ParticleMoveOnHeading(am2.particles.ParticleMoveOnHeading)

Example 74 with AMParticle

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

the class Entangle 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, "plant", x, y, z);
        if (particle != null) {
            particle.addRandomOffset(1, 2, 1);
            particle.AddParticleController(new ParticleApproachEntity(particle, target, 0.15f, 0.4f, 1, false));
            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) ParticleApproachEntity(am2.particles.ParticleApproachEntity)

Example 75 with AMParticle

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

the class FireDamage 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 < 5; ++i) {
        AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(world, "explosion_2", x, y, z);
        if (particle != null) {
            particle.addRandomOffset(1, 0.5, 1);
            particle.addVelocity(rand.nextDouble() * 0.2 - 0.1, rand.nextDouble() * 0.2, rand.nextDouble() * 0.2 - 0.1);
            particle.setAffectedByGravity();
            particle.setDontRequireControllers();
            particle.setMaxAge(5);
            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)

Aggregations

AMParticle (am2.particles.AMParticle)103 ParticleFloatUpward (am2.particles.ParticleFloatUpward)38 ParticleFadeOut (am2.particles.ParticleFadeOut)25 ParticleOrbitEntity (am2.particles.ParticleOrbitEntity)19 ParticleMoveOnHeading (am2.particles.ParticleMoveOnHeading)13 EntityLivingBase (net.minecraft.entity.EntityLivingBase)13 ParticleHoldPosition (am2.particles.ParticleHoldPosition)11 Entity (net.minecraft.entity.Entity)9 AMVector3 (am2.api.math.AMVector3)8 ISpellModifier (am2.api.spell.component.interfaces.ISpellModifier)8 Colour (am2.spell.modifiers.Colour)8 EntityPlayer (net.minecraft.entity.player.EntityPlayer)7 ItemStack (net.minecraft.item.ItemStack)7 ParticleOrbitPoint (am2.particles.ParticleOrbitPoint)6 SideOnly (cpw.mods.fml.relauncher.SideOnly)6 Block (net.minecraft.block.Block)6 EntityDragonPart (net.minecraft.entity.boss.EntityDragonPart)6 TileEntity (net.minecraft.tileentity.TileEntity)5 List (java.util.List)4 BuffEffectFrostSlowed (am2.buffs.BuffEffectFrostSlowed)3