Search in sources :

Example 56 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 57 with AMParticle

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

the class AMPacketProcessorClient method handleStarFall.

private void handleStarFall(byte[] data) {
    AMDataReader rdr = new AMDataReader(data, false);
    double x = rdr.getDouble();
    double y = rdr.getDouble();
    double z = rdr.getDouble();
    ItemStack spellStack = null;
    if (rdr.getBoolean())
        spellStack = rdr.getItemStack();
    int color = -1;
    if (spellStack != null) {
        if (SpellUtils.instance.modifierIsPresent(SpellModifiers.COLOR, spellStack, 0)) {
            ISpellModifier[] mods = SpellUtils.instance.getModifiersForStage(spellStack, 0);
            int ordinalCount = 0;
            for (ISpellModifier mod : mods) {
                if (mod instanceof Colour) {
                    byte[] meta = SpellUtils.instance.getModifierMetadataFromStack(spellStack, mod, 0, ordinalCount++);
                    color = (int) mod.getModifier(SpellModifiers.COLOR, null, null, null, meta);
                }
            }
        }
    }
    for (int i = 0; i < 360; i += AMCore.config.FullGFX() ? 5 : AMCore.config.LowGFX() ? 10 : 20) {
        AMParticle effect = (AMParticle) AMCore.instance.proxy.particleManager.spawn(Minecraft.getMinecraft().theWorld, "sparkle2", x, y + 1.5, z);
        if (effect != null) {
            effect.setIgnoreMaxAge(true);
            effect.AddParticleController(new ParticleMoveOnHeading(effect, i, 0, 0.7f, 1, false));
            float clrMod = Minecraft.getMinecraft().theWorld.rand.nextFloat();
            int finalColor = -1;
            if (color == -1)
                finalColor = MathUtilities.colorFloatsToInt(0.24f * clrMod, 0.58f * clrMod, 0.71f * clrMod);
            else {
                float[] colors = MathUtilities.colorIntToFloats(color);
                for (int c = 0; c < colors.length; ++c) colors[c] = colors[c] * clrMod;
                finalColor = MathUtilities.colorFloatsToInt(colors[0], colors[1], colors[2]);
            }
            effect.setParticleScale(1.2f);
            effect.noClip = false;
            effect.setRGBColorI(finalColor);
            effect.AddParticleController(new ParticleFadeOut(effect, 1, false).setFadeSpeed(0.05f).setKillParticleOnFinish(true));
            effect.AddParticleController(new ParticleLeaveParticleTrail(effect, "sparkle2", false, 15, 1, false).addControllerToParticleList(new ParticleChangeSize(effect, 1.2f, 0.01f, 15, 1, false)).setParticleRGB_I(finalColor).setChildAffectedByGravity().addRandomOffset(0.2f, 0.2f, 0.2f));
        }
    }
    Minecraft.getMinecraft().theWorld.playSound(x, y, z, "arsmagica2:spell.special.starfall", 2.0f, 1.0f, false);
}
Also used : ISpellModifier(am2.api.spell.component.interfaces.ISpellModifier) Colour(am2.spell.modifiers.Colour) ItemStack(net.minecraft.item.ItemStack)

Example 58 with AMParticle

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

the class EntityNatureGuardian method spawnParticles.

private void spawnParticles() {
    AMParticle leaf = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "leaf", posX + (rand.nextDouble() * 3) - 1.5f, posY + (rand.nextDouble() * 5f), posZ + (rand.nextDouble() * 3) - 1.5f);
    if (leaf != null) {
        leaf.setMaxAge(20);
        leaf.setIgnoreMaxAge(false);
        leaf.AddParticleController(new ParticleFloatUpward(leaf, 0.05f, -0.02f, 1, false));
        if (getCurrentAction() == BossActions.SPINNING) {
            leaf.AddParticleController(new ParticleOrbitEntity(leaf, this, 0.6f, 1, false));
        }
    }
}
Also used : AMParticle(am2.particles.AMParticle) ParticleOrbitEntity(am2.particles.ParticleOrbitEntity) ParticleFloatUpward(am2.particles.ParticleFloatUpward)

Example 59 with AMParticle

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

the class EntityWinterGuardian method onUpdate.

@Override
public void onUpdate() {
    if (worldObj.getBiomeGenForCoords((int) posX, (int) posZ).getEnableSnow() && worldObj.getWorldInfo().isRaining()) {
        if (worldObj.isRemote) {
            AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "ember", posX + (rand.nextFloat() * 6 - 3), posY + 2 + (rand.nextFloat() * 2 - 1), posZ + (rand.nextFloat() * 6 - 3));
            if (particle != null) {
                particle.AddParticleController(new ParticleApproachEntity(particle, this, 0.15f, 0.1, 1, false));
                particle.setIgnoreMaxAge(false);
                particle.setMaxAge(30);
                particle.setParticleScale(0.35f);
                particle.setRGBColorF(0.7843f, 0.5098f, 0.5098f);
            }
        } else {
            this.heal(0.1f);
        }
    }
    if (worldObj.isRemote) {
        updateRotations();
        spawnParticles();
    } else {
        if (this.ticksExisted % 100 == 0) {
            List<EntityLivingBase> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.boundingBox.expand(2, 2, 2));
            for (EntityLivingBase entity : entities) {
                if (entity == this)
                    continue;
                entity.addPotionEffect(new BuffEffectFrostSlowed(220, 1));
                entity.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 220, 3));
            }
        }
    }
    super.onUpdate();
}
Also used : BuffEffectFrostSlowed(am2.buffs.BuffEffectFrostSlowed) PotionEffect(net.minecraft.potion.PotionEffect) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 60 with AMParticle

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

the class ItemWinterGuardianArm method onLeftClickEntity.

@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
    if (entity instanceof EntityLivingBase) {
        ((EntityLivingBase) entity).addPotionEffect(new BuffEffectFrostSlowed(60, 3));
        if (player.worldObj.isRemote) {
            for (int i = 0; i < 5; ++i) {
                AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(player.worldObj, "snowflakes", entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5);
                if (particle != null) {
                    particle.addRandomOffset(1, 0.5, 1);
                    particle.addVelocity(player.worldObj.rand.nextDouble() * 0.2 - 0.1, 0.3, player.worldObj.rand.nextDouble() * 0.2 - 0.1);
                    particle.setAffectedByGravity();
                    particle.setDontRequireControllers();
                    particle.setMaxAge(10);
                    particle.setParticleScale(0.1f);
                }
            }
        }
    }
    return super.onLeftClickEntity(stack, player, entity);
}
Also used : BuffEffectFrostSlowed(am2.buffs.BuffEffectFrostSlowed) AMParticle(am2.particles.AMParticle) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

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