extend("fiskheroes:hero_basic");
loadTextures({
    "layer1": "soulhp:invincible_layer1",
    "layer2": "soulhp:invincible_layer2"
});

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

function init (renderer) {
    parent.init(renderer);
    renderer.fixHatLayer("CHESTPLATE");
}


function initEffects(renderer) {

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, "fiskheroes:impact_antimatter").setCondition(entity => entity.getData("fiskheroes:flight_boost_timer") == 0.5);
utils.bindParticles(renderer, "soulhp:windtrailbig").setCondition(entity => entity.getData("fiskheroes:flight_boost_timer") == 1);

}

function initAnimations(renderer) {
    parent.initAnimations(renderer);
    addAnimation(renderer, "iron_man.FLIGHT", "soulhp:omnimanflight")
        .setData((entity, data) => {
            data.load(0, entity.getInterpolatedData("fiskheroes:flight_timer") * (1 - entity.getInterpolatedData("fiskheroes:dyn/superhero_landing_timer")));
            data.load(1, entity.getInterpolatedData("fiskheroes:flight_boost_timer"));
        })
        .priority = -10;
    
    addAnimationWithData(renderer, "iron_man.LAND", "soulhp:supermanland", "fiskheroes:dyn/superhero_landing_timer")
        .priority = -8;
    
    renderer.reprioritizeDefaultAnimation("PUNCH", -9);
    renderer.reprioritizeDefaultAnimation("AIM_BOW", -9);

    addAnimationWithData(renderer, "basic.BLOCKING", "fiskheroes:aiming")
      .setData((entity, data) => {
        data.load(0, entity.getData("soulhp:dyn/decapitation"))
      })
        .priority = 2;
}
