Search in sources :

Example 41 with ParticleFloatUpward

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

the class BlockMageLight method randomDisplayTick.

@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random rand) {
    int meta = par1World.getBlockMetadata(par2, par3, par4);
    int color = ItemDye.field_150922_c[meta];
    AMParticle particle = (AMParticle) AMCore.instance.proxy.particleManager.spawn(par1World, "sparkle", par2 + 0.5 + (rand.nextDouble() * 0.2f - 0.1f), par3 + 0.5, par4 + 0.5 + (rand.nextDouble() * 0.2f - 0.1f));
    if (particle != null) {
        particle.setIgnoreMaxAge(false);
        particle.setMaxAge(10 + rand.nextInt(20));
        particle.AddParticleController(new ParticleFloatUpward(particle, 0f, -0.01f, 1, false));
        particle.AddParticleController(new ParticleGrow(particle, -0.005f, 1, false));
        particle.setRGBColorI(color);
    }
}
Also used : AMParticle(am2.particles.AMParticle) ParticleGrow(am2.particles.ParticleGrow) ParticleFloatUpward(am2.particles.ParticleFloatUpward) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 42 with ParticleFloatUpward

use of am2.particles.ParticleFloatUpward 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)39 ParticleFloatUpward (am2.particles.ParticleFloatUpward)38 ParticleFadeOut (am2.particles.ParticleFadeOut)11 ParticleOrbitEntity (am2.particles.ParticleOrbitEntity)7 AMVector3 (am2.api.math.AMVector3)4 Entity (net.minecraft.entity.Entity)4 EntityLivingBase (net.minecraft.entity.EntityLivingBase)4 TileEntity (net.minecraft.tileentity.TileEntity)4 ParticleOrbitPoint (am2.particles.ParticleOrbitPoint)3 SideOnly (cpw.mods.fml.relauncher.SideOnly)3 EntityDragonPart (net.minecraft.entity.boss.EntityDragonPart)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 ISpellModifier (am2.api.spell.component.interfaces.ISpellModifier)2 ParticleHoldPosition (am2.particles.ParticleHoldPosition)2 ParticleMoveOnHeading (am2.particles.ParticleMoveOnHeading)2 Colour (am2.spell.modifiers.Colour)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Block (net.minecraft.block.Block)2 EntityAnimal (net.minecraft.entity.passive.EntityAnimal)2