extend("fiskheroes:hero_basic");
loadTextures({
    "layer1": "gowhp:odin/odin_layer1",
    "layer2": "gowhp:odin/odin_layer2",
    "eyes": "gowhp:odin/odin_bifrost_eyes",
    "gungnir_closed": "gowhp:odin/gungnir_closed",
    "gungnir_open": "gowhp:odin/gungnir_open",
    "book_of_eldr": "gowhp:odin/book_of_eldr",
});

var utils = implement("fiskheroes:external/utils");
var bifrost_aura = implement("gowhp:external/aura")
var bifrost_aura_fly = implement("gowhp:external/aura_fly")

var gungnir;
var gungnirblade;

function init(renderer) {
    parent.init(renderer);
    renderer.setLights((entity) => (entity.getData("fiskheroes:beam_charging") && (entity.getData("gowhp:dyn/gungnir_runic_cycle") == 0  || entity.getData("gowhp:dyn/gungnir_runic_cycle") == 2)) ? "eyes" : null);
    initEffects(renderer);
}

function initAnimations(renderer) {
    parent.initAnimations(renderer);
    addAnimationWithData(renderer, "odin.BLOCKING", "gowhp:elemental_forcefield", "fiskheroes:shield_blocking_timer")
        .priority = -5;

    renderer.removeCustomAnimation("basic.BLOCKING");
    renderer.removeCustomAnimation("basic.CHARGED_BEAM");
    renderer.removeCustomAnimation("basic.ENERGY_PROJ");
    utils.addFlightAnimationWithLanding(renderer, "odin.FLIGHT", "gowhp:flight/thor.anim.json");
    utils.addHoverAnimation(renderer, "odin.HOVER", "gowhp:flight/idle/thor_idle");
    utils.addAnimationEvent(renderer, "FLIGHT_DIVE", "gowhp:flight/thor_dive");
    addAnimationWithData(renderer, "odin.LAND", "gowhp:flight/thor_landing", "fiskheroes:dyn/superhero_landing_timer")
        .priority = -8;
    addAnimation(renderer, "odin.DISPLAY", "gowhp:leiptra")
        .setData((entity, data) => data.load(1.0))
        .setCondition(entity => (entity.as("DISPLAY").getDisplayType() == "HOLOGRAM"))
        .priority = 20;
    addAnimationWithData(renderer, "odin.LEIPTRA", "gowhp:leiptra", "fiskheroes:beam_charge").setCondition(entity => (entity.getData("gowhp:dyn/gungnir_runic_cycle") == 0));
    addAnimationWithData(renderer, "odin.ELDR", "gowhp:eldr", "fiskheroes:beam_charge").setCondition(entity => (entity.getData("gowhp:dyn/gungnir_runic_cycle") == 1));
    addAnimationWithData(renderer, "odin.GLETTINGSBARACHARGE", "gowhp:glettingsbara_charge", "fiskheroes:beam_charge").setCondition(entity => (entity.getData("gowhp:dyn/gungnirblade") && entity.getData("gowhp:dyn/gungnir_runic_cycle") == 2 && entity.getData("fiskheroes:beam_charging") && !entity.getData("fiskheroes:beam_shooting")));
    addAnimationWithData(renderer, "odin.GLETTINGSBARA", "gowhp:glettingsbara", "fiskheroes:beam_charge").setCondition(entity => (entity.getData("gowhp:dyn/gungnirblade") && entity.getData("gowhp:dyn/gungnir_runic_cycle") == 2 && entity.getData("fiskheroes:beam_shooting")));
    addAnimationWithData(renderer, "odin.GLETTINGSBARADONE", "gowhp:glettingsbara", "fiskheroes:beam_charge").setCondition(entity => (entity.getData("gowhp:dyn/gungnirblade") && entity.getData("gowhp:dyn/gungnir_runic_cycle") == 2 && !entity.getData("fiskheroes:beam_charging")));
}

function initEffects(renderer) {
    gungnirclosed = renderer.createEffect("fiskheroes:model");
    gungnirclosed.setModel(utils.createModel(renderer, "gowhp:gungnir_closed", "gungnir_closed"));
    gungnirclosed.anchor.set("rightArm");
    gungnirclosed.setScale(0.7);
    gungnirclosed.setRotation(90.0, 90.0, 0.0);
    gungnirclosed.setOffset(1.0, 9.0, -7.0);

    gungniropen = renderer.createEffect("fiskheroes:model");
    gungniropen.setModel(utils.createModel(renderer, "gowhp:gungnir_open", "gungnir_open"));
    gungniropen.anchor.set("rightArm");
    gungniropen.setScale(0.7);
    gungniropen.setRotation(90.0, 90.0, 0.0);
    gungniropen.setOffset(1.0, 9.0, -7.0);

    gungnirclosedfp = renderer.createEffect("fiskheroes:model");
    gungnirclosedfp.setModel(utils.createModel(renderer, "gowhp:gungnir_closed", "gungnir_closed"));
    gungnirclosedfp.anchor.set("rightArm");
    gungnirclosedfp.setScale(0.7);
    gungnirclosedfp.setRotation(90.0, 90.0, 0.0);
    gungnirclosedfp.setOffset(1.0, 9.0, 0.0);

    gungniropenfp = renderer.createEffect("fiskheroes:model");
    gungniropenfp.setModel(utils.createModel(renderer, "gowhp:gungnir_open", "gungnir_open"));
    gungniropenfp.anchor.set("rightArm");
    gungniropenfp.setScale(0.7);
    gungniropenfp.setRotation(90.0, 90.0, 0.0);
    gungniropenfp.setOffset(1.0, 9.0, 0.0);

    var book_of_eldr_open = renderer.createResource("MODEL", "gowhp:book_of_eldr");
    book_of_eldr_open.texture.set("book_of_eldr");
    book_of_eldr_open.bindAnimation("gowhp:book_of_eldr").setData((entity, data) => {
		data.load((entity.getData("gowhp:dyn/gungnir_runic_cycle") == 1 && entity.getInterpolatedData("fiskheroes:beam_charge")));
	});
    book_of_eldr = renderer.createEffect("fiskheroes:model").setModel(book_of_eldr_open);
    book_of_eldr.anchor.set("rightArm");

    utils.bindBeam(renderer, "fiskheroes:charged_beam", "gowhp:leiptra", "body", 0x651adf, [
        { "firstPerson": [8.0, -4.0, -9.0], "offset": [0.0, 9.0, -25.0], "size": [2.0, 2.0] }
    ]).setCondition(entity => (entity.getData("gowhp:dyn/gungnir_runic_cycle") == 0)).setParticles(renderer.createResource("PARTICLE_EMITTER", "gowhp:leiptra_smoke"));;

    utils.bindBeam(renderer, "fiskheroes:charged_beam", "gowhp:eldr", "rightArm", 0xe25822, [
        { "firstPerson": [-3.75, 1.0, -6.0], "offset": [-0.5, 14.0, 0.0], "size": [1.5, 1.5] }
    ]).setCondition(entity => (entity.getData("gowhp:dyn/gungnir_runic_cycle") == 1)).setParticles(renderer.createResource("PARTICLE_EMITTER", "gowhp:eldr_impact"));;

    utils.bindParticles(renderer, "gowhp:eldr").setCondition(entity => entity.getData("gowhp:dyn/gungnir_runic_cycle") == 1 &&  entity.getData("fiskheroes:beam_charging"));

    utils.bindBeam(renderer, "fiskheroes:charged_beam", "gowhp:glettingsbara", "body", 0x651adf, [
        { "firstPerson": [0.0, 0.0, 0.0], "offset": [0.0, 0.0, 0.0], "size": [50.0, 50.0] }
    ]).setCondition(entity => (entity.getData("gowhp:dyn/gungnir_runic_cycle") == 2)).setParticles(renderer.createResource("PARTICLE_EMITTER", "gowhp:glettingsbara_impact"));;

    utils.bindBeam(renderer, "fiskheroes:lightning_cast", "gowhp:leiptra", "rightArm", 0x651adf, [
        { "firstPerson": [8.0, -4.0, -9.0], "offset": [-0.5, 5.0, 0.0], "size": [0.75, 0.75] }
    ]);

    var runicchargeshake = renderer.bindProperty("fiskheroes:camera_shake").setCondition(entity => ((entity.getData("gowhp:dyn/gungnir_runic_cycle") == 0 || entity.getData("gowhp:dyn/gungnir_runic_cycle") == 1 || entity.getData("gowhp:dyn/gungnir_runic_cycle") == 2) && entity.getData("fiskheroes:beam_charging") && !entity.getData("fiskheroes:beam_shooting")));
    runicchargeshake.factor = 0.05;

    var runicshake = renderer.bindProperty("fiskheroes:camera_shake").setCondition(entity => ((entity.getData("gowhp:dyn/gungnir_runic_cycle") == 0 || entity.getData("gowhp:dyn/gungnir_runic_cycle") == 1 || entity.getData("gowhp:dyn/gungnir_runic_cycle") == 2) && entity.getData("fiskheroes:beam_charging") && entity.getInterpolatedData("fiskheroes:beam_shooting_timer") > 0));
    runicshake.factor = 0.1;

    var magic = renderer.bindProperty("fiskheroes:spellcasting");
    magic.colorGeneric.set(0x651adf);
    magic.colorEarthCrack.set(0x651adf);
    magic.colorAtmosphere.set(0x651adf);
    magic.colorWhip.set(0x651adf);

    aura = bifrost_aura.init(renderer, 0x651adf);
    aura_fly = bifrost_aura_fly.init(renderer, 0x651adf);

    var bifrost_color = 0x651adf;
    var bifrost_effect = renderer.createResource("BEAM_RENDERER", "gowhp:bifrost");

    leiptrabeams = utils.createLines(renderer, bifrost_effect, bifrost_color, [
        {"start": [0.0, -32.0, 0.0], "end": [0.0, -40.0, -5.0], "size": [30.0, 10.0]},
        {"start": [0.0, -40.0, -5.0], "end": [0.0, -40.0, -15.0], "size": [30.0, 10.0]},
        {"start": [0.0, -40.0, -15.0], "end": [0.0, 10.0, -25.0], "size": [30.0, 10.0]},

        {"start": [-5.0, 10.0, 0.0], "end": [-15.0, 10.0, -5.0], "size": [10.0, 30.0]},
        {"start": [-15.0, 10.0, -5.0], "end": [-15.0, 10.0, -15.0], "size": [10.0, 30.0]},
        {"start": [-15.0, 10.0, -15.0], "end": [-1.0, 10.0, -25.0], "size": [10.0, 30.0]},

        {"start": [5.0, 10.0, 0.0], "end": [15.0, 10.0, -5.0], "size": [10.0, 30.0]},
        {"start": [15.0, 10.0, -5.0], "end": [15.0, 10.0, -15.0], "size": [10.0, 30.0]},
        {"start": [15.0, 10.0, -15.0], "end": [1.0, 10.0, -25.0], "size": [10.0, 30.0]},
    ]);
    leiptrabeams.anchor.set("body");
    leiptrabeams.setScale(1.0);
    leiptrabeams.mirror = false;

    gungnirbifrost = utils.createLines(renderer, bifrost_effect, bifrost_color, [
        {"start": [-1.0, 9.0, 33.0], "end": [-1.0, 9.0, -30.0], "size": [15.0, 15.0]},

        {"start": [-1.0, 9.0, -27.5], "end": [-1.0, 9.0, -34.0], "size": [25.0, 25.0]},

        {"start": [-1.0, 9.0, -30.0], "end": [-1.0, 7.5, -31.2], "size": [25.0, 15.0]},
        {"start": [-1.0, 9.0, -30.0], "end": [-1.0, 10.5, -31.2], "size": [25.0, 15.0]},

        {"start": [-1.0, 7.5, -33.0], "end": [-1.0, 10.5, -33.0], "size": [25.0, 15.0]},

        {"start": [-1.0, 10.5, -33.5], "end": [-1.0, 11.5, -32.0], "size": [22.0, 15.0]},
        {"start": [-1.0, 7.5, -33.5], "end": [-1.0, 6.5, -32.0], "size": [22.0, 15.0]},
    ]);
    gungnirbifrost.anchor.set("rightArm");
    gungnirbifrost.setScale(1.0);
    gungnirbifrost.mirror = false;

    gungnirbladebifrost = utils.createLines(renderer, bifrost_effect, bifrost_color, [
        {"start": [-1.0, 8.3, -34.0], "end": [-1.0, 9.0, -46.6], "size": [15.0, 15.0]},
        {"start": [-1.0, 9.7, -34.0], "end": [-1.0, 9.0, -46.6], "size": [15.0, 15.0]},
    ]);
    gungnirbladebifrost.anchor.set("rightArm");
    gungnirbladebifrost.setScale(1.0);
    gungnirbladebifrost.mirror = false;

    gungnirequip = utils.createLines(renderer, bifrost_effect, bifrost_color, [
        {"start": [-1.0, 9.0, 33.0], "end": [-1.0, 9.0, -90.0], "size": [15.0, 15.0]},

        {"start": [-1.0, 9.0, -27.5], "end": [-1.0, 9.0, -34.0], "size": [25.0, 25.0]},

        {"start": [-1.0, 9.0, -30.0], "end": [-1.0, 7.5, -31.2], "size": [25.0, 15.0]},
        {"start": [-1.0, 9.0, -30.0], "end": [-1.0, 10.5, -31.2], "size": [25.0, 15.0]},

        {"start": [-1.0, 7.5, -33.0], "end": [-1.0, 10.5, -33.0], "size": [25.0, 15.0]},

        {"start": [-1.0, 10.5, -33.5], "end": [-1.0, 11.5, -32.0], "size": [22.0, 15.0]},
        {"start": [-1.0, 7.5, -33.5], "end": [-1.0, 6.5, -32.0], "size": [22.0, 15.0]},
    ]);
    gungnirequip.anchor.set("rightArm");
    gungnirequip.setScale(1.0);
    gungnirequip.mirror = false;

    gungnirbladeequip = utils.createLines(renderer, bifrost_effect, bifrost_color, [
        {"start": [-1.0, 8.3, -34.0], "end": [-1.0, 9.0, -60.0], "size": [15.0, 15.0]},
        {"start": [-1.0, 9.7, -34.0], "end": [-1.0, 9.0, -60.0], "size": [15.0, 15.0]},
    ]);
    gungnirbladeequip.anchor.set("rightArm");
    gungnirbladeequip.setScale(1.0);
    gungnirbladeequip.mirror = false;

    gungnirbifrostfp = utils.createLines(renderer, bifrost_effect, bifrost_color, [
        {"start": [-1.0, 9.0, 33.0], "end": [-1.0, 9.0, -23.0], "size": [15.0, 15.0]},

        {"start": [-1.0, 9.0, -20.5], "end": [-1.0, 9.0, -27.0], "size": [25.0, 25.0]},

        {"start": [-1.0, 9.0, -23.0], "end": [-1.0, 7.5, -24.2], "size": [25.0, 15.0]},
        {"start": [-1.0, 9.0, -23.0], "end": [-1.0, 10.5, -24.2], "size": [25.0, 15.0]},

        {"start": [-1.0, 7.5, -26.0], "end": [-1.0, 10.5, -26.0], "size": [25.0, 15.0]},

        {"start": [-1.0, 10.5, -26.5], "end": [-1.0, 11.5, -25.0], "size": [22.0, 15.0]},
        {"start": [-1.0, 7.5, -26.5], "end": [-1.0, 6.5, -25.0], "size": [22.0, 15.0]},
    ]);
    gungnirbifrostfp.anchor.set("rightArm");
    gungnirbifrostfp.setScale(1.0);
    gungnirbifrostfp.mirror = false;

    gungnirbladebifrostfp = utils.createLines(renderer, bifrost_effect, bifrost_color, [
        {"start": [-1.0, 8.3, -27.0], "end": [-1.0, 9.0, -39.6], "size": [15.0, 15.0]},
        {"start": [-1.0, 9.7, -27.0], "end": [-1.0, 9.0, -39.6], "size": [15.0, 15.0]},
    ]);
    gungnirbladebifrostfp.anchor.set("rightArm");
    gungnirbladebifrostfp.setScale(1.0);
    gungnirbladebifrostfp.mirror = false;

    gungnirequipfp = utils.createLines(renderer, bifrost_effect, bifrost_color, [
        {"start": [-1.0, 9.0, 33.0], "end": [-1.0, 9.0, -93.0], "size": [15.0, 15.0]},

        {"start": [-1.0, 9.0, -20.5], "end": [-1.0, 9.0, -27.0], "size": [25.0, 25.0]},

        {"start": [-1.0, 9.0, -23.0], "end": [-1.0, 7.5, -24.2], "size": [25.0, 15.0]},
        {"start": [-1.0, 9.0, -23.0], "end": [-1.0, 10.5, -24.2], "size": [25.0, 15.0]},

        {"start": [-1.0, 7.5, -26.0], "end": [-1.0, 10.5, -26.0], "size": [25.0, 15.0]},

        {"start": [-1.0, 10.5, -26.5], "end": [-1.0, 11.5, -25.0], "size": [22.0, 15.0]},
        {"start": [-1.0, 7.5, -26.5], "end": [-1.0, 6.5, -25.0], "size": [22.0, 15.0]},
    ]);
    gungnirequipfp.anchor.set("rightArm");
    gungnirequipfp.setScale(1.0);
    gungnirequipfp.mirror = false;

    gungnirbladeequipfp = utils.createLines(renderer, bifrost_effect, bifrost_color, [
        {"start": [-1.0, 8.3, -27.0], "end": [-1.0, 9.0, -53.0], "size": [15.0, 15.0]},
        {"start": [-1.0, 9.7, -27.0], "end": [-1.0, 9.0, -53.0], "size": [15.0, 15.0]},
    ]);
    gungnirbladeequipfp.anchor.set("rightArm");
    gungnirbladeequipfp.setScale(1.0);
    gungnirbladeequipfp.mirror = false;

    var forcefield1 = renderer.bindProperty("fiskheroes:forcefield");
    forcefield1.color.set(0x651adf);
    forcefield1.setShape(30, 15).setOffset(0.0, 6.0, 0.0).setScale(1.55);
    forcefield1.setCondition(entity => {
        forcefield1.opacity = entity.getInterpolatedData("fiskheroes:shield_blocking_timer") * 0.1;
        return true;
    });

    var forcefield2 = renderer.bindProperty("fiskheroes:forcefield");
    forcefield2.color.set(0xe25822);
    forcefield2.setShape(20, 10).setOffset(0.0, 6.0, 0.0).setScale(1.5);
    forcefield2.setCondition(entity => {
        forcefield2.opacity = entity.getInterpolatedData("fiskheroes:shield_blocking_timer") * 0.2;
        return true;
    });

    var forcefield3 = renderer.bindProperty("fiskheroes:forcefield");
    forcefield3.color.set(0x4CB5FF);
    forcefield3.setShape(10, 5).setOffset(0.0, 6.0, 0.0).setScale(1.45);
    forcefield3.setCondition(entity => {
        forcefield3.opacity = entity.getInterpolatedData("fiskheroes:shield_blocking_timer") * 0.3;
        return true;
    });

    utils.bindParticles(renderer, "gowhp:elemental_forcefield").setCondition(entity => entity.getInterpolatedData("fiskheroes:shield_blocking"));

    var leiptraorb = renderer.bindProperty("fiskheroes:forcefield");
    leiptraorb.color.set(0x651adf);
    leiptraorb.setShape(36, 18).setOffset(0.0, 7.0, 0.0).setScale(0.9, 1.15, 0.9);
    leiptraorb.setCondition(entity => {
        leiptraorb.opacity = (entity.getData("gowhp:dyn/gungnir_runic_cycle") == 0) && (entity.getInterpolatedData('fiskheroes:beam_charge') * 0.1);
        return true;
    });

    var leiptraorbdisplay = renderer.bindProperty("fiskheroes:forcefield");
    leiptraorbdisplay.color.set(0x651adf);
    leiptraorbdisplay.setShape(36, 18).setOffset(0.0, 7.0, 0.0).setScale(0.9, 1.15, 0.9);
    leiptraorbdisplay.setCondition(entity => {
        leiptraorbdisplay.opacity = 0.1;
        return entity.as("DISPLAY").getDisplayType() == "HOLOGRAM";
    });

    var eldrorb = renderer.bindProperty("fiskheroes:forcefield");
    eldrorb.color.set(0xe25822);
    eldrorb.setShape(60, 30).setOffset(0.0, 6.0, 0.0).setScale(1.3);
    eldrorb.setCondition(entity => {
        eldrorb.opacity = (entity.getData("gowhp:dyn/gungnir_runic_cycle") == 1) && (entity.getInterpolatedData('fiskheroes:beam_charge') * 0.2);
        return true;;
    });

    utils.bindParticles(renderer, "gowhp:bifrost_effect").setCondition(entity => (entity.getData("fiskheroes:beam_charging") && (entity.getData("gowhp:dyn/gungnir_runic_cycle") == 0  || entity.getData("gowhp:dyn/gungnir_runic_cycle") == 2)) || (entity.getData("fiskheroes:flying")));

    utils.bindParticles(renderer, "gowhp:glettingsbara").setCondition(entity => entity.getData("gowhp:dyn/gungnir_runic_cycle") == 2 &&  entity.getData("fiskheroes:beam_shooting_timer") > 0);

    utils.bindTrail(renderer, "gowhp:bifrost").setCondition(entity => (entity.getData("fiskheroes:beam_charging") && entity.getData("gowhp:dyn/gungnir_runic_cycle") == 0));
}

function render(entity, renderLayer, isFirstPersonArm) {
    if (!isFirstPersonArm && (entity.getInterpolatedData("gowhp:dyn/gungnir_timer") > 0.5) || (entity.as("DISPLAY").getDisplayType() == "HOLOGRAM" || entity.as("DISPLAY").getDisplayType() == "DATABASE_PREVIEW" || entity.as("DISPLAY").getDisplayType() == "FABRICATOR_PREVIEW" || entity.as("DISPLAY").getDisplayType() == "ITERATOR_PREVIEW" || entity.as("DISPLAY").getDisplayType() == "BOOK_PREVIEW") && !(entity.getInterpolatedData("gowhp:dyn/gungnirblade_timer") > 0.5)) {
        gungnirclosed.render();
    }
    if (isFirstPersonArm && (entity.getInterpolatedData("gowhp:dyn/gungnir_timer") > 0.5) && !(entity.getInterpolatedData("gowhp:dyn/gungnirblade_timer") > 0.5)) {
        gungnirclosedfp.render();
    }
    if (!isFirstPersonArm && entity.getInterpolatedData('gowhp:dyn/gungnir_timer') > 0 && entity.getInterpolatedData('gowhp:dyn/gungnir_timer') < 0.5){
        gungnirequip.progress = Math.max(1 - (1 - entity.getInterpolatedData('gowhp:dyn/gungnir_timer')) * 1, 0);
        gungnirequip.opacity = Math.max(1 - (1 - entity.getInterpolatedData('gowhp:dyn/gungnir_timer')) * 1, 0);
        gungnirequip.render();
    }
    if (isFirstPersonArm && entity.getInterpolatedData('gowhp:dyn/gungnir_timer') > 0 && entity.getInterpolatedData('gowhp:dyn/gungnir_timer') < 0.5){
        gungnirequipfp.progress = Math.max(1 - (1 - entity.getInterpolatedData('gowhp:dyn/gungnir_timer')) * 1, 0);
        gungnirequipfp.opacity = Math.max(1 - (1 - entity.getInterpolatedData('gowhp:dyn/gungnir_timer')) * 1, 0);
        gungnirequipfp.render();
    }
    if (!isFirstPersonArm && (entity.getInterpolatedData("gowhp:dyn/gungnirblade_timer") > 0.5) && (entity.getHeldItem().isEmpty())) {
        gungniropen.render();
    }
    if (isFirstPersonArm && (entity.getInterpolatedData("gowhp:dyn/gungnirblade_timer") > 0.5) && (entity.getHeldItem().isEmpty())) {
        gungniropenfp.render();
    }
    if (!isFirstPersonArm && (entity.getInterpolatedData('gowhp:dyn/gungnirblade_timer') > 0 && entity.getInterpolatedData('gowhp:dyn/gungnirblade_timer') < 0.5)){
        gungnirbladeequip.progress = Math.max(1 - (1 - entity.getInterpolatedData('gowhp:dyn/gungnirblade_timer')) * 1, 0);
        gungnirbladeequip.opacity = Math.max(1 - (1 - entity.getInterpolatedData('gowhp:dyn/gungnirblade_timer')) * 1, 0);
        gungnirbladeequip.render();
    }
    if (isFirstPersonArm && (entity.getInterpolatedData('gowhp:dyn/gungnirblade_timer') > 0 && entity.getInterpolatedData('gowhp:dyn/gungnirblade_timer') < 0.5)){
        gungnirbladeequipfp.progress = Math.max(1 - (1 - entity.getInterpolatedData('gowhp:dyn/gungnirblade_timer')) * 1, 0);
        gungnirbladeequipfp.opacity = Math.max(1 - (1 - entity.getInterpolatedData('gowhp:dyn/gungnirblade_timer')) * 1, 0);
        gungnirbladeequipfp.render();
    }
    if (entity.getData("fiskheroes:beam_charge") && entity.getData("gowhp:dyn/gungnir_runic_cycle") == 0){
        leiptrabeams.progress = Math.max(1 - (1 - entity.getInterpolatedData('fiskheroes:beam_charge')) * 1, 0);
        leiptrabeams.opacity = Math.max(1 - (1 - entity.getInterpolatedData('fiskheroes:beam_charge')) * 1, 0);
        leiptrabeams.render();
    }
    if ((entity.as("DISPLAY").getDisplayType() == "HOLOGRAM")){
        leiptrabeams.progress = true;
        leiptrabeams.opacity = true;
        leiptrabeams.render();
    }
    if (!isFirstPersonArm && (entity.getData("fiskheroes:beam_charge") && (entity.getData("gowhp:dyn/gungnir_runic_cycle") == 0 || entity.getData("gowhp:dyn/gungnir_runic_cycle") == 2))){
        gungnirbifrost.opacity = Math.max(1 - (1 - entity.getInterpolatedData('fiskheroes:beam_charge')) * 1, 0);
        gungnirbifrost.render();
    }
    if (!isFirstPersonArm && (entity.getData("fiskheroes:flying") || entity.getInterpolatedData("fiskheroes:shield_blocking") || (entity.as("DISPLAY").getDisplayType() == "HOLOGRAM"))){
        gungnirbifrost.progress = true;
        gungnirbifrost.opacity = true;
        gungnirbifrost.render();
    }
    if (isFirstPersonArm && (entity.getData("fiskheroes:beam_charge") && (entity.getData("gowhp:dyn/gungnir_runic_cycle") == 0 || entity.getData("gowhp:dyn/gungnir_runic_cycle") == 2))){
        gungnirbifrostfp.opacity = Math.max(1 - (1 - entity.getInterpolatedData('fiskheroes:beam_charge')) * 1, 0);
        gungnirbifrostfp.render();
    }
    if (isFirstPersonArm && (entity.getData("fiskheroes:flying") || entity.getInterpolatedData("fiskheroes:shield_blocking") || (entity.as("DISPLAY").getDisplayType() == "HOLOGRAM"))){
        gungnirbifrostfp.progress = true;
        gungnirbifrostfp.opacity = true;
        gungnirbifrostfp.render();
    }
    if (!isFirstPersonArm && (entity.getData("gowhp:dyn/gungnirblade") && (entity.getData("fiskheroes:beam_charge") && (entity.getData("gowhp:dyn/gungnir_runic_cycle") == 0  || entity.getData("gowhp:dyn/gungnir_runic_cycle") == 2)))){
        gungnirbladebifrost.opacity = Math.max(1 - (1 - entity.getInterpolatedData('fiskheroes:beam_charge')) * 1, 0);
        gungnirbladebifrost.render();
    }
    if (!isFirstPersonArm && (entity.getData("gowhp:dyn/gungnirblade") && (entity.getData("fiskheroes:flying") || entity.getInterpolatedData("fiskheroes:shield_blocking")))){
        gungnirbladebifrost.progress = Math.max(1 - (1 - entity.getInterpolatedData('gowhp:dyn/gungnirblade_timer')) * 1, 0);
        gungnirbladebifrost.opacity = true;
        gungnirbladebifrost.render();
    }
    if (isFirstPersonArm && (entity.getData("gowhp:dyn/gungnirblade") && (entity.getData("fiskheroes:beam_charge") && (entity.getData("gowhp:dyn/gungnir_runic_cycle") == 0  || entity.getData("gowhp:dyn/gungnir_runic_cycle") == 2)))){
        gungnirbladebifrostfp.opacity = Math.max(1 - (1 - entity.getInterpolatedData('fiskheroes:beam_charge')) * 1, 0);
        gungnirbladebifrostfp.render();
    }
    if (isFirstPersonArm && (entity.getData("gowhp:dyn/gungnirblade") && (entity.getData("fiskheroes:flying") || entity.getInterpolatedData("fiskheroes:shield_blocking")))){
        gungnirbladebifrostfp.progress = Math.max(1 - (1 - entity.getInterpolatedData('gowhp:dyn/gungnirblade_timer')) * 1, 0);
        gungnirbladebifrostfp.opacity = true;
        gungnirbladebifrostfp.render();
    }
    if ((entity.getData("fiskheroes:beam_charge") && (entity.getData("gowhp:dyn/gungnir_runic_cycle") == 0 || entity.getData("gowhp:dyn/gungnir_runic_cycle") == 2)) || (entity.as("DISPLAY").getDisplayType() == "HOLOGRAM")){
        aura.render(entity, renderLayer);
    }
    if (entity.getData("fiskheroes:flying")){
        aura_fly.render(entity, renderLayer);
    }
    if ((entity.getData("fiskheroes:beam_charge") && entity.getData("gowhp:dyn/gungnir_runic_cycle") == 1)){
        book_of_eldr.render();
    }
}