loadTextures({
    "base": "gowhp:thor/mjolnir",
    "base_lights": "gowhp:thor/mjolnir_lights"
});

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

var model;
var cancelAnimations = false;

function init(renderer) {
    model = utils.createModel(renderer, "gowhp:mjolnir", "base", "base_lights");
    model.bindAnimation("gowhp:mjolnirthrow").setData((entity, data) => {
        if (cancelAnimations) {
            data.load(0);
            return;
        }
        data.load(entity.getInterpolatedData("gowhp:dyn/mjolnirthrowanimation_timer"));
    });

    renderer.setModel(model);
    utils.addPlayerAnimationWithData(renderer, "fisktag:dual_hand", "fiskheroes:aiming_timer");

    utils.addPlayerAnimation(renderer, "gowhp:sprint_kratos")
        .setData((entity, data) => data.load(1.0))
        .setCondition(entity => (entity.isSprinting()));
}

function render(renderer, entity, glProxy, renderType, isLeftSide) {
    cancelAnimations = false;
    if (renderType === "EQUIPPED_FIRST_PERSON") {
        glProxy.translate(0.0, 0.1, 0.0);
    }
    if (renderType === "ENTITY") {
        glProxy.translate(0.0, -0.4, 0.00);
        glProxy.scale(1.0);
        cancelAnimations = true;
    }
    if (renderType === "INVENTORY") {
        glProxy.translate(0.0, 0.0, -0.05);
        glProxy.scale(1.0);
        cancelAnimations = true;
    }
    glProxy.translate(0.0, -0.7, 0.0);
    glProxy.rotate(90.0, 0.0, 1.0, 0.0);
    glProxy.scale(0.7);
}
