Search in sources :

Example 6 with ParticleFadeOut

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

the class ItemCrystalWrench method spawnLinkParticles.

private void spawnLinkParticles(World world, double hitX, double hitY, double hitZ, boolean disconnect) {
    for (int i = 0; i < 10; ++i) {
        AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(world, "none_hand", hitX, hitY, hitZ);
        if (particle != null) {
            if (disconnect) {
                particle.setRGBColorF(1, 0, 0);
                particle.addRandomOffset(0.5f, 0.5f, 0.5f);
            }
            particle.setMaxAge(10);
            particle.setParticleScale(0.1f);
            particle.AddParticleController(new ParticleMoveOnHeading(particle, world.rand.nextInt(360), world.rand.nextInt(360), world.rand.nextDouble() * 0.2, 1, false));
            particle.AddParticleController(new ParticleFadeOut(particle, 1, false).setFadeSpeed(0.1f));
        }
    }
}
Also used : AMParticle(am2.particles.AMParticle) ParticleFadeOut(am2.particles.ParticleFadeOut) ParticleMoveOnHeading(am2.particles.ParticleMoveOnHeading)

Example 7 with ParticleFadeOut

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

the class FlickerOperatorLight method DoOperation.

@Override
public boolean DoOperation(World worldObj, IFlickerController habitat, boolean powered) {
    if (!worldObj.isRemote) {
        int radius = 16;
        int yRadius = radius / 4;
        int checksPerOperation = 8;
        int checkX = ((TileEntity) habitat).xCoord - radius;
        int checkY = ((TileEntity) habitat).yCoord - yRadius;
        int checkZ = ((TileEntity) habitat).zCoord - radius;
        byte[] meta = habitat.getMetadata(this);
        if (meta.length != 0) {
            AMDataReader rdr = new AMDataReader(meta, false);
            checkX = rdr.getInt();
            checkY = rdr.getInt();
            checkZ = rdr.getInt();
        }
        for (int i = 0; i < checksPerOperation; ++i) {
            int light = worldObj.getBlockLightValue(checkX, checkY, checkZ);
            if (light < 10 && worldObj.isAirBlock(checkX, checkY, checkZ)) {
                worldObj.setBlock(checkX, checkY, checkZ, BlocksCommonProxy.invisibleUtility, 10, 2);
            }
            checkX++;
            if (checkX > ((TileEntity) habitat).xCoord + radius) {
                checkX = ((TileEntity) habitat).xCoord - radius;
                checkY++;
                if (checkY > ((TileEntity) habitat).yCoord + yRadius) {
                    checkY = ((TileEntity) habitat).yCoord - yRadius;
                    checkZ++;
                    if (checkZ > ((TileEntity) habitat).zCoord + radius) {
                        checkZ = ((TileEntity) habitat).zCoord - radius;
                    }
                }
            }
        }
        AMDataWriter writer = new AMDataWriter();
        writer.add(checkX).add(checkY).add(checkZ);
        habitat.setMetadata(this, writer.generate());
    } else {
        AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "sparkle", ((TileEntity) habitat).xCoord + 0.5, ((TileEntity) habitat).yCoord + 1, ((TileEntity) habitat).zCoord + 0.5);
        if (particle != null) {
            particle.addRandomOffset(0.5, 0.4, 0.5);
            particle.AddParticleController(new ParticleFloatUpward(particle, 0, 0.02f, 1, false));
            particle.AddParticleController(new ParticleFadeOut(particle, 1, false).setFadeSpeed(0.05f));
            particle.setMaxAge(20);
        }
    }
    return true;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) AMParticle(am2.particles.AMParticle) AMDataReader(am2.network.AMDataReader) ParticleFadeOut(am2.particles.ParticleFadeOut) ParticleFloatUpward(am2.particles.ParticleFloatUpward) AMDataWriter(am2.network.AMDataWriter)

Example 8 with ParticleFadeOut

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

the class TileEntityCrystalMarkerSpellExport method spawnParticles.

private void spawnParticles() {
    for (int i = 0; i < 15; ++i) {
        AMParticle effect = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "sparkle2", xCoord, yCoord, zCoord);
        if (effect != null) {
            effect.AddParticleController(new ParticleFloatUpward(effect, 0, worldObj.rand.nextFloat() * 0.1f, 1, false));
            effect.AddParticleController(new ParticleFadeOut(effect, 2, false).setFadeSpeed(0.035f).setKillParticleOnFinish(true));
            effect.addRandomOffset(0.2, 0.2, 0.2);
            effect.setRGBColorF(0, 0.5f, 1.0f);
            effect.setIgnoreMaxAge(true);
        }
    }
}
Also used : AMParticle(am2.particles.AMParticle) ParticleFadeOut(am2.particles.ParticleFadeOut) ParticleFloatUpward(am2.particles.ParticleFloatUpward)

Example 9 with ParticleFadeOut

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

the class TileEntityLectern method updateEntity.

@Override
public void updateEntity() {
    if (worldObj.isRemote) {
        updateBookRender();
        if (tooltipStack != null && field_145926_a % 2 == 0) {
            AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "sparkle", xCoord + 0.5 + ((worldObj.rand.nextDouble() * 0.2) - 0.1), yCoord + 1, zCoord + 0.5 + ((worldObj.rand.nextDouble() * 0.2) - 0.1));
            if (particle != null) {
                particle.AddParticleController(new ParticleMoveOnHeading(particle, worldObj.rand.nextDouble() * 360, -45 - worldObj.rand.nextInt(90), 0.05f, 1, false));
                particle.AddParticleController(new ParticleFadeOut(particle, 2, false).setFadeSpeed(0.05f).setKillParticleOnFinish(true));
                particle.setIgnoreMaxAge(true);
                if (getOverpowered()) {
                    particle.setRGBColorF(1.0f, 0.2f, 0.2f);
                }
            }
        }
    }
}
Also used : AMParticle(am2.particles.AMParticle) ParticleFadeOut(am2.particles.ParticleFadeOut) ParticleMoveOnHeading(am2.particles.ParticleMoveOnHeading)

Example 10 with ParticleFadeOut

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

the class Repel method spawnParticles.

@Override
public void spawnParticles(World world, double x, double y, double z, EntityLivingBase caster, Entity target, Random rand, int colorModifier) {
    AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(world, "sparkle", x, y, z);
    if (particle != null) {
        particle.addRandomOffset(1, 2, 1);
        double dx = caster.posX - target.posX;
        double dz = caster.posZ - target.posZ;
        double angle = Math.toDegrees(Math.atan2(-dz, -dx));
        particle.AddParticleController(new ParticleMoveOnHeading(particle, angle, 0, 0.1 + rand.nextDouble() * 0.5, 1, false));
        particle.AddParticleController(new ParticleFadeOut(particle, 1, false).setFadeSpeed(0.05f));
        particle.setMaxAge(20);
        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) ParticleMoveOnHeading(am2.particles.ParticleMoveOnHeading)

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