extend("fiskheroes:hero_basic");
loadTextures({
    "layer1": "soulhp:cyclops_layer1",
    "layer2": "soulhp:cyclops_layer2",
    "lights": "soulhp:cyclops_lights"
});

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

function init(renderer) {
    parent.init(renderer);
    renderer.setLights((entity, renderLayer) => renderLayer == "HELMET" ? "lights" : null);

    renderer.showModel("HELMET", "head", "headwear", "body", "rightArm", "leftArm");
    renderer.fixHatLayer("HELMET");
}



function initAnimations(renderer) {
    parent.initAnimations(renderer);
    renderer.removeCustomAnimation("basic.BLOCKING");
    addAnimationWithData(renderer, "basic.BLOCKING", "soulhp:cyclopslaser", "fiskheroes:beam_charge");

}


function initEffects(renderer) {


    utils.bindBeam(renderer, "fiskheroes:charged_beam", "fiskheroes:charged_beam", "head", getBeamColor(), [
        { "firstPerson": [6.0, 0,0, 1.6], "offset": [1.0, -3.5, -4.0], "size": [4.0, 1.5]},
        { "firstPerson": [-6.0, 0,0, 1.6], "offset": [-1.0, -3.5, -4.0], "size": [4.0, 1.5]}
    ]).setParticles(renderer.createResource("PARTICLE_EMITTER", "fiskheroes:impact_charged_beam"));


renderer.setItemIcons("%s_0", "%s_1", "%s_2", "%s_3");
renderer.showModel("HELMET", "head", "headwear");
renderer.showModel("CHESTPLATE", "body", "rightArm", "leftArm");
renderer.showModel("LEGGINGS", "rightLeg", "leftLeg");
renderer.showModel("BOOTS", "rightLeg", "leftLeg");

utils.bindParticles(renderer, "soulhp:cyclops").setCondition(entity => entity.getData("fiskheroes:beam_charging") && entity.getData("fiskheroes:beam_charge") < 1);

}

function getBeamColor() {
    return 0xFF2227;
}
