{
  "format_version": "1.10.0",
  "minecraft:client_entity": {
    "description": {
      "identifier": "minecraft:spider",
      "min_engine_version": "1.8.0",
      "materials": {
        "default": "spider",
        "invisible": "spider_invisible"
      },
      "textures": {
        "default_0": "textures/entity/spider/spider",
        "default_1": "textures/entity/spider/spider_1",
        "default_2": "textures/entity/spider/spider_2",
        "default_3": "textures/entity/spider/spider_3"
      },
      "geometry": {
        "default": "geometry.crl.spider"
      },
      "scripts": {
        "initialize": [
          "variable.random_variant = Math.random_integer(0,1000);",
          "v.body_scale = 1.05;",
          "variable.eye_rot.max_diff = 30;",
          "variable.vertical_adjustment_weight = 6.0;",

          "v.distance_moved_weight = 1;",
          "v.modified_move_speed_weight = 2;",

          "variable.time_not_in_water = 0;",
          "v.previous_health = query.health;",
          "v.last_hurt_time = 1000;",

          "v.is_climbing = 0;",
          "v.time_climbing = 0;",
          "v.time_not_climbing = 0;",

          "v.thresh_climbing = 0.75;"
        ],
        "pre_animation": [
          "variable.time_not_in_water = (query.is_in_water ? 0 : (variable.time_not_in_water + query.delta_time));",
          "variable.time_not_in_water = math.clamp(variable.time_not_in_water, 0, 100);",

          "v.last_hurt_time = (query.health < v.previous_health ? 0 :  Math.clamp(v.last_hurt_time + query.delta_time, 0,1000) );",

          "v.previous_health=query.health;",

          "v.is_climbing = (query.is_wall_climbing);",

          "v.time_climbing = (v.is_climbing ? (v.time_climbing + q.delta_time) : 0);",
          "v.time_not_climbing = (v.is_climbing ? 0 : (v.time_not_climbing + q.delta_time));"
        ],
        "animate": [
          "control_climbing",
          "idle",
          "vertical_adjustment",
          "spider_idle"
        ]
      },
      "animations": {
        "look_at_target": "animation.crl.spider.look_at_target",
        "look_at_target_stick": "animation.crl.spider.look_at_target.stick",
        "walk": "animation.crl.spider.walk",
        "climb": "animation.crl.spider.climb",
        "stick": "animation.crl.spider.stick",
        "spider_idle": "animation.crl.spider.idle",

        "idle": "animation.crl.common.idle_body",
        "vertical_adjustment": "animation.crl.common.vertical_adjustment",

        "control_climbing": "controller.animation.crl.spider.climbing"
      },
      "render_controllers": ["controller.render.crl.spider"],
      "spawn_egg": {
        "texture": "spawn_egg",
        "texture_index": 11
      }
    }
  }
}
