{
  "format_version": "1.10.0",
  "minecraft:client_entity": {
    "description": {
      "identifier": "minecraft:iron_golem",
      "materials": { "default": "iron_golem", "cracks": "entity_alphatest" },
      "textures": {
        "furnace_golem": "textures/entity/iron_golem/furnace/furnace_golem",
        "furnace_golem_c_high": "textures/entity/iron_golem/furnace/furnace_golem_c_high",
        "furnace_golem_c_med": "textures/entity/iron_golem/furnace/furnace_golem_c_med",
        "furnace_golem_c_low": "textures/entity/iron_golem/furnace/furnace_golem_c_low",
        "furnace_golem_c_none": "textures/entity/iron_golem/furnace/furnace_golem_c_none",

        "default": "textures/entity/iron_golem/iron_golem",
        "default_face": "textures/entity/iron_golem/iron_golem_face",
        "cracked_high": "textures/entity/iron_golem/cracked_high",
        "cracked_med": "textures/entity/iron_golem/cracked_medium",
        "cracked_low": "textures/entity/iron_golem/cracked_low",
        "cracked_none": "textures/entity/iron_golem/cracked_none",

        "none": "textures/entity/iron_golem/none",

        "overgrown_0": "textures/entity/iron_golem/overgrown_0",

        "armorer": "textures/entity/villager2/professions/armorer",
        "butcher": "textures/entity/villager2/professions/butcher",
        "cartographer": "textures/entity/villager2/professions/cartographer",
        "farmer": "textures/entity/villager2/professions/farmer",
        "fisherman": "textures/entity/villager2/professions/fisherman",
        "fletcher": "textures/entity/villager2/professions/fletcher",
        "librarian": "textures/entity/villager2/professions/librarian",
        "shepherd": "textures/entity/villager2/professions/shepherd",
        "weapon_smith": "textures/entity/villager2/professions/weaponsmith"
      },
      "geometry": {
        "default": "geometry.crl.iron_golem",
        "hat": "geometry.crl.iron_golem.hat",
        "face": "geometry.crl.iron_golem.face"
      },
      "animations": {
        "move": "animation.crl.iron_golem.walk_only_arms",
        "attack": "animation.crl.iron_golem.attack",
        "flower": "animation.crl.iron_golem.flower",

        "move_controller": "controller.animation.iron_golem.move",
        "arm_controller": "controller.animation.iron_golem.arm_movement",

        "look_at_target": "animation.crl.iron_golem.look_at_target",
        "idle": "animation.crl.iron_golem.idle",

        "walk": "animation.crl.iron_golem.walk",
        "aggressive_walk": "animation.crl.iron_golem.walk",

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

        "blink": "animation.crl.face.blink",
        "blink_long": "animation.crl.face.blink_long",
        "eye_movement": "controller.animation.crl.eye_movement",
        "eyebrow_movement": "controller.animation.crl.eyebrow_movement",
        "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"
      },
      "scripts": {
        "initialize": [
          "variable.random_profession = Math.random_integer(0,100);",
          "variable.random_overgrown_variant = Math.random_integer(0,100);",

          "v.body_scale = 1.05;",
          "variable.eye_rot.max_diff = 25;",
          "variable.vertical_adjustment_weight = 3.0;",

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

          "variable.time_not_in_water = 0;",
          "v.previous_health = query.health;",
          "v.last_hurt_time = 1000;"
        ],
        "pre_animation": [
          "variable.modified_tcos0 = Math.clamp(((Math.cos(query.modified_distance_moved * 13.5) * Math.min(query.modified_move_speed, 0.6) / variable.gliding_speed_value) * 25.0), -12.5, 12.5);",
          "v.crack_index = math.clamp(query.health / 25, 0, 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": [
          "look_at_target",
          "move_controller",
          "arm_controller",

          "move",

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

          "eye_movement",
          "eyebrow_movement"
        ]
      },
      "spawn_egg": {
        "texture": "spawn_egg_iron_golem"
      },
      "render_controllers": [
        "controller.render.crl.iron_golem",
        "controller.render.crl.iron_golem.face",
        "controller.render.crl.iron_golem.overgrown",
        "controller.render.crl.iron_golem.hat",
        "controller.render.crl.iron_golem.cracks"
      ]
    }
  }
}
