{
  "format_version": "1.19.0",
  "minecraft:attachable": {
    "description": {
      "identifier": "tsu_morph:wither_morph",
      "materials": {
        "default": "wither_boss",
        "armor": "wither_boss_armor"
      },
      "textures": {
        "default": "textures/entity/wither_boss/wither",
        "armor_white": "textures/entity/wither_boss/wither_armor_white",
        "armor_blue": "textures/entity/wither_boss/wither_armor_blue",
        "invulnerable": "textures/entity/wither_boss/wither_invulnerable"
      },
      "geometry": {
        "default": "geometry.tsu_morph.wither",
        "armor": "geometry.tsu_morph.wither_armor"
      },
      "scripts": {
        "initialize": [
          "v.is_invulnerable = 0;"
        ],
        "pre_animation": [
          "v.is_invulnerable = q.player_level == 7777 ? math.clamp(v.is_invulnerable + 1,0,1) : v.is_invulnerable;",
          "v.white_shield = (q.health / q.max_health) <= 0.5 ? 1 : 0;",
          "v.display_fp = c.is_first_person && !q.is_in_ui && q.is_local_player;",
          //vanilla
          "variable.body_base_rotation = Math.cos(query.life_time * 114.6);",
          "variable.upper_body_rotation = (0.065 + 0.05 * variable.body_base_rotation) * 180 + query.target_x_rotation;"
        ],
        "animate": [
          "look_at_target",
          "scale",
          "move",
          "hurt_sounds",
          "idle_sounds",
          "armor_effect",
          {
            "swell": "v.is_invulnerable"
          }
        ]
      },
      "sound_effects": {
        "hurt": "mob.wither.hurt",
        "idle": "mob.wither.ambient"
      },
      "animations": {
        "scale": "animation.tsu_morph.wither.scale",
        "move": "animation.tsu_morph.wither.move",
        "look_at_target": "animation.tsu_morph.wither.look_at_target",
        "swell": "animation.tsu_morph.wither.swell",
        "armor_effect": "animation.tsu_morph.wither_armor.armor_random",

        "hurt_sounds": "controller.animation.tsu_morph.hurt_sounds",
        "idle_sounds": "animation.tsu_morph.idle_sounds"
      },
      "render_controllers": [
        {
          "controller.render.tsu_morph.wither_boss": "!v.display_fp"
        },
        {
          "controller.render.tsu_morph.wither_boss_armor_white": "!v.display_fp && v.white_shield"
        }
      ]
    }
  }
}