extend("fiskheroes:hero_basic");
loadTextures({
    "layer1": "gowhp:thor/thor_layer1",
    "layer2": "gowhp:thor/thor_layer2",
    "eyes": "gowhp:thor/thor_lightning_eyes",
    "beard": "gowhp:thor/thorbeard",
    "belly": "gowhp:thor/thorbelly",
    "mjolnir": "gowhp:thor/mjolnir",
    "mjolnir_lights": "gowhp:thor/mjolnir_lights"
});

var utils = implement("fiskheroes:external/utils");

var mjolnir;
var mjolnirholster;
var mjolnirthrow;

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

function initAnimations(renderer) {
    parent.initAnimations(renderer);
    renderer.removeCustomAnimation("basic.CHARGED_BEAM");
    renderer.removeCustomAnimation("basic.ENERGY_PROJ");
    utils.addFlightAnimationWithLanding(renderer, "thor.FLIGHT", "gowhp:flight/thor.anim.json");
    utils.addHoverAnimation(renderer, "thor.HOVER", "gowhp:flight/idle/thor_idle");
    utils.addAnimationEvent(renderer, "FLIGHT_DIVE", "gowhp:flight/thor_dive");

    addAnimationWithData(renderer, "thor.LAND", "gowhp:flight/thor_landing", "fiskheroes:dyn/superhero_landing_timer")
        .priority = -8;

    addAnimationWithData(renderer, "thor.ROLL", "gowhp:flight/thor_roll", "fiskheroes:barrel_roll_timer")
        .priority = 10;

    addAnimation(renderer, "thor.DISPLAY", "gowhp:flight/idle/thor_display")
        .setData((entity, data) => data.load(1.0))
        .setCondition(entity => (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"))
        .priority = 20;
    addAnimation(renderer, "thor.SPRINT", "gowhp:sprint_thor")
        .setData((entity, data) => data.load(1.0))
        .setCondition(entity => (entity.isSprinting() && !entity.getData("fiskheroes:flying")))
        .priority = 21;
    addAnimationWithData(renderer, "thor.MJOLNIRTHROW", "gowhp:throwaiming", "fiskheroes:beam_charge").setCondition(entity => (entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 0));
    addAnimationWithData(renderer, "thor.MJOLNIRUNHOLSTER", "gowhp:mjolnirunholster", "gowhp:dyn/mjolnir_timer");
    addAnimationWithData(renderer, "thor.MJOLNIRFIRSTPERSON", "gowhp:weaponfirstperson", "gowhp:dyn/mjolnir").setCondition(entity => (!entity.getInterpolatedData("gowhp:dyn/mjolnirthrowanimation_timer") && entity.getInterpolatedData("gowhp:dyn/mjolnir_timer") > 0.5 && !entity.isPunching()));
    addAnimationWithData(renderer, "thor.THUNDERCLAPCHARGE", "gowhp:thunderclap_charge", "fiskheroes:beam_charge").setCondition(entity => (!entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/thor_ability_cycle") == 0 && entity.getData("fiskheroes:beam_charging") && !entity.getData("fiskheroes:beam_shooting")));
    addAnimationWithData(renderer, "thor.THUNDERCLAP", "gowhp:thunderclap", "fiskheroes:beam_charge").setCondition(entity => (!entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/thor_ability_cycle") == 0 && entity.getData("fiskheroes:beam_shooting")));
    addAnimationWithData(renderer, "thor.THUNDERCLAPDONE", "gowhp:thunderclap", "fiskheroes:beam_charge").setCondition(entity => (!entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/thor_ability_cycle") == 0 && !entity.getData("fiskheroes:beam_charging")));
    addAnimationWithData(renderer, "thor.THUNDERBLASTCHARGE", "gowhp:thunderblast_charge", "fiskheroes:beam_charge").setCondition(entity => (entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 1 && entity.getData("fiskheroes:beam_charging") && !entity.getData("fiskheroes:beam_shooting")));
    addAnimationWithData(renderer, "thor.THUNDERBLAST", "gowhp:thunderblast", "fiskheroes:beam_charge").setCondition(entity => (entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 1 && entity.getData("fiskheroes:beam_shooting")));
    addAnimationWithData(renderer, "thor.THUNDERBLASTDONE", "gowhp:thunderblast", "fiskheroes:beam_charge").setCondition(entity => (entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 1 && !entity.getData("fiskheroes:beam_charging")));
    addAnimationWithData(renderer, "thor.MJOLNIRSLAMCHARGE", "gowhp:mjolnirslam_charge", "fiskheroes:beam_charge").setCondition(entity => (entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 2 && entity.getData("fiskheroes:beam_charging") && !entity.getData("fiskheroes:beam_shooting")));
    addAnimationWithData(renderer, "thor.MJOLNIRSLAM", "gowhp:mjolnirslam", "fiskheroes:beam_charge").setCondition(entity => (entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 2 && entity.getData("fiskheroes:beam_shooting")));
    addAnimationWithData(renderer, "thor.MJOLNIRSLAMDONE", "gowhp:mjolnirslam", "fiskheroes:beam_charge").setCondition(entity => (entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 2 && !entity.getData("fiskheroes:beam_charging")));
}

function initEffects(renderer) {
    beard = renderer.createEffect("fiskheroes:model");
    beard.setModel(utils.createModel(renderer, "gowhp:thorbeard", "beard"));
    beard.anchor.set("head");

    belly = renderer.createEffect("fiskheroes:model");
    belly.setModel(utils.createModel(renderer, "gowhp:thorbelly", "belly"));
    belly.anchor.set("body");

    var mjolnirthrow = renderer.createResource("MODEL", "gowhp:mjolnir");
    mjolnirthrow.texture.set("mjolnir", "mjolnir_lights");
    mjolnirthrow.bindAnimation("gowhp:mjolnirthrow").setData((entity, data) => {
		data.load(entity.getInterpolatedData("gowhp:dyn/mjolnirthrowanimation_timer"));
	});
    mjolnir = renderer.createEffect("fiskheroes:model").setModel(mjolnirthrow);
    mjolnir.anchor.set("rightArm");
    mjolnir.setScale(0.45);
    mjolnir.setRotation(90.0, 90.0, 0.0);
    mjolnir.setOffset(1.0, 8.5, -8.2);

    var mjolnirunholsteranimation = renderer.createResource("MODEL", "gowhp:mjolnir");
    mjolnirunholsteranimation.texture.set("mjolnir", "mjolnir_lights");
    mjolnirunholsteranimation.bindAnimation("gowhp:mjolnirunholsteranimation").setData((entity, data) => {
		data.load(entity.getInterpolatedData("gowhp:dyn/mjolnir_timer"));
	});
    mjolnirholster = renderer.createEffect("fiskheroes:model").setModel(mjolnirunholsteranimation);
    mjolnirholster.anchor.set("body");
    mjolnirholster.setScale(0.45);
    mjolnirholster.setRotation(90.0, 100.0, 90.0);
    mjolnirholster.setOffset(6.0, 20.0, 0.0);

    utils.bindBeam(renderer, "fiskheroes:charged_beam", "gowhp:invisible", "rightArm", 0x1e68c7, [
        { "firstPerson": [-6.5, -2.5, -9.0], "offset": [-0.5, 8.0, -14.0], "size": [2.0, 2.0] }
    ]).setCondition(entity => (entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 0));

    utils.bindBeam(renderer, "fiskheroes:charged_beam", "gowhp:lightning", "rightArm", 0x1e68c7, [
        { "firstPerson": [-2.0, 0.5, -6.0], "offset": [-0.5, 11.0, -8.0], "size": [2.0, 2.0] }
    ]).setCondition(entity => (entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 1));

    utils.bindBeam(renderer, "fiskheroes:charged_beam", "gowhp:wave", "body", 0x1e68c7, [
        { "firstPerson": [0.0, 11.0, 0.0], "offset": [0.5, 11.0, -5.0], "size": [100.0, 1.0] }
    ]).setCondition(entity => (entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 2)).setParticles(renderer.createResource("PARTICLE_EMITTER", "gowhp:mjolnirslam_impact"));;

    utils.bindBeam(renderer, "fiskheroes:lightning_cast", "gowhp:lightningcast", "rightArm", 0x1e68c7, [
        { "firstPerson": [0.0, 1.0, 0.0], "offset": [-0.5, 8.0, -6.0], "size": [0.75, 0.75] }
    ]);

    utils.bindBeam(renderer, "fiskheroes:charged_beam", "gowhp:wave", "body", 0x1e68c7, [
        { "firstPerson": [0.0, 2.0, 0.0], "offset": [0.0, 1.0, -3.0], "size": [10.0, 1.0] }
    ]).setCondition(entity => (!entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/thor_ability_cycle") == 0));

    var runicchargeshake = renderer.bindProperty("fiskheroes:camera_shake").setCondition(entity => (((!entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/thor_ability_cycle") == 0) || (entity.getData("gowhp:dyn/mjolnir") && (entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 1 || entity.getData("gowhp:dyn/mjolnir_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/mjolnir") && entity.getData("gowhp:dyn/thor_ability_cycle") == 0) || (entity.getData("gowhp:dyn/mjolnir") && (entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 1 || entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 2))) && entity.getData("fiskheroes:beam_charging") && entity.getInterpolatedData("fiskheroes:beam_shooting_timer") > 0));
    runicshake.factor = 0.1;

    var lightningsurge_color = 0x1e68c7;
    var lightningsurge_beam = renderer.createResource("BEAM_RENDERER", "gowhp:lightningsurge");
    var lightningsurgemjolnir_beam = renderer.createResource("BEAM_RENDERER", "gowhp:lightningsurge_mjolnir");
    var lightning_beam = renderer.createResource("BEAM_RENDERER", "gowhp:lightningstrike");

    lightningsurgearm = utils.createLines(renderer, lightningsurge_beam, lightningsurge_color, [
        {"start": [-1.3, -1.0, -1.1], "end": [-1.7, 6.5, -1.1], "size": [10.0, 10.0]},
        {"start": [-1.7, -1.0, -1.1], "end": [0.3, 6.5, -1.1], "size": [10.0, 10.0]},

        {"start": [-1.3, -1.0, 1.1], "end": [-1.7, 6.5, 1.1], "size": [10.0, 10.0]},
        {"start": [-1.7, -1.0, 1.1], "end": [0.3, 6.5, 1.1], "size": [10.0, 10.0]},

        {"start": [-1.8, -1.0, 1.0], "end": [-1.8, 6.5, -1.0], "size": [10.0, 10.0]},
        {"start": [-1.8, -1.0, -1.0], "end": [-1.8, 6.5, 1.0], "size": [10.0, 10.0]},

        {"start": [0.4, -1.0, 1.0], "end": [0.4, 6.5, -1.0], "size": [10.0, 10.0]},
        {"start": [0.4, -1.0, -1.0], "end": [0.4, 6.5, 1.0], "size": [10.0, 10.0]},
    ]);
    lightningsurgearm.anchor.set("rightArm");
    lightningsurgearm.setScale(1.5);
    lightningsurgearm.mirror = false;

    lightningsurgearms = utils.createLines(renderer, lightningsurge_beam, lightningsurge_color, [
        {"start": [-1.3, -1.0, -1.1], "end": [1.7, 6.5, -1.1], "size": [10.0, 10.0]},
        {"start": [1.7, -1.0, -1.1], "end": [0.3, 6.5, -1.1], "size": [10.0, 10.0]},

        {"start": [-1.3, -1.0, 1.1], "end": [1.7, 6.5, 1.1], "size": [10.0, 10.0]},
        {"start": [1.7, -1.0, 1.1], "end": [0.3, 6.5, 1.1], "size": [10.0, 10.0]},

        {"start": [1.8, -1.0, 1.0], "end": [1.8, 6.5, -1.0], "size": [10.0, 10.0]},
        {"start": [1.8, -1.0, -1.0], "end": [1.8, 6.5, 1.0], "size": [10.0, 10.0]},

        {"start": [-0.4, -1.0, 1.0], "end": [-0.4, 6.5, -1.0], "size": [10.0, 10.0]},
        {"start": [-0.4, -1.0, -1.0], "end": [-0.4, 6.5, 1.0], "size": [10.0, 10.0]},
    ]);
    lightningsurgearms.anchor.set("leftArm");
    lightningsurgearms.setScale(1.5);
    lightningsurgearms.mirror = true;

    lightningsurgelegs = utils.createLines(renderer, lightningsurge_beam, lightningsurge_color, [
        {"start": [-1.0, 0.0, -1.1], "end": [1.2, 7.5, -1.1], "size": [10.0, 10.0]},
        {"start": [1.2, 0.0, -1.1], "end": [-1.0, 7.5, -1.1], "size": [10.0, 10.0]},

        {"start": [-1.0, 0.0, 1.1], "end": [1.2, 7.5, 1.1], "size": [10.0, 10.0]},
        {"start": [1.2, 0.0, 1.1], "end": [-1.0, 7.5, 1.1], "size": [10.0, 10.0]},

        {"start": [-1.2, 0.0, 1.0], "end": [-1.2, 7.5, -1.0], "size": [10.0, 10.0]},
        {"start": [-1.2, 0.0, -1.0], "end": [-1.2, 7.5, 1.0], "size": [10.0, 10.0]},

        {"start": [1.2, 0.0, 1.0], "end": [1.2, 7.5, -1.0], "size": [10.0, 10.0]},
        {"start": [1.2, 0.0, -1.0], "end": [1.2, 7.5, 1.0], "size": [10.0, 10.0]},
    ]);
    lightningsurgelegs.anchor.set("rightLeg");
    lightningsurgelegs.setScale(1.5);
    lightningsurgelegs.mirror = true;

    lightningsurgebody = utils.createLines(renderer, lightningsurge_beam, lightningsurge_color, [
        {"start": [3.5, 0.0, -1.4], "end": [-3.5, 7.5, -1.4], "size": [10.0, 10.0]},
        {"start": [-3.5, 0.0, -1.4], "end": [3.5, 7.5, -1.4], "size": [10.0, 10.0]},

        {"start": [3.5, 0.0, 1.4], "end": [-3.5, 7.5, 1.4], "size": [10.0, 10.0]},
        {"start": [-3.5, 0.0, 1.4], "end": [3.5, 7.5, 1.4], "size": [10.0, 10.0]},
    ]);
    lightningsurgebody.anchor.set("body");
    lightningsurgebody.setScale(1.5);
    lightningsurgebody.mirror = false;

    lightningsurgehead = utils.createLines(renderer, lightningsurge_beam, lightningsurge_color, [
        {"start": [2.5, -0.5, -2.5], "end": [-2.5, -4.5, -2.5], "size": [10.0, 10.0]},
        {"start": [-2.5, -0.5, -2.5], "end": [2.5, -4.5, -2.5], "size": [10.0, 10.0]},

        {"start": [2.5, -0.5, 2.5], "end": [-2.5, -4.5, 2.5], "size": [10.0, 10.0]},
        {"start": [-2.5, -0.5, 2.5], "end": [2.5, -4.5, 2.5], "size": [10.0, 10.0]},

        {"start": [-2.5, -0.5, 2.5], "end": [-2.5, -4.5, -2.5], "size": [10.0, 10.0]},
        {"start": [-2.5, -0.5, -2.5], "end": [-2.5, -4.5, 2.5], "size": [10.0, 10.0]},

        {"start": [2.5, -0.5, 2.5], "end": [2.5, -4.5, -2.5], "size": [10.0, 10.0]},
        {"start": [2.5, -0.5, -2.5], "end": [2.5, -4.5, 2.5], "size": [10.0, 10.0]},

        {"start": [2.5, -5.2, 3.0], "end": [-2.5, -5.2, -3.0], "size": [10.0, 10.0]},
        {"start": [-2.5, -5.2, 3.0], "end": [2.5, -5.2, -3.0], "size": [10.0, 10.0]},
    ]);
    lightningsurgehead.anchor.set("head");
    lightningsurgehead.setScale(1.5);
    lightningsurgehead.mirror = false;

    lightningsurgemjolnir = utils.createLines(renderer, lightningsurgemjolnir_beam, lightningsurge_color, [
        {"start": [-0.4, 3.4, 1.5], "end": [-0.4, 3.4, -3.5], "size": [10.0, 10.0]},

        {"start": [0.2, 1.4, -2.6], "end": [0.2, 5.5, -4.1], "size": [10.0, 10.0]},
        {"start": [0.2, 1.4, -4.1], "end": [0.2, 5.5, -2.6], "size": [10.0, 10.0]},

        {"start": [-1.0, 1.4, -2.6], "end": [-1.0, 5.5, -4.1], "size": [10.0, 10.0]},
        {"start": [-1.0, 1.4, -4.1], "end": [-1.0, 5.5, -2.6], "size": [10.0, 10.0]},

        {"start": [0.4, 1.4, -2.6], "end": [-1.2, 1.4, -4.1], "size": [10.0, 10.0]},
        {"start": [-1.2, 1.4, -2.6], "end": [0.4, 1.4, -4.1], "size": [10.0, 10.0]},

        {"start": [0.4, 5.4, -2.6], "end": [-1.2, 5.4, -4.1], "size": [10.0, 10.0]},
        {"start": [-1.2, 5.4, -2.6], "end": [0.4, 5.4, -4.1], "size": [10.0, 10.0]},

        {"start": [-1.2, 3.4, -4.6], "end": [0.4, 3.4, -4.6], "size": [10.0, 10.0]},
    ]);
    lightningsurgemjolnir.anchor.set("rightArm");
    lightningsurgemjolnir.setScale(2.5);
    lightningsurgemjolnir.mirror = false;

    lightningstrike = utils.createLines(renderer, lightning_beam, lightningsurge_color, [
        {"start": [-10.0, -100.0, 4.0], "end": [-10.0, 0.0, 4.0], "size": [10.0, 10.0]},
    ]);
    lightningstrike.anchor.set("body");
    lightningstrike.setScale(1.5);
    lightningstrike.mirror = false;

    lightningstorm = utils.createLines(renderer, lightning_beam, lightningsurge_color, [
        {"start": [-60.0, -200.0, 0.0], "end": [-10.0, 40.0, 0.0], "size": [10.0, 10.0]},
    ]);
    lightningstorm.anchor.ignoreAnchor(true);
    lightningstorm.setScale(1.5);
    lightningstorm.mirror = true;

    utils.bindTrail(renderer, "gowhp:thor").setCondition(entity => entity.getData("fiskheroes:flying"));
    utils.bindTrail(renderer, "gowhp:thor_lightning").setCondition(entity => entity.getData("fiskheroes:flying"));
    utils.bindTrail(renderer, "gowhp:thor_lightning_surge").setCondition(entity => (((!entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/thor_ability_cycle") == 0) || (entity.getData("gowhp:dyn/mjolnir") && (entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 1 || entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 2))) && entity.getData("fiskheroes:beam_charge") > 0.0));
}

function render(entity, renderLayer, isFirstPersonArm) {
    if (renderLayer == "HELMET") {
        beard.render();
    }
    if (renderLayer == "CHESTPLATE") {
        belly.render();
    }
    if ((entity.getInterpolatedData("gowhp:dyn/mjolnir_timer") > 0.5) && (entity.getHeldItem().isEmpty()) || ((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"))) {
        mjolnir.render();
    }
    if ((renderLayer == "CHESTPLATE" && entity.getInterpolatedData("gowhp:dyn/mjolnir_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"))) {
        mjolnirholster.render();
    }
    if (((entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 1 || entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 2) && !entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 0 && !entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 0 && entity.getData("fiskheroes:beam_charge"))){
        lightningsurgearm.progress = Math.max(1 - (1 - entity.getInterpolatedData('fiskheroes:beam_charge')) * 1, 0);
        lightningsurgearm.opacity = Math.max(1 - (1 - entity.getInterpolatedData('fiskheroes:beam_charge')) * 1, 0);
        lightningsurgearm.render();
    }
    if (((!entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/thor_ability_cycle") == 0) && entity.getData("fiskheroes:beam_charge"))){
        lightningsurgearms.progress = Math.max(1 - (1 - entity.getInterpolatedData('fiskheroes:beam_charge')) * 1, 0);
        lightningsurgearms.opacity = Math.max(1 - (1 - entity.getInterpolatedData('fiskheroes:beam_charge')) * 1, 0);
        lightningsurgearms.render();
    }
    if (entity.getData("gowhp:dyn/mjolnir") && (entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 1 ||  entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 2) && entity.getData("fiskheroes:beam_charge")){
        lightningsurgemjolnir.progress = Math.max(1 - (1 - entity.getInterpolatedData('fiskheroes:beam_charge')) * 1, 0);
        lightningsurgemjolnir.opacity = Math.max(1 - (1 - entity.getInterpolatedData('fiskheroes:beam_charge')) * 1, 0);
        lightningsurgemjolnir.render();
    }
    if (((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"))){
        lightningsurgemjolnir.progress = true;
        lightningsurgemjolnir.opacity = true;
        lightningsurgemjolnir.render();
    }
    if ((entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 1 && entity.getData("fiskheroes:beam_charging") && !entity.getData("fiskheroes:beam_shooting")) && !entity.getData("fiskheroes:flying")){
        lightningstrike.progress = Math.max(1 - (1 - entity.getInterpolatedData('fiskheroes:beam_charge')) * 1, 0);
        lightningstrike.opacity = Math.max(1 - (1 - entity.getInterpolatedData('fiskheroes:beam_charge')) * 1, 0);
        lightningstrike.render();
    }
    if ((entity.getData("gowhp:dyn/mjolnir") && entity.getData("gowhp:dyn/mjolnir_runic_cycle") == 2 && entity.getData("fiskheroes:beam_charging")) && !entity.getData("fiskheroes:flying")){
        lightningstorm.progress = Math.max(1 - (1 - entity.getInterpolatedData('fiskheroes:beam_charge')) * 1, 0);
        lightningstorm.opacity = Math.max(1 - (1 - entity.getInterpolatedData('fiskheroes:beam_charge')) * 1, 0);
        lightningstorm.render();
    }
}
