Search in sources :

Example 6 with Colour

use of am2.spell.modifiers.Colour in project ArsMagica2 by Mithion.

the class AoE method spawnAoEParticles.

private void spawnAoEParticles(ItemStack stack, EntityLivingBase caster, World world, double x, double y, double z, int radius) {
    String pfxName = AMParticleIcons.instance.getParticleForAffinity(SpellUtils.instance.mainAffinityFor(stack));
    float speed = 0.08f * radius;
    int color = 0xFFFFFF;
    if (SpellUtils.instance.modifierIsPresent(SpellModifiers.COLOR, stack, 0)) {
        ISpellModifier[] mods = SpellUtils.instance.getModifiersForStage(stack, 0);
        int ordinalCount = 0;
        for (ISpellModifier mod : mods) {
            if (mod instanceof Colour) {
                byte[] meta = SpellUtils.instance.getModifierMetadataFromStack(stack, mod, 0, ordinalCount++);
                color = (int) mod.getModifier(SpellModifiers.COLOR, null, null, null, meta);
            }
        }
    }
    for (int i = 0; i < 360; i += AMCore.config.FullGFX() ? 20 : AMCore.config.LowGFX() ? 40 : 60) {
        AMParticle effect = (AMParticle) AMCore.instance.proxy.particleManager.spawn(world, pfxName, x, y + 1.5f, z);
        if (effect != null) {
            effect.setIgnoreMaxAge(true);
            effect.AddParticleController(new ParticleMoveOnHeading(effect, i, 0, speed, 1, false));
            effect.noClip = false;
            effect.setRGBColorI(color);
            effect.AddParticleController(new ParticleFadeOut(effect, 1, false).setFadeSpeed(0.05f).setKillParticleOnFinish(true));
            effect.AddParticleController(new ParticleLeaveParticleTrail(effect, pfxName, false, 5, 1, false).addControllerToParticleList(new ParticleFadeOut(effect, 1, false).setFadeSpeed(0.1f).setKillParticleOnFinish(true)).setParticleRGB_I(color).addRandomOffset(0.2f, 0.2f, 0.2f));
        }
    }
}
Also used : ISpellModifier(am2.api.spell.component.interfaces.ISpellModifier) Colour(am2.spell.modifiers.Colour)

Example 7 with Colour

use of am2.spell.modifiers.Colour in project ArsMagica2 by Mithion.

the class AMConfig method init.

public void init() {
    PlayerSpellsDamageTerrain = get(CATEGORY_GENERAL, KEY_PlayerSpellsDamageTerrain, true, "Set to false to prevent terrain damage from player-casted spells.").getBoolean(true);
    NPCSpellsDamageTerrain = get(CATEGORY_GENERAL, KEY_NPCSpellsDamageTerrain, false, "Set to false to prevent terrain damage from NPC-casted spells.").getBoolean(false);
    DamageMultiplier = (float) get(CATEGORY_GENERAL, KEY_DamageMultiplier, 1.0, "How much the damage in Ars Magica is scaled.").getDouble(1.0);
    UseSpecialRenderers = get(CATEGORY_GENERAL, KEY_UseSpecialRenderers, true, "Render spell effects on equipped scrolls rather than the scroll itself (only applies to the in-game one, the one on your hotbar remains unchanged)").getBoolean(true);
    boolean def = !Loader.isModLoaded("NotEnoughItems");
    DisplayManaInInventory = get(CATEGORY_GENERAL, KEY_DisplayManaInInventory, def, "This will toggle mana display on and off in your inventory.  Default 'O' key in game.").getBoolean(def);
    FrictionCoefficient = (float) get(CATEGORY_GENERAL, KEY_FrictionCoefficient, 0.8, "This is the multiplier used to determine velocity lost when a spell projectile bounces. 0.0 is a complete stop, 1.0 is no loss.").getDouble(0.8);
    Property retroWorldGenProp = get(CATEGORY_GENERAL, KEY_RetroactiveWorldGen, false, "Set this to true to enable retroactive worldgen for Ars Magica structures and ores.  *WARNING* This may break your save!  Do a backup first!  Note: This will automatically turn off after running the game once.");
    RetroWorldGen = retroWorldGenProp.getBoolean(false);
    if (RetroWorldGen) {
        retroWorldGenProp.set(false);
    }
    secondarySkillTreeTierCap = get(CATEGORY_GENERAL, KEY_SecondarySkillTreeTierCap, 99, "Sets how far a player may progress into secondary skill trees.").getInt();
    mageVillagerProfessionID = get(CATEGORY_GENERAL, KEY_MageVillagerProfessionID, 29).getInt();
    manaHudPosition = new AMVector2(get(CATEGORY_UI, KEY_ManaHudPositionX, 0.7104166746139526).getDouble(0.7104166746139526), get(CATEGORY_UI, KEY_ManaHudPositionY, 0.9137254953384399).getDouble(0.9137254953384399));
    burnoutHudPosition = new AMVector2(get(CATEGORY_UI, KEY_BurnoutHudPositionX, 0.13333334028720856).getDouble(0.13333334028720856), get(CATEGORY_UI, KEY_BurnoutHudPositionY, 0.9176470637321472).getDouble(0.9176470637321472));
    positiveBuffsPosition = new AMVector2(get(CATEGORY_UI, KEY_BuffsPositivePositionX, 0.5145833492279053).getDouble(0.5145833492279053), get(CATEGORY_UI, KEY_BuffsPositivePositionY, 0.47843137383461).getDouble(0.47843137383461));
    negativeBuffsPosition = new AMVector2(get(CATEGORY_UI, KEY_BuffsNegativePositionX, 0.46666666865348816).getDouble(0.46666666865348816), get(CATEGORY_UI, KEY_BuffsNegativePositionY, 0.47843137383461).getDouble(0.47843137383461));
    levelPosition = new AMVector2(get(CATEGORY_UI, KEY_LevelPositionX, 0.49791666865348816).getDouble(0.49791666865348816), get(CATEGORY_UI, KEY_LevelPositionY, 0.8117647171020508).getDouble(0.8117647171020508));
    affinityPosition = new AMVector2(get(CATEGORY_UI, KEY_AffinityPositionX, 0.9770833253860474).getDouble(0.9770833253860474), get(CATEGORY_UI, KEY_AffinityPositionY, 0.9).getDouble(0.9));
    armorPositionChest = new AMVector2(get(CATEGORY_UI, KEY_ArmorPositionChestX, 0.004166666883975267).getDouble(0.004166666883975267), get(CATEGORY_UI, KEY_ArmorPositionChestY, 0.5568627715110779).getDouble(0.5568627715110779));
    armorPositionHead = new AMVector2(get(CATEGORY_UI, KEY_ArmorPositionHeadX, 0.004166666883975267).getDouble(0.004166666883975267), get(CATEGORY_UI, KEY_ArmorPositionHeadY, 0.5176470875740051).getDouble(0.5176470875740051));
    armorPositionLegs = new AMVector2(get(CATEGORY_UI, KEY_ArmorPositionLegsX, 0.004166666883975267).getDouble(0.004166666883975267), get(CATEGORY_UI, KEY_ArmorPositionLegsY, 0.5960784554481506).getDouble(0.5960784554481506));
    armorPositionBoots = new AMVector2(get(CATEGORY_UI, KEY_ArmorPositionBootsX, 0.004166666883975267).getDouble(0.004166666883975267), get(CATEGORY_UI, KEY_ArmorPositionBootsY, 0.6352941393852234).getDouble(0.6352941393852234));
    xpBarPosition = new AMVector2(get(CATEGORY_UI, KEY_XPBarPositionX, 0.31041666865348816).getDouble(0.31041666865348816), get(CATEGORY_UI, KEY_XPBarPositionY, 0.7843137383460999).getDouble(0.7843137383460999));
    contingencyPosition = new AMVector2(get(CATEGORY_UI, KEY_ContingencyPositionX, 0.0020833334419876337).getDouble(0.0020833334419876337), get(CATEGORY_UI, KEY_ContingencyPositionY, 0.9333333373069763).getDouble(0.9333333373069763));
    manaNumericPosition = new AMVector2(get(CATEGORY_UI, KEY_ManaNumericPositionX, 0.7437499761581421).getDouble(0.7437499761581421), get(CATEGORY_UI, KEY_ManaNumericPositionY, 0.8941176533699036).getDouble(0.8941176533699036));
    burnoutNumericPosition = new AMVector2(get(CATEGORY_UI, KEY_BurnoutNumericPositionX, 0.21041665971279144).getDouble(0.21041665971279144), get(CATEGORY_UI, KEY_BurnoutNumericPositionY, 0.9058823585510254).getDouble(0.9058823585510254));
    XPNumericPosition = new AMVector2(get(CATEGORY_UI, KEY_XPNumericPositionX, 0.47083333134651184).getDouble(0.47083333134651184), get(CATEGORY_UI, KEY_XPNumericPositionY, 0.7450980544090271).getDouble(0.7450980544090271));
    SpellBookPosition = new AMVector2(get(CATEGORY_UI, KEY_SpellBookPositionX, 0.0).getDouble(0.0), get(CATEGORY_UI, KEY_SpellBookPositionY, 0.0).getDouble(0.0));
    showHudMinimally = get(CATEGORY_UI, KEY_ShowHudMinimally, false, "Set this to true to only show the AM HUD when a spell is equipped").getBoolean(false);
    showArmorUI = get(CATEGORY_UI, KEY_ShowArmorUI, true).getBoolean(true);
    showBuffs = get(CATEGORY_UI, KEY_ShowBuffs, true).getBoolean(true);
    showNumerics = get(CATEGORY_UI, KEY_ShowNumerics, false).getBoolean(false);
    showXPAlways = get(CATEGORY_UI, KEY_ShowXPAlways, false).getBoolean(false);
    showHudBars = get(CATEGORY_UI, KEY_ShowHUDBars, true).getBoolean(true);
    witchwoodForestID = get(CATEGORY_GENERAL, KEY_WitchwoodForestBiomeID, 100, "The biome ID for Witchwood Forests. Change this if you run into issues with other mods that add biomes.").getInt();
    witchwoodLeafParticles = get(CATEGORY_GENERAL, KEY_witchwoodLeavesFall, true, "Disable this if you experience low FPS in witchwood forests").getBoolean(true);
    enableWitchwoodForest = get(CATEGORY_GENERAL, KEY_EnableWitchwoodForest, true, "Disable this if you prefer the witchwood forest to not generate").getBoolean(true);
    witchwoodForestRarity = get(CATEGORY_GENERAL, KEY_WitchwoodForestRarity, 6, "Sets how rare witchwood forests are.  Lower is more rare.").getInt();
    allowCreativeTargets = get(CATEGORY_GENERAL, KEY_allowCreativeTargets, true, "Disable this to prevent spell effects on creative players").getBoolean(true);
    moonstoneMeteorsDestroyTerrain = get(CATEGORY_GENERAL, KEY_moonstoneMeteorsDestroyTerrain, true, "Should moonstone meteors destroy terrain when landing?  Keep in mind they will never land on anything other than grass.").getBoolean(true);
    suggestSpellNames = get(CATEGORY_GENERAL, KEY_moonstoneMeteorsDestroyTerrain, true, "Set this to true to allow AM2 to get random spell names from Seventh Sanctum, and suggest them when naming spells.  Naturally, an internet connection is required.  Keep in mind, while I try to keep things family friendly, it's possible that not all names generated are so.").getBoolean(true);
    forgeSmeltsVillagers = get(CATEGORY_GENERAL, KEY_ForgeSmeltsVillagers, true, "Set this to true to have the forge component smelt villagers into emeralds.  This counts as an attack and lowers your reputation.").getBoolean(true);
    everstoneRepairRate = get(CATEGORY_GENERAL, KEY_EverstoneRepairRate, 180, "The time taken, in ticks, for an everstone to repair after breaking.").getInt();
    stagedCompendium = get(CATEGORY_GENERAL, KEY_StagedCompendium, true, "Set this to false to have the compendium show everything, and not unlock as you go.").getBoolean(true);
    colourblindMode = get(CATEGORY_GENERAL, KEY_ColourblindMode, false, "Set this to true to have AM2 list out colours for skill points and essence types rather than showing them as a colour.").getBoolean(false);
    candlesAreRovingLights = get(CATEGORY_GENERAL, KEY_CandlesAreRovingLights, true, "Set this to false to disable candles being able to act as roving lights, which improves performance.").getBoolean(true);
    allowCompendiumUpdates = get(CATEGORY_GENERAL, KEY_AllowCompendiumUpdates, true, "If true, AM2 will automatically download compendium updates when available for your mod version.").getBoolean(true);
    allowVersionChecks = get(CATEGORY_GENERAL, KEY_AllowVersionChecks, true, "If true, AM2 will notify you via the compendium when new versions are available.  It will not spam chat on login.  You will not be notified of updates that are not for your current Minecraft version.").getBoolean(true);
    meteorMinSpawnLevel = get(CATEGORY_GENERAL, KEY_MeteorMinSpawnLevel, 10, "You must reach this magic level before Moonstone meteors will fall near you.").getInt();
    hazardousGateways = get(CATEGORY_GENERAL, KEY_HazardousGateways, true, "Set this to false in order to disable gateways sending you partial distances if you don't have enough power.").getBoolean(true);
    ArmorXPInfusionFactor = get(CATEGORY_GENERAL, KEY_ArmorXPInfusionFactor, 1.0, "Alter this to change the rate at which armor XP infuses.").getDouble();
    disarmAffectsPlayers = get(CATEGORY_GENERAL, KEY_DisarmAffectsPlayers, true, "If false, disarm won't work on players.").getBoolean(true);
    manaCap = get(CATEGORY_GENERAL, KEY_ManaCap, 0, "Sets the maximum mana a player can have (0 for no cap)").getDouble(0);
    digBreaksTileEntities = get(CATEGORY_GENERAL, KEY_DigBreaksTEs, true, "Can the dig component break blocks that have a tile entity?").getBoolean(true);
    savePowerOnWorldSave = get(CATEGORY_GENERAL, KEY_SavePowerOnWorldSave, true, "Set this to false if you are experiencing tick lage due to AM2 saving power data alongside the world save.  This will instead cache the power data in memory to be saved later.  This comes with more risk in the event of a crash, and a larger memory footprint, but increased performance. Can be used alongside chunk unload save config. Power data is still always saved at world unload (server shutdown).").getBoolean(true);
    canDryadsDespawn = get(CATEGORY_MOBS, KEY_CanDryadsDespawn, true, "Set this to false if you don't want dryads to despawn.").getBoolean(true);
    witchwoodFrequency = get(CATEGORY_GENERAL, KEY_WitchwoodFrequency, 35, "The chance of a witchwood tree generating. Lower numbers give more trees.").getInt(35);
    poolFrequency = get(CATEGORY_GENERAL, KEY_EssenceLakeFrequency, 25, "The chance of an etherium pool generating. Lower numbers give more pools.").getInt(25);
    wakebloomFrequency = get(CATEGORY_GENERAL, KEY_WakebloomFrequency, 10, "The chance of a wakebloom generating. Lower numbers give more wakeblooms, and anything less than 7 will attempt to generate in every ocean chunk.").getInt(10);
    flowerGenAttempts = get(CATEGORY_GENERAL, KEY_FlowerGenAttempts, 8, "The number of flower generation attempts made per chunk. Higher numbers give more flowers, but can slow worldgen.").getInt(8);
    vinteumMinHeight = get(CATEGORY_GENERAL, KEY_VinteumMin, 10, "The minimum height for vinteum to generate.").getInt(10);
    vinteumMaxHeight = get(CATEGORY_GENERAL, KEY_VinteumMax, 45, "The maximum height for vinteum to generate.").getInt(45);
    vinteumVeinSize = get(CATEGORY_GENERAL, KEY_VinteumVein, 4, "The number of blocks in a vein of vinteum.").getInt(4);
    vinteumFrequency = get(CATEGORY_GENERAL, KEY_VinteumFreq, 6, "The number of vinteum veins generated per chunk.").getInt(6);
    chimeriteMinHeight = get(CATEGORY_GENERAL, KEY_ChimeriteMin, 10, "The minimum height for chimerite to generate.").getInt(10);
    chimeriteMaxHeight = get(CATEGORY_GENERAL, KEY_ChimeriteMax, 80, "The maximum height for chimerite to generate.").getInt(80);
    chimeriteVeinSize = get(CATEGORY_GENERAL, KEY_ChimeriteVein, 6, "The number of blocks in a vein of chimerite.").getInt(6);
    chimeriteFrequency = get(CATEGORY_GENERAL, KEY_ChimeriteFreq, 8, "The number of chimerite veins generated per chunk.").getInt(6);
    topazMinHeight = get(CATEGORY_GENERAL, KEY_TopazMin, 10, "The minimum height for topaz to generate.").getInt(10);
    topazMaxHeight = get(CATEGORY_GENERAL, KEY_TopazMax, 80, "The maximum height for topaz to generate.").getInt(80);
    topazVeinSize = get(CATEGORY_GENERAL, KEY_TopazVein, 6, "The number of blocks in a vein of topaz.").getInt(6);
    topazFrequency = get(CATEGORY_GENERAL, KEY_TopazFreq, 8, "The number of topaz veins generated per chunk.").getInt(8);
    sunstoneMinHeight = get(CATEGORY_GENERAL, KEY_SunstoneMin, 5, "The minimum height for sunstone to generate.").getInt(5);
    sunstoneMaxHeight = get(CATEGORY_GENERAL, KEY_SunstoneMax, 120, "The maximum height for sunstone to generate.").getInt(120);
    sunstoneVeinSize = get(CATEGORY_GENERAL, KEY_SunstoneVein, 3, "The number of blocks in a vein of sunstone.").getInt(3);
    sunstoneFrequency = get(CATEGORY_GENERAL, KEY_SunstoneFreq, 20, "The number of sunstone veins generated per chunk.").getInt(20);
    enderAffinityAbilityCooldown = get(CATEGORY_GENERAL, KEY_EnderAffinityAbilityCooldown, 100, "Set this to the number of ticks between ender affinity teleports.").getInt();
    String digBlacklistString = get(CATEGORY_GENERAL, KEY_DigDisabledBlocks, "", "Comma-separated list of block IDs that dig cannot break.  If a block is flagged as unbreackable in code, Dig will already be unable to break it.  There is no need to set it here (eg, bedrock, etc.).  Dig also makes use of Forge block harvest checks.  This is mainly for fine-tuning.").getString();
    digBlacklist = digBlacklistString.split(",");
    String worldgenBlackList = get(CATEGORY_GENERAL, KEY_WorldgenBlacklist, "-27,-28,-29", "Comma-separated list of dimension IDs that AM should *not* do worldgen in.").getString();
    String[] split = worldgenBlackList.split(",");
    worldgenBlacklist = new int[split.length];
    int count = 0;
    for (String s : split) {
        if (s.equals(""))
            continue;
        try {
            worldgenBlacklist[count] = Integer.parseInt(s.trim());
        } catch (Throwable t) {
            LogHelper.info("Malformed item in worldgen blacklist (%s).  Skipping.", s);
            t.printStackTrace();
            worldgenBlacklist[count] = -1;
        } finally {
            count++;
        }
    }
    String apBlockBL = get(CATEGORY_GENERAL, KEY_Appropriation_Block_Blacklist, "", "Comma-separated list of block IDs that appropriation cannot pick up.").getString();
    appropriationBlockBlacklist = apBlockBL.split(",");
    String apEntBL = get(CATEGORY_GENERAL, KEY_Appropriation_Mob_Blacklist, "", "Comma-separated list of *fully qualified* Entity class names that appropriation cannot pick up - example, am2.entities.EntityDryad.  They are case sensitive.").getString();
    split = apEntBL.split(",");
    appropriationMobBlacklist = new Class[split.length];
    count = 0;
    for (String s : split) {
        if (s.equals(""))
            continue;
        try {
            appropriationMobBlacklist[count] = Class.forName(s);
        } catch (Throwable t) {
            LogHelper.info("Malformed item in appropriation entity blacklist (%s).  Skipping.", s);
            t.printStackTrace();
            appropriationMobBlacklist[count] = null;
        } finally {
            count++;
        }
    }
    initDirectProperties();
    save();
}
Also used : AMVector2(am2.api.math.AMVector2) Property(net.minecraftforge.common.config.Property)

Example 8 with Colour

use of am2.spell.modifiers.Colour 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 9 with Colour

use of am2.spell.modifiers.Colour in project ArsMagica2 by Mithion.

the class EntitySpellProjectile method setEffectStack.

public void setEffectStack(ItemStack stack) {
    this.dataWatcher.updateObject(DW_EFFECT, stack);
    if (!this.worldObj.isRemote) {
        Affinity aff = SpellUtils.instance.mainAffinityFor(stack);
        switch(aff) {
            case AIR:
                setIcon("wind");
                break;
            case ARCANE:
                setIcon("arcane");
                break;
            case EARTH:
                setIcon("rock");
                break;
            case ENDER:
                setIcon("pulse");
                setColor(0x550055);
                break;
            case FIRE:
                setIcon("explosion_2");
                break;
            case ICE:
                setIcon("ember");
                setColor(0x2299FF);
                break;
            case LIFE:
                setIcon("sparkle");
                setColor(0x22FF44);
                break;
            case LIGHTNING:
                setIcon("lightning_hand");
                break;
            case NATURE:
                setIcon("plant");
                break;
            case WATER:
                setIcon("water_ball");
                break;
            case NONE:
            default:
                setIcon("lens_flare");
                break;
        }
    }
    if (SpellUtils.instance.modifierIsPresent(SpellModifiers.COLOR, stack, 0)) {
        ISpellModifier[] mods = SpellUtils.instance.getModifiersForStage(stack, 0);
        int ordinalCount = 0;
        for (ISpellModifier mod : mods) {
            if (mod instanceof Colour) {
                byte[] meta = SpellUtils.instance.getModifierMetadataFromStack(stack, mod, 0, ordinalCount++);
                setColor((int) mod.getModifier(SpellModifiers.COLOR, null, null, null, meta));
            }
        }
    }
}
Also used : ISpellModifier(am2.api.spell.component.interfaces.ISpellModifier) Affinity(am2.api.spell.enums.Affinity) Colour(am2.spell.modifiers.Colour)

Example 10 with Colour

use of am2.spell.modifiers.Colour 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)

Aggregations

ISpellModifier (am2.api.spell.component.interfaces.ISpellModifier)13 Colour (am2.spell.modifiers.Colour)13 Entity (net.minecraft.entity.Entity)6 EntityLivingBase (net.minecraft.entity.EntityLivingBase)5 EntityDragonPart (net.minecraft.entity.boss.EntityDragonPart)5 ItemStack (net.minecraft.item.ItemStack)3 AMVector3 (am2.api.math.AMVector3)2 ISpellComponent (am2.api.spell.component.interfaces.ISpellComponent)2 ISpellShape (am2.api.spell.component.interfaces.ISpellShape)2 Affinity (am2.api.spell.enums.Affinity)2 AMParticle (am2.particles.AMParticle)2 DummyEntityPlayer (am2.utility.DummyEntityPlayer)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 AMLineSegment (am2.api.math.AMLineSegment)1 AMVector2 (am2.api.math.AMVector2)1 SpellCastResult (am2.api.spell.enums.SpellCastResult)1 BuffEffectFrostSlowed (am2.buffs.BuffEffectFrostSlowed)1 AMBeam (am2.particles.AMBeam)1 ParticleChangeSize (am2.particles.ParticleChangeSize)1 ParticleColorShift (am2.particles.ParticleColorShift)1