{
  "format_version": "1.10.0",
  "minecraft:client_entity": {
    "description": {
      "identifier": "minecraft:sniffer",
      "min_engine_version": "1.8.0",
      "materials": {
        "default": "sniffer"
      },
      "textures": {
        "red": "textures/entity/sniffer/red",
        "red_face": "textures/entity/sniffer/red_face",

        "purple": "textures/entity/sniffer/purple",
        "purple_face": "textures/entity/sniffer/purple_face",

        "green": "textures/entity/sniffer/green",
        "green_face": "textures/entity/sniffer/green_face",

        "yellow": "textures/entity/sniffer/yellow",
        "yellow_face": "textures/entity/sniffer/yellow_face",

        "blue": "textures/entity/sniffer/blue",
        "blue_face": "textures/entity/sniffer/blue_face"
      },
      "scripts": {
        "initialize": [
          "variable.random_variant = Math.random_integer(0,11);",

          "variable.eye_rot.max_diff = 55;",

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

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

          "variable.vertical_adjustment_weight = 3.0;"
        ],
        "pre_animation": [
          "variable.moving = math.min(1.0, query.modified_move_speed * 10);",

          "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": [
          "look_at_target",
          { "baby_transform": "query.is_baby"},
          "sniffer_idle",

          "control_walk",
          "control_sniffsniff",
          "control_long_sniff",
          "control_search",
          "control_dig",
          "control_stand_up",
          "control_feeling_happy",

          "scale",
          "vertical_adjustment",
          "idle",

          "control_eye_movement",
          "control_eyebrow_movement"
        ]
      },
      "geometry": {
        "default": "geometry.crl.sniffer",
        "face": "geometry.crl.sniffer.face"
      },
      "animations": {
        "look_at_target": "animation.crl.four_legs.look_at_target",
        "scale": "animation.crl.four_legs.scale",
        "vertical_adjustment": "animation.crl.four_legs.vertical_adjustment",
        "idle": "animation.crl.common.idle_body",

        "baby_transform": "animation.crl.sniffer.baby_transform",
        "walk": "animation.crl.sniffer.walk",
        "sniffsniff": "animation.crl.sniffer.sniffsniff",
        "long_sniff": "animation.crl.sniffer.longsniff",
        "search": "animation.crl.sniffer.search",
        "dig": "animation.crl.sniffer.dig",
        "stand_up": "animation.crl.sniffer.stand_up",
        "feeling_happy": "animation.crl.sniffer.feeling_happy",
        "sniffer_idle": "animation.crl.sniffer.idle",

        "control_walk": "controller.animation.crl.sniffer.walk",
        "control_sniffsniff": "controller.animation.crl.sniffer.sniffsniff",
        "control_long_sniff": "controller.animation.crl.sniffer.long_sniff",
        "control_search": "controller.animation.crl.sniffer.search",
        "control_dig": "controller.animation.crl.sniffer.dig",
        "control_stand_up": "controller.animation.crl.sniffer.stand_up",
        "control_feeling_happy": "controller.animation.crl.sniffer.feeling_happy",

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

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

        
      },
      "render_controllers": [ "controller.render.crl.sniffer",  "controller.render.crl.sniffer.face" ],
      "spawn_egg": {
        "texture": "spawn_egg_sniffer"
      },
      "sound_effects": {
        "drop_seed": "mob.sniffer.drop_seed",
        "sniffsniff": "mob.sniffer.sniffsniff",
        "searching": "mob.sniffer.searching",
        "long_sniff": "mob.sniffer.long_sniff",
        "digging": "mob.sniffer.digging",
        "stand_up": "mob.sniffer.stand_up",
        "happy": "mob.sniffer.happy"
      }
    }
  }
}
