{
  "format_version": "1.19.0",
  "minecraft:attachable": {
    "description": {
      "identifier": "tsu_morph:warden_morph",
      "materials": {
        "default": "warden",
        "bioluminescent_layer": "warden_bioluminescent_layer"
      },
      "textures": {
        "default": "textures/entity/warden/warden",
        "bioluminescent_layer": "textures/entity/warden/warden_bioluminescent_layer",
        "spots_1": "textures/entity/warden/warden_pulsating_spots_1",
        "spots_2": "textures/entity/warden/warden_pulsating_spots_2",
        "tendrils": "textures/entity/warden/warden_tendrils",
        "heart": "textures/entity/warden/warden_heart"
      },
      "geometry": {
        "default": "geometry.tsu_morph.warden"
      },
      "scripts": {
        "initialize": [
          "v.step_interval = 0.15;"
        ],
        "pre_animation": [
          "variable.animation_speed = Math.min(0.5, 3.0 * query.modified_move_speed);",
          "variable.anim_pos_mod = 49.388962;",
          "variable.bob = query.life_time * 20;",
          "variable.modified_bob = variable.bob * 0.1 * 57.2958;",
          "variable.modified_bob_sin = math.sin(variable.modified_bob);",
          "variable.modified_bob_cos = math.cos(variable.modified_bob);",
          "variable.pi = 180;",
          "variable.halfpi = variable.pi / 2.0;",
          "variable.tendril_animation_length = 0.5;",
          "variable.head_x_rot = (68.7549 * math.cos(query.modified_distance_moved * variable.anim_pos_mod + variable.halfpi) * math.min(0.35, variable.animation_speed)) + (math.sin(variable.bob * 5.72958) * 0.06);",
          "variable.head_z_rot = (17.1887 * math.sin(query.modified_distance_moved * variable.anim_pos_mod) * variable.animation_speed) + (Math.cos(variable.bob * 5.72958) * 0.06);",
          "variable.body_x_rot = (57.2958 * math.cos(query.modified_distance_moved * variable.anim_pos_mod) * math.min(0.35, variable.animation_speed)) + (math.cos(variable.bob * 5.72958) * 0.025);",
          "variable.body_z_rot = (5.72958 * math.sin(query.modified_distance_moved * variable.anim_pos_mod) * variable.animation_speed) + (math.sin(variable.bob * 5.72958) * 0.025);",
          "variable.left_leg_x_rot = 57.2958 * math.cos(query.modified_distance_moved * variable.anim_pos_mod) * variable.animation_speed;",
          "variable.right_leg_x_rot = 57.2958 * math.cos(query.modified_distance_moved * variable.anim_pos_mod + variable.pi) * variable.animation_speed;",
          "variable.left_arm_x_rot = -(45.8366 * math.cos(query.modified_distance_moved * variable.anim_pos_mod) * variable.animation_speed);",
          "variable.right_arm_x_rot = -(45.8366 * math.sin(query.modified_distance_moved * variable.anim_pos_mod) * variable.animation_speed);",
          "variable.vibration_phase = query.time_since_last_vibration_detection;",
          "variable.tendril_animation = variable.vibration_phase < 0.0 ? 0.0 : 1.0 - (math.min(query.time_since_last_vibration_detection, variable.tendril_animation_length) / variable.tendril_animation_length);",
          "variable.left_tendril_x_rot = variable.tendril_animation * (math.cos(variable.bob * 128.9155) * variable.pi * 0.1);",
          "variable.right_tendril_x_rot = variable.left_tendril_x_rot * -1;",
          "variable.spots_1_alpha = 0.25 * math.cos(variable.bob * 2.578);",
          "variable.spots_2_alpha = 0.25 * math.cos(variable.bob * 2.578 + 180.0);",
          "variable.tendrils_alpha = variable.tendril_animation;",
          "variable.heart_alpha = 0.8 * (1.0 - query.heartbeat_phase);",
          //morph custom
          "v.has_ability_item = q.is_item_name_any('slot.weapon.mainhand', 0, 'tsu_morph:warden_ability');",
          "v.display_fp = c.is_first_person && !q.is_in_ui && q.is_local_player;"
        ],
        "animate": [
          "step_sounds",
          "idle_sounds",
          "hurt_sounds",
          "move",
          "bob",
          "look_at_target",
          "ability_item_use_controller",
          "attack_controller"
        ],
        "should_update_effects_offscreen": "1.0"
      },
      "animations": {
        "emerge": "animation.tsu_morph.warden.emerge",
        "sniff": "animation.tsu_morph.warden.sniff",
        "sniff_controller": "controller.animation.warden.sniff",
        "dig": "animation.tsu_morph.warden.dig",
        "roar": "animation.tsu_morph.warden.roar",
        "roar_controller": "controller.animation.warden.roar",
        "shiver": "animation.tsu_morph.warden.shiver",
        "shiver_controller": "controller.animation.warden.shiver",
        "look_at_target": "animation.tsu_morph.warden.look_at_target.default",
        "move": "animation.tsu_morph.warden.move",
        "melee_attack": "animation.tsu_morph.warden.attack",
        "melee_attack_controller": "controller.animation.warden.melee_attacking",
        "bob": "animation.tsu_morph.warden.bob",
        "sonic_boom": "animation.tsu_morph.warden.sonic_boom",
        "sonic_boom_controller": "controller.animation.warden.sonic_boom",
        // morph
        "ability_item_use_controller": "controller.animation.tsu_morph.ability_item_use",
        "ability_item_use": "animation.tsu_morph.warden.sonic_boom",
        "attack_controller": "controller.animation.tsu_morph.attachable_attack",
        "attack": "animation.tsu_morph.warden.attack",
        // sounds
        "hurt_sounds": "controller.animation.tsu_morph.hurt_sounds",
        "step_sounds": "controller.animation.tsu_morph.step_sounds",
        "idle_sounds": "animation.tsu_morph.idle_sounds"
      },
      "render_controllers": [
        {
          "controller.render.warden": "!v.display_fp"
        },
        {
          "controller.render.warden_bioluminescent_layer": "!v.display_fp"
        },
        {
          "controller.render.warden_spots_1": "!v.display_fp"
        },
        {
          "controller.render.warden_spots_2": "!v.display_fp"
        },
        {
          "controller.render.warden_tendrils": "!v.display_fp"
        },
        {
          "controller.render.warden_heart": "!v.display_fp"
        }
      ],
      "sound_effects": {
        "attack": "mob.warden.attack",
        "step": "mob.warden.step",
        "hurt": "mob.warden.hurt",
        "listening": "mob.warden.listening",
        "idle": "mob.warden.clicking",
        "emerge": "mob.warden.emerge",
        "sniff": "mob.warden.sniff",
        "dig": "mob.warden.dig",
        "roar": "mob.warden.roar",
        "clicking": "mob.warden.clicking"
      },
      "particle_effects": {
        "digging": "minecraft:warden_dig"
      }
    }
  }
}