Search in sources :

Example 6 with ParticleOrbitPoint

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

the class EntitySpellEffect method zoneUpdate.

private void zoneUpdate() {
    if (this.worldObj.isRemote) {
        if (!AMCore.config.NoGFX()) {
            this.rotation += this.rotationSpeed;
            this.rotation %= 360;
            double dist = this.dataWatcher.getWatchableObjectFloat(WATCHER_RADIUS);
            double _rotation = rotation;
            if (spellStack == null) {
                spellStack = this.dataWatcher.getWatchableObjectItemStack(22);
                if (spellStack == null) {
                    return;
                }
            }
            int color = 0xFFFFFF;
            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);
                    }
                }
            }
            if ((AMCore.config.FullGFX() && this.ticksExisted % 2 == 0) || this.ticksExisted % 8 == 0) {
                for (int i = 0; i < 4; ++i) {
                    _rotation = (rotation + (90 * i)) % 360;
                    double x = this.posX - Math.cos(3.141 / 180 * (_rotation)) * dist;
                    double z = this.posZ - Math.sin(3.141 / 180 * (_rotation)) * dist;
                    AMParticle effect = (AMParticle) AMCore.instance.proxy.particleManager.spawn(worldObj, AMParticleIcons.instance.getParticleForAffinity(SpellUtils.instance.mainAffinityFor(spellStack)), x, posY, z);
                    if (effect != null) {
                        effect.setIgnoreMaxAge(false);
                        effect.setMaxAge(20);
                        effect.setParticleScale(0.15f);
                        effect.setRGBColorI(color);
                        effect.AddParticleController(new ParticleFloatUpward(effect, 0, 0.07f, 1, false));
                        if (AMCore.config.LowGFX()) {
                            effect.AddParticleController(new ParticleOrbitPoint(effect, posX, posY, posZ, 2, false).setIgnoreYCoordinate(true).SetOrbitSpeed(0.05f).SetTargetDistance(dist).setRotateDirection(true));
                        }
                    }
                }
            }
        }
    }
    this.moveEntity(0, this.dataWatcher.getWatchableObjectInt(WATCHER_GRAVITY) / 100.0f, 0);
    ticksToEffect--;
    if (spellStack == null) {
        if (!worldObj.isRemote) {
            this.setDead();
        }
        return;
    }
    if (dummycaster == null) {
        dummycaster = DummyEntityPlayer.fromEntityLiving(new EntityDummyCaster(worldObj));
    }
    if (ticksToEffect <= 0) {
        ticksToEffect = maxTicksToEffect;
        float radius = this.dataWatcher.getWatchableObjectFloat(WATCHER_RADIUS);
        List<Entity> possibleTargets = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(posX - radius, posY - 1, posZ - radius, posX + radius, posY + 3, posZ + radius));
        for (Entity e : possibleTargets) {
            if (e instanceof EntityDragonPart && ((EntityDragonPart) e).entityDragonObj instanceof EntityLivingBase)
                e = (EntityLivingBase) ((EntityDragonPart) e).entityDragonObj;
            if (e instanceof EntityLivingBase)
                SpellHelper.instance.applyStageToEntity(spellStack, dummycaster, worldObj, e, 0, false);
        }
        if (this.dataWatcher.getWatchableObjectInt(WATCHER_GRAVITY) < 0 && !firstApply)
            SpellHelper.instance.applyStackStage(spellStack, dummycaster, null, posX, posY - 1, posZ, 0, worldObj, false, false, this.ticksExisted);
        else
            SpellHelper.instance.applyStackStage(spellStack, dummycaster, null, posX, posY, posZ, 0, worldObj, false, false, this.ticksExisted);
        firstApply = false;
    }
}
Also used : Entity(net.minecraft.entity.Entity) ISpellModifier(am2.api.spell.component.interfaces.ISpellModifier) Colour(am2.spell.modifiers.Colour) EntityDragonPart(net.minecraft.entity.boss.EntityDragonPart) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 7 with ParticleOrbitPoint

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

the class Appropriation 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 + 5 * AMCore.config.getGFXLevel(); ++i) {
        AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(world, "water_ball", x, y, z);
        if (particle != null) {
            particle.addRandomOffset(1, 1, 1);
            particle.setMaxAge(10);
            particle.setParticleScale(0.1f);
            particle.AddParticleController(new ParticleOrbitPoint(particle, x, y, z, 1, false).SetTargetDistance(world.rand.nextDouble() + 0.1f).SetOrbitSpeed(0.2f));
        }
    }
}
Also used : AMParticle(am2.particles.AMParticle) ParticleOrbitPoint(am2.particles.ParticleOrbitPoint) ParticleOrbitPoint(am2.particles.ParticleOrbitPoint)

Example 8 with ParticleOrbitPoint

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

the class Haste 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, "mystic", 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).setIgnoreYCoordinate(true).SetOrbitSpeed(0.1f).SetTargetDistance(0.3f + rand.nextDouble() * 0.3));
            particle.AddParticleController(new ParticleFadeOut(particle, 1, 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)

Aggregations

AMParticle (am2.particles.AMParticle)7 ParticleOrbitPoint (am2.particles.ParticleOrbitPoint)6 ParticleFadeOut (am2.particles.ParticleFadeOut)5 ParticleFloatUpward (am2.particles.ParticleFloatUpward)3 ISpellModifier (am2.api.spell.component.interfaces.ISpellModifier)1 ParticleExpandingCollapsingRingAtPoint (am2.particles.ParticleExpandingCollapsingRingAtPoint)1 ParticleHoldPosition (am2.particles.ParticleHoldPosition)1 ParticleOrbitEntity (am2.particles.ParticleOrbitEntity)1 Colour (am2.spell.modifiers.Colour)1 SideOnly (cpw.mods.fml.relauncher.SideOnly)1 Entity (net.minecraft.entity.Entity)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 EntityDragonPart (net.minecraft.entity.boss.EntityDragonPart)1