Search in sources :

Example 26 with AMParticle

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

the class Invisiblity 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, 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).SetOrbitSpeed(0.5f).setIgnoreYCoordinate(true).SetTargetDistance(0.3f + rand.nextDouble() * 0.3));
            particle.AddParticleController(new ParticleFadeOut(particle, 3, 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 27 with AMParticle

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

the class HarvestPlants 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 + 1, z);
        if (particle != null) {
            particle.addRandomOffset(1, 1, 1);
            particle.AddParticleController(new ParticleFloatUpward(particle, 0, 0.3f, 1, false));
            particle.setAffectedByGravity();
            particle.setMaxAge(20);
            particle.setParticleScale(0.1f);
            particle.setRGBColorF(0.7f, 0.2f, 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) ParticleFloatUpward(am2.particles.ParticleFloatUpward)

Example 28 with AMParticle

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

the class BlockWitchwoodLeaves method randomDisplayTick.

@Override
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
    if (!AMCore.config.witchwoodLeafPFX())
        return;
    if (par5Random.nextInt(300) == 0 && par1World.isAirBlock(par2, par3 - 1, par4)) {
        AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(par1World, "leaf", par2 + par5Random.nextDouble(), par3 + par5Random.nextDouble(), par4 + par5Random.nextDouble());
        if (particle != null) {
            particle.AddParticleController(new ParticleFloatUpward(particle, 0, -0.05f, 1, false));
            particle.setMaxAge(120);
            particle.noClip = false;
            particle.setParticleScale(0.1f + par5Random.nextFloat() * 0.1f);
            particle.AddParticleController(new ParticlePendulum(particle, 0.2f, 0.15f + par5Random.nextFloat() * 0.2f, 2, false));
        }
    }
}
Also used : AMParticle(am2.particles.AMParticle) ParticlePendulum(am2.particles.ParticlePendulum) ParticleFloatUpward(am2.particles.ParticleFloatUpward)

Example 29 with AMParticle

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

the class VinteumTorch method spawnParticle.

@SideOnly(Side.CLIENT)
private void spawnParticle(World world, double x, double y, double z) {
    AMParticle effect = (AMParticle) AMCore.instance.proxy.particleManager.spawn(world, "light", x, y, z);
    if (effect != null) {
        effect.setMaxAge(3);
        effect.setIgnoreMaxAge(false);
        effect.setRGBColorF(0.69f, 0.89f, 1.0f);
        effect.AddParticleController(new ParticleFloatUpward(effect, 0, 0.01f, 1, false));
    }
}
Also used : AMParticle(am2.particles.AMParticle) ParticleFloatUpward(am2.particles.ParticleFloatUpward) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 30 with AMParticle

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

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