{
  "format_version": "1.10.0",
  "minecraft:client_entity": {
    "description": {
      "identifier": "minecraft:zombie_pigman",
      "min_engine_version": "1.8.0",
      "materials": {
        "default": "entity_alphatest",
        "multi": "entity_multitexture_alpha_test",
        "masked": "villager_v2_masked"
      },
      "textures": {
        "quiver": "textures/entity/skeleton/quiver",

        "body": "textures/entity/piglin/zombie/body",
        "head": "textures/entity/piglin/zombie/head",
        "face": "textures/entity/piglin/zombie/face"
      },
      "geometry": {
        // The geometry with item bones needs to have the name default. Do not ask me why :(
        "default": "geometry.crl.humanoid.base",
        "head": "geometry.crl.piglin.head",
        "face": "geometry.crl.piglin.face",

        "quiver": "geometry.crl.humanoid.quiver"
      },
      "spawn_egg": {
        "texture": "spawn_egg",
        "texture_index": 13
      },
      "scripts": {
        "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.time_not_in_water = 0;",
          "v.previous_health = query.health;",
          "v.last_hurt_time = 1000;",

          "variable.random_pants = Math.random_integer(0,1000);",
          "variable.random_tops = Math.random_integer(0,1000);",
          "variable.random_hair = Math.random_integer(0,1000);",
          "variable.random_head = Math.random_integer(0,1000);",
          "variable.random_face_item = Math.random_integer(0,1000);",
          "variable.random_headwear = Math.random_integer(0,1000);",
          "variable.random_top_mask = 0;",
          "variable.random_pants_mask = 0;",

          "variable.visibility_headwear = Math.random_integer(0,10);"
        ],
        "pre_animation": [
          "variable.tcos0 = (Math.cos(query.modified_distance_moved * 38.17) * query.modified_move_speed / variable.gliding_speed_value) * 57.3;",

          "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": [
          "control_humanoid_baby_big_head",
          "control_look_at_target",
          "control_move",
          "control_riding",
          "control_holding",
          "control_brandish_spear",
          "control_charging",
          "control_attack",
          "control_sneaking",
          "control_sneaking",
          "control_bob",
          "control_damage_nearby_mobs",
          "control_bow_and_arrow",
          "control_use_item_progress",
          "control_zombie_attack_bare_hand",
          "control_swimming",

          "zombie_vertical_adjustment",

          "control_eye_movement",
          "control_eyebrow_movement",

          "vertical_adjustment",
          "body_scale",
          "idle",

          "piglin_move"
        ]
      },
      "animations": {
        "humanoid_big_head": "animation.humanoid.big_head",
        "look_at_target_gliding": "animation.humanoid.look_at_target.gliding",
        "look_at_target_swimming": "animation.humanoid.look_at_target.swimming",
        "riding.arms": "animation.humanoid.riding.arms",
        "riding.legs": "animation.humanoid.riding.legs",
        "holding": "animation.humanoid.holding",
        "brandish_spear": "animation.humanoid.brandish_spear",
        "charging": "animation.humanoid.charging",
        "attack.rotations": "animation.humanoid.attack.rotations",
        "sneaking": "animation.humanoid.sneaking",
        "bob": "animation.humanoid.bob",
        "damage_nearby_mobs": "animation.humanoid.damage_nearby_mobs",
        "bow_and_arrow": "animation.humanoid.bow_and_arrow",
        "use_item_progress": "animation.humanoid.use_item_progress",
        "zombie_attack_bare_hand": "animation.zombie.attack_bare_hand",

        "zombie_vertical_adjustment": "animation.crl.zombie.vertical_adjustment",

        "control_humanoid_baby_big_head": "controller.animation.humanoid.baby_big_head",
        "control_look_at_target": "controller.animation.humanoid.look_at_target",
        "control_move": "controller.animation.humanoid.move",
        "control_riding": "controller.animation.humanoid.riding",
        "control_holding": "controller.animation.humanoid.holding",
        "control_brandish_spear": "controller.animation.humanoid.brandish_spear",
        "control_charging": "controller.animation.humanoid.charging",
        "control_attack": "controller.animation.humanoid.attack",
        "control_sneaking": "controller.animation.humanoid.sneaking",
        "control_bob": "controller.animation.humanoid.bob",
        "control_damage_nearby_mobs": "controller.animation.humanoid.damage_nearby_mobs",
        "control_bow_and_arrow": "controller.animation.humanoid.bow_and_arrow",
        "control_use_item_progress": "controller.animation.humanoid.use_item_progress",
        "control_zombie_attack_bare_hand": "controller.animation.zombie.attack_bare_hand",
        "control_swimming": "controller.animation.zombie.swimming",

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

        "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",

        "move": "animation.crl.two_legs.walk",
        "look_at_target_default": "animation.crl.two_legs.look_at_target",
        "swimming": "animation.crl.zombie.swimming",

        "vertical_adjustment": "animation.crl.two_legs.vertical_adjustment",
        "body_scale": "animation.crl.two_legs.scale",
        "idle": "animation.crl.two_legs.idle",
        "piglin_move": "animation.crl.piglin.move"
      },
      "render_controllers": [
        "controller.render.crl.zombie_pigman.body",
        "controller.render.crl.zombie_pigman.head",
        "controller.render.crl.zombie_pigman.head.face",
        "controller.render.crl.humanoid.quiver"
      ],
      "enable_attachables": true
    }
  }
}
