{
  "format_version": "1.19.0",
  "minecraft:attachable": {
    "description": {
      "identifier": "tsu_morph:guardian_morph",
      "materials": {
        "default": "guardian",
        "ghost": "guardian_ghost",
        "beam": "entity_alphatest"
      },
      "textures": {
        "default": "textures/entity/guardian",
        "beam": "textures/entity/guardian_beam"
      },
      "geometry": {
        "default": "geometry.tsu_morph.guardian",
        "ghost": "geometry.tsu_morph.guardian",
        "beam": "geometry.tsu_morph.guardian_laser"
      },
      "animations": {
        "setup": "animation.tsu_morph.guardian.setup",
        "spikes": "animation.tsu_morph.guardian.spikes",
        "swim": "animation.tsu_morph.guardian.swim",
        "look_at_target": "animation.tsu_morph.look_at_target",
        "move_eye": "animation.tsu_morph.guardian.move_eye",
        "laser_move": "animation.tsu_morph.guardian_laser.move",
        "ability_item_use": "animation.tsu_morph.guardian_laser.attack",
        "scale": "animation.tsu_morph.guardian.scale",
        "ability_item_use_controller": "controller.animation.tsu_morph.ability_item_use",

        "hurt_sounds": "controller.animation.tsu_morph.hurt_sounds",
        "idle_sounds": "animation.tsu_morph.idle_sounds"
      },
      "scripts": {
        "initialize": [
          "v.color_r = 0;",
          "v.color_g = 0;",
          "v.color_b = 0;",
          "variable.spike_animation_speed = 0.0;",
          "variable.tail_animation_speed = 0.0;",
          "variable.tail_swim = 0.0;"
        ],
        "pre_animation": [
          "v.display_fp = c.is_first_person && !q.is_in_ui && q.is_local_player;",
          "v.has_ability_item = q.is_item_name_any('slot.weapon.mainhand', 0, 'tsu_morph:elder_guardian_ability');",
          //vanilla
          "variable.spike_shake = Math.sin(query.life_time * 2000)/50;",
          "variable.spike_animation_speed = query.life_time < 0.1 ? 0.0 : (!query.is_in_water ? (Math.round(Math.sin(query.life_time * 2000)) == 0.0 ? (Math.random(0.0, 1.0)) : (variable.spike_animation_speed)) : (query.is_moving ? (variable.spike_animation_speed - variable.spike_animation_speed * 0.06) : (variable.spike_animation_speed + (1.0 - variable.spike_animation_speed) * 0.06)));",
          "variable.spike_extension = (1.0 - variable.spike_animation_speed) * 0.55;",
          "variable.tail_animation_speed = query.life_time < 0.1 ? 0.0 : (!query.is_in_water ? 2.0 : query.is_moving ? (variable.tail_animation_speed < 0.5 ? 4.0 : variable.tail_animation_speed + (0.5 - variable.tail_animation_speed) * 0.1) : variable.tail_animation_speed + (0.125 - variable.tail_animation_speed) * 0.2);",
          "variable.tail_swim = query.life_time < 0.1 ? 0.0 : (variable.tail_swim + variable.tail_animation_speed/2);",
          "variable.tail_base_angle = Math.sin(variable.tail_swim*20.0);"
        ],
        "animate": [
          "laser_move",
          "setup",
          "spikes",
          "swim",
          "look_at_target",
          "move_eye",
          "ability_item_use_controller",
          "hurt_sounds",
          "idle_sounds"
        ]
      },
      "sound_effects": {
        "hurt": "mob.guardian.hit",
        "idle": "mob.guardian.ambient",
        "beam": "tsu_morph.guardian.beam"
      },
      "render_controllers": [
        {
          "controller.render.tsu_morph.default": "!v.display_fp"
        },
        "controller.render.tsu_morph.guardian_beam"
      ]
    }
  }
}