{
  "format_version": "1.10.0",
  "minecraft:client_entity": {
    "description": {
      "identifier": "minecraft:witch",
      "min_engine_version": "1.8.0",
      "materials": {
        "default": "witch"
      },
      "textures": {
        "witch": "textures/entity/witch/witch",
        "witch1": "textures/entity/witch/witch_1",
        "witch2": "textures/entity/witch/witch_2",
        "hat": "textures/entity/witch/witch_hat",
        "hat1": "textures/entity/witch/witch_1_hat",
        "hat2": "textures/entity/witch/witch_2_hat",

        "face": "textures/entity/witch/witch_face",

        "hair_long_white": "textures/entity/villager2/hair/long_white",
        "hair_long_blonde": "textures/entity/villager2/hair/long_blonde",
        "hair_long_black": "textures/entity/villager2/hair/long_black",
        "hair_long_brown": "textures/entity/villager2/hair/long_brown"
      },
      "geometry": {
        "default": "geometry.crl.villager_v2",
        "hat": "geometry.crl.witch.hat",
        "face": "geometry.crl.villager_v2.face"
      },
      "scripts": {
        "scale": "0.9375",
        "initialize": [
          "v.body_scale = 1.05;",
          "variable.eye_rot.max_diff = 30;",
          "variable.vertical_adjustment_weight = 3.0;",

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

          "variable.random_hair = Math.random_integer(0,50);",
          "variable.random_variant = Math.random_integer(0,12);",

          "variable.time_not_in_water = 0;",
          "v.previous_health = query.health;",
          "v.last_hurt_time = 1000;"
        ],
        "pre_animation": [
          "variable.body_rot.x = query.body_x_rotation;",
          "variable.body_rot.y = query.body_y_rotation;",

          "variable.eye_rot.x = (query.target_x_rotation - this);",
          "variable.eye_rot.y = (query.target_y_rotation - this);",
          "variable.eye_rot_clamp.x = math.clamp(variable.eye_rot.x, -variable.eye_rot.max_diff, variable.eye_rot.max_diff);",
          "variable.eye_rot_clamp.y = math.clamp(variable.eye_rot.y, -variable.eye_rot.max_diff, variable.eye_rot.max_diff);",

          "variable.eye_ratio.x = (variable.eye_rot_clamp.x / variable.eye_rot.max_diff);",
          "variable.eye_ratio.y = (variable.eye_rot_clamp.y / variable.eye_rot.max_diff);",

          "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;"
        ],
        "animate": [
          "general_control",
          "move_control",
          "baby_control",

          "control_eye_movement",
          "control_eyebrow_movement",

          "witch_vertical_adjustment"
        ]
      },
      "animations": {
        "general": "animation.crl.villager.general",
        "baby_transform": "animation.crl.villager.baby_transform",
        "get_in_bed": "animation.crl.villager.get_in_bed",
        "idle": "animation.crl.two_legs.idle",

        "walk": "animation.crl.two_legs.walk",
        "look_at_target": "animation.crl.two_legs.look_at_target",
        "vertical_adjustment": "animation.crl.two_legs.vertical_adjustment",
        "body_scale": "animation.crl.two_legs.scale",

        "general_control": "controller.animation.crl.villager_v2.general",
        "move_control": "controller.animation.crl.villager_v2.move",
        "baby_control": "controller.animation.crl.villager_v2.baby",

        "blink": "animation.crl.face.blink",
        "blink_long": "animation.crl.face.blink_long",
        "move_eyes": "animation.crl.face.move_eyes",
        "move_eyebrows": "animation.crl.face.move_eyebrows",
        "scared_eyebrows": "animation.crl.face.scared_eyebrows",
        "sleep_eyes": "animation.crl.face.sleep_eyes",
        "angry_eyebrows": "animation.crl.face.angry_eyebrows",

        "control_eye_movement": "controller.animation.crl.eye_movement",
        "control_eyebrow_movement": "controller.animation.crl.eyebrow_movement",

        "witch_vertical_adjustment": "animation.crl.witch.vertical_adjustment"
      },
      "render_controllers": [
        "controller.render.crl.witch.hair",
        "controller.render.crl.witch",
        "controller.render.crl.witch.hat",
        "controller.render.crl.witch.face"
      ],
      "spawn_egg": {
        "texture": "spawn_egg",
        "texture_index": 17
      }
    }
  }
}
