extend("ahhp:base_lantern");

var utils = implement("fiskheroes:external/utils");
var models_stuff = implement("ahhp:external/model_stuff");
var lantern_aura = implement("ahhp:external/lantern_aura");
var body_lines = implement("fiskheroes:external/body_lines");

loadTextures({
    "ring_lights": "ahhp:lantern/red_lantern_ring",
    "hammer_lights": "ahhp:lantern/red_lantern_hammer",
    "model_lights": "ahhp:lantern/red_lantern_model_lights",
    "ring": "ahhp:lantern/red_lantern_ring",
    "hammer": "ahhp:lantern/red_lantern_hammer",
    "model": "ahhp:lantern/red_lantern_model",
    "cat": "ahhp:lantern/dex_starr"
});

function getColor() {
    return 0xFF0000;
}

function getLantern() {
    return "red_lantern";
}

function getRing() {
    return "lantern_ring";
}

function init(renderer) {
    parent.init(renderer);
    initEffects(renderer);
    dex_starr_model = renderer.createEffect("fiskheroes:model");
    dex_starr_model.setModel(utils.createModel(renderer, "ahhp:dex_starr", "cat"));
    dex_starr_model.anchor.set("head");
    dex_starr_beam = body_lines.create(renderer, "ahhp:lantern_glow", 0xFF0000, [
        { anchor: "head", renderLayer: "CHESTPLATE", mirror: false, entries: [
            { "start": [-11.0, -8.0, -14.0], "end": [-11.0, -8.0, 23.5], "size": [5.0, 12.0] }
        ]}
    ]);
}

function initEffects(renderer) {
    parent.initEffects(renderer);
}

function render(entity, renderLayer, isFirstPersonArm) {
    parent.render(entity, renderLayer, isFirstPersonArm);
    if (entity.getInterpolatedData("ahhp:dyn/lantern_timer") == 1 || entity.isDisplayStand()) {
        dex_starr_model.render();
        dex_starr_beam.render(renderLayer);
    }
}