extend("fiskheroes:hero_basic");
loadTextures({
    "layer1": "tgheroes:vulture/vulture_layer1",
    "layer2": "tgheroes:vulture/vulture_layer2",
    "wings": "tgheroes:vulture/vulture_wings",
    "jetpack": "tgheroes:vulture/vulture_pack"
});

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

var wings;
var jetpack;

var booster_main;
var booster_sides;

function initEffects(renderer) {
    wings = renderer.createEffect("fiskheroes:wings").setYOffset(-1);
    wings.texture.set("wings");
    wings.anchor.set("body");

    jetpack = renderer.createEffect("fiskheroes:model");
    jetpack.setModel(utils.createModel(renderer, "tgheroes:vulture_pack", "jetpack"));
    jetpack.anchor.set("body");

    var green_fire = renderer.createResource("ICON", "tgheroes:green_fire_layer_0");
    booster_main = renderer.createEffect("fiskheroes:booster");
    booster_main.setIcon(green_fire).setOffset(0.0, 5.0, 2.6).setSize(1.75, 3.0);
    booster_main.anchor.set("body");
    booster_sides = renderer.createEffect("fiskheroes:booster");
    booster_sides.setIcon(green_fire).setOffset(0.75, 5.0, 2.6).setSize(1.5, 2.0);
    booster_sides.anchor.set("body");
    booster_sides.mirror = true;

    utils.bindParticles(renderer, "fiskheroes:cap_falcon").setCondition(entity => entity.getData("fiskheroes:jetpacking_timer") > 0);

}

function render(entity, renderLayer, isFirstPersonArm) {
    if (renderLayer == "CHESTPLATE") {
        wings.unfold = entity.getInterpolatedData("fiskheroes:wing_animation_timer");
		wings.shieldUnfold = entity.getInterpolatedData("fiskheroes:shield_blocking_timer");
        wings.render();
        jetpack.render();
	}
	if (!isFirstPersonArm) {
        booster_main.progress = booster_sides.progress = entity.getInterpolatedData("fiskheroes:jetpacking_timer");
        booster_main.render();
        booster_sides.render();
	}

}
