{
  "format_version": "1.19.80",
  "minecraft:attachable": {
    "description": {
      "identifier": "tsu_morph:ender_dragon_morph",
      "materials": {
        "default": "entity_emissive_alpha",
        "vision": "tsu_entity_blend_exclusion"
      },
      "textures": {
        "default": "textures/entity/dragon/dragon",
        "vision": "textures/tsu/morph/entity/enderman_vision"
      },
      "geometry": {
        "default": "geometry.tsu_morph.ender_dragon",
        "vision": "geometry.tsu_morph.vision"
      },
      "animations": {
        "flying": "animation.tsu_morph.ender_dragon.flying",
        "scale": "animation.tsu_morph.ender_dragon.scale",
        "rotation": "animation.tsu_morph.ender_dragon.rotation",
        "grounded": "animation.tsu_morph.ender_dragon.grounded",
        "gliding": "animation.tsu_morph.ender_dragon.gliding",
        "look_at_target": "animation.tsu_morph.ender_dragon.look_at_target",
        "move": "controller.animation.tsu_morph.ender_dragon.move",

        "hurt_sounds": "controller.animation.tsu_morph.hurt_sounds",
        "step_sounds": "controller.animation.tsu_morph.step_sounds",
        "idle_sounds": "animation.tsu_morph.idle_sounds"
      },
      "sound_effects": {
        "step": "mob.enderdragon.flap",
        "hurt": "mob.enderdragon.hit",
        "idle": "mob.enderdragon.growl",
        "flap": "mob.enderdragon.flap"
      },
      "scripts": {
        "initialize": [
          "v.amplitude = 3;",
          "v.delay = -24;",
          "v.speed = 180;", // must be 180 for flap sounds to work properly
          "v.smooth_y_rot = 0;",
          "v.smooth_x_rot = 0;",
          "v.smooth_vertical_speed = 0;",
          "v.smooth_yaw_speed = 0;",
          "v.step_interval = 0.25;",
          "v.smooth_yaw_speed2 = 0;"
        ],
        "pre_animation": [
          "v.display_fp = c.is_first_person && !q.is_in_ui && q.is_local_player;",
          "v.y_rot = q.body_y_rotation + q.target_y_rotation;",
          "v.smooth_y_rot = math.lerp(v.smooth_y_rot, v.y_rot, q.delta_time * 3);",
          "v.smooth_x_rot = math.lerp(v.smooth_x_rot, q.target_x_rotation, q.delta_time * 3);",
          "v.smooth_vertical_speed = math.lerp(v.smooth_vertical_speed, q.vertical_speed, q.delta_time * 1);",
          "v.smooth_yaw_speed = math.lerp(v.smooth_yaw_speed, q.yaw_speed, q.delta_time * 2);",
          "v.smooth_yaw_speed2 = math.lerp(v.smooth_yaw_speed2, q.yaw_speed, q.delta_time * 0.5);",
          "v.has_ability_item = q.is_item_name_any('slot.weapon.mainhand', 0, 'tsu_morph:ender_dragon_ability');"
        ],
        "animate": [
          "move",
          {
            "scale": "q.is_in_ui"
          },
          "look_at_target",
          "hurt_sounds",
          "step_sounds",
          "idle_sounds"
        ]
      },
      "render_controllers": [
        {
          "controller.render.tsu_morph.default": "!v.display_fp"
        },
        {
          "controller.render.tsu_morph.vision": "v.display_fp"
        }
      ]
    }
  }
}