{
  "format_version": "1.11.0",
  "minecraft:entity": {
    "description": {
      "identifier": "minecraft:zombie_villager_v2",
      "is_spawnable": true,
      "is_summonable": false,
      "is_experimental": false
    },
    "component_groups": {
      "baby": {
        "minecraft:is_baby": {},
        "minecraft:scale": {
          "value": 0.5
        },
        "minecraft:movement": {
          "value": 0.35
        }
      },

      "adult": {
        "minecraft:movement": {
          "value": 0.23
        },
        "minecraft:rideable": {
          "seat_count": 1,
          "family_types": [
            "zombie"
          ],
          "seats": {
            "position": [ 0.0, 0.9, -0.25 ]
          }
        },
        "minecraft:behavior.mount_pathing": {
          "priority": 5,
          "speed_multiplier": 1.25,
          "target_dist": 0.0,
          "track_target": true
        }
      },

      "jockey": {
        "minecraft:behavior.find_mount": {
          "priority": 1,
          "within_radius": 16
        }
      },

      "from_abandoned_village": {
        "minecraft:navigation.walk": {
          "is_amphibious": true,
          "can_pass_doors": true,
          "can_open_doors": true,
          "avoid_water": true,
          "avoid_sun": true
        },
        "minecraft:behavior.flee_sun": {
          "priority": 4,
          "speed_multiplier": 1
        }
      },

      "to_villager": {
        "minecraft:transformation": {
          "into": "minecraft:villager_v2",
          "begin_transform_sound": "remedy",
          "transformation_sound": "unfect",
          "delay": {
            "value": 100,
            "block_assist_chance": 0.01,
            "block_radius": 4,
            "block_chance": 0.3,
            "block_types": [
              "minecraft:bed",
              "minecraft:iron_bars"
            ]
          }
        },
        "minecraft:spell_effects": {
          "add_effects": [
            {
              "effect": "strength",
              "duration": 100
            },
            {
              "effect": "heal",
              "duration": 100
            }
          ],
          "remove_effects": "weakness"
        },
        "minecraft:is_shaking": {
        }
      },

      "unskilled": {
        "minecraft:type_family": {
          "family": [ "unskilled", "zombie", "zombie_villager", "undead", "monster" ]
        },
        "minecraft:variant": {
          "value": 0
        }
      },
      "nitwit": {
        "minecraft:type_family": {
          "family": [ "nitwit", "zombie", "zombie_villager", "undead", "monster" ]
        },
        "minecraft:variant": {
          "value": 0
        }
      },
      "farmer": {
        "minecraft:type_family": {
          "family": [ "farmer", "zombie", "zombie_villager", "undead", "monster" ]
        },
        "minecraft:variant": {
          "value": 0
        }
      },
      "fisherman": {
        "minecraft:type_family": {
          "family": [ "fisherman", "zombie_villager", "zombie", "undead", "monster" ]
        },
        "minecraft:variant": {
          "value": 0
        }
      },
      "shepherd": {
        "minecraft:type_family": {
          "family": [ "shepherd", "zombie_villager", "zombie", "undead", "monster" ]
        },
        "minecraft:variant": {
          "value": 0
        }
      },
      "fletcher": {
        "minecraft:type_family": {
          "family": [ "fletcher", "zombie_villager", "zombie", "undead", "monster" ]
        },
        "minecraft:variant": {
          "value": 0
        }
      },

      "librarian": {
        "minecraft:type_family": {
          "family": [ "librarian", "zombie_villager", "zombie", "undead", "monster" ]
        },
        "minecraft:variant": {
          "value": 0
        }
      },

      "cartographer": {
        "minecraft:type_family": {
          "family": [ "cartographer", "zombie_villager", "zombie", "undead", "monster" ]
        },
        "minecraft:variant": {
          "value": 0
        }
      },

      "cleric": {
        "minecraft:type_family": {
          "family": [ "cleric", "zombie_villager", "zombie", "undead", "monster" ]
        },
        "minecraft:variant": {
          "value": 0
        }
      },

      "armorer": {
        "minecraft:type_family": {
          "family": [ "armorer", "zombie_villager", "zombie", "undead", "monster" ]
        },
        "minecraft:variant": {
          "value": 0
        }
      },
      "weaponsmith": {
        "minecraft:type_family": {
          "family": [ "weaponsmith", "zombie_villager", "zombie", "undead", "monster" ]
        },
        "minecraft:variant": {
          "value": 0
        }
      },
      "toolsmith": {
        "minecraft:type_family": {
          "family": [ "toolsmith", "zombie_villager", "zombie", "undead", "monster" ]
        },
        "minecraft:variant": {
          "value": 0
        }
      },

      "butcher": {
        "minecraft:type_family": {
          "family": [ "butcher", "zombie_villager", "zombie", "undead", "monster" ]
        },
        "minecraft:variant": {
          "value": 0
        }
      },
      "leatherworker": {
        "minecraft:type_family": {
          "family": [ "leatherworker", "zombie_villager", "zombie", "undead", "monster" ]
        },
        "minecraft:variant": {
          "value": 0
        }
      },
      "mason": {
        "minecraft:type_family": {
          "family": [ "mason", "zombie_villager", "zombie", "undead", "monster" ]
        },
        "minecraft:variant": {
          "value": 0
        }
      },

      "desert_villager": {
        "minecraft:mark_variant": {
          "value": 1
        }
      },

      "jungle_villager": {
        "minecraft:mark_variant": {
          "value": 2
        }
      },

      "savanna_villager": {
        "minecraft:mark_variant": {
          "value": 3
        }
      },

      "snow_villager": {
        "minecraft:mark_variant": {
          "value": 4
        }
      },

      "swamp_villager": {
        "minecraft:mark_variant": {
          "value": 5
        }
      },

      "taiga_villager": {
        "minecraft:mark_variant": {
          "value": 6
        }
      },

      "villager_skin_0": {
        "minecraft:skin_id": {
          "value": 0
        }
      },

      "villager_skin_1": {
        "minecraft:skin_id": {
          "value": 1
        }
      },

      "villager_skin_2": {
        "minecraft:skin_id": {
          "value": 2
        }
      },

      "villager_skin_3": {
        "minecraft:skin_id": {
          "value": 3
        }
      },

      "villager_skin_4": {
        "minecraft:skin_id": {
          "value": 4
        }
      },

      "villager_skin_5": {
        "minecraft:skin_id": {
          "value": 5
        }
      }
    },

    "components": {
      // Zombie_villager Components
      "minecraft:navigation.walk": {
        "is_amphibious": true,
        "can_pass_doors": true,
        "can_open_doors": true,
        "avoid_sun": false
      },
      "minecraft:movement.basic": {
      },
      "minecraft:jump.static": {
      },
      "minecraft:can_climb": {
      },
      "minecraft:breathable": {
        "totalSupply": 15,
        "suffocateTime": 0,
        "breathesWater": true
      },
      "minecraft:loot": {
        "table": "loot_tables/entities/zombie.json"
      },
      "minecraft:collision_box": {
        "width": 0.6,
        "height": 1.8
      },
      "minecraft:burns_in_daylight": {},

      "minecraft:health": {
        "value": 20,
        "max": 20
      },
      "minecraft:attack": {
        "damage": 3
      },
      "minecraft:nameable": {
      },

      "minecraft:interact": {
        // Curing the villager
        "on_interact": {
          "filters": {
            "all_of": [
              { "test": "has_equipment", "domain": "hand", "subject": "other", "value": "golden_apple" },
              { "test": "has_component", "subject": "self", "value": "minecraft:effect.weakness" }
            ]
          },
          "event": "villager_converted",
          "target": "self"
        },
        "use_item": true,
        "interact_text": "action.interact.cure"
      },

      // Zombie_villager Behaviors
      "minecraft:behavior.break_door": {
        "priority": 1
      },
      "minecraft:behavior.melee_attack": {
        "priority": 6,
        "speed_multiplier": 1,
        "track_target": false
      },
      "minecraft:behavior.stomp_turtle_egg": {
        "priority": 4,
        "speed_multiplier": 1,
        "search_range": 24,
        "search_height": 3,
        "goal_radius": 1.14,
        "search_count": 4,
        "interval": 20
      },
      "minecraft:behavior.move_towards_restriction": {
        "priority": 7,
        "speed_multiplier": 1
      },
      "minecraft:behavior.random_stroll": {
        "priority": 8,
        "speed_multiplier": 1
      },
      "minecraft:behavior.look_at_player": {
        "priority": 9,
        "look_distance": 6,
        "probability": 0.02
      },
      "minecraft:behavior.random_look_around": {
        "priority": 9
      },
      "minecraft:behavior.hurt_by_target": {
        "priority": 1
      },
      "minecraft:behavior.nearest_attackable_target": {
        "priority": 2,
        "reselect_targets": true,
        "entity_types": [
          {
            "filters": {
              "any_of": [
                { "test": "is_family", "subject": "other", "value": "player" },
                { "test": "is_family", "subject": "other", "value": "snowgolem" },
                { "test": "is_family", "subject": "other", "value": "irongolem" },
                { "test": "is_family", "subject": "other", "value": "villager" },
                { "test": "is_family", "subject": "other", "value": "wandering_trader" }
              ]
            },
            "max_dist": 35
          },
          {
            "filters": {
              "all_of": [
                { "test": "is_family", "subject": "other", "value": "baby_turtle" },
                { "test": "in_water", "subject": "other", "operator": "!=", "value": true }
              ]
            },
            "max_dist": 35
          }
        ],
        "must_see": true
      },
      "minecraft:physics": {
      }
    },

    "events": {
      "villager_converted": {
        "remove": {
        },
        "add": {
          "component_groups": [
            "to_villager"
          ]
        }
      },
      "minecraft:entity_spawned": {
        "sequence": [
          {
            "filters": { "test": "has_component", "operator": "!=", "value": "minecraft:variant" },
            "randomize": [
              {
                "weight": 9500,
                "remove": {
                },
                "add": {
                  "component_groups": [
                    "adult"
                  ]
                }
              },
              {
                "weight": 425,
                "remove": {
                },
                "add": {
                  "component_groups": [
                    "baby"
                  ]

                }
              },
              {
                "weight": 75,
                "remove": {
                },
                "add": {
                  "component_groups": [
                    "baby",
                    "jockey"
                  ]

                }
              }
            ]
          },
          {
            "randomize": [
              {
                "weight": 1,
                "add": { "component_groups": [ "villager_skin_0" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "villager_skin_1" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "villager_skin_2" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "villager_skin_3" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "villager_skin_4" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "villager_skin_5" ] }
              }
            ]
          },
          {
            "filters": { "test": "has_component", "operator": "!=", "value": "minecraft:variant"
            },
            "randomize": [
              {
                "weight": 1,
                "add": { "component_groups": [ "unskilled" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "nitwit" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "farmer" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "fisherman" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "shepherd" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "fletcher" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "librarian" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "cartographer" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "cleric" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "armorer" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "weaponsmith" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "toolsmith" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "butcher" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "leatherworker" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "mason" ] }
              }
            ]
          },
          {
            "filters": { 
              "any_of": [
                { "test": "has_biome_tag", "value": "desert" },
                { "test": "has_biome_tag", "value": "mesa" }
              ]
            },
            "add": { "component_groups": [ "desert_villager" ] }
          },
          {
            "filters": { "test": "has_biome_tag", "value": "jungle" },
            "add": { "component_groups": [ "jungle_villager" ] }
          },
          {
            "filters": { "test": "has_biome_tag", "value": "savanna" },
            "add": { "component_groups": [ "savanna_villager" ] }
          },
          {
            "filters": {
              "any_of": [
                { 
                  "all_of": [
                    { "test": "has_biome_tag", "value": "cold" },
                    { "test": "has_biome_tag", "operator": "!=", "value": "ocean" }
                  ]
                },
                { "test": "has_biome_tag", "value": "frozen" }
              ]
            },
            "add": { "component_groups": [ "snow_villager" ] }
          },
          {
            "filters": { "test": "has_biome_tag", "value": "swamp" },
            "add": { "component_groups": [ "swamp_villager" ] }
          },
          {
            "filters": {
              "all_of": [
                {
                  "any_of": [
                    { "test": "has_biome_tag", "value": "taiga" },
                    { "test": "has_biome_tag", "value": "extreme_hills" }
                  ]
                },
                { "test": "has_biome_tag", "operator": "!=", "value": "cold" }
              ]
            },
            "add": { "component_groups": [ "taiga_villager" ] }
          }
        ]
      },

      "minecraft:entity_transformed": {
        "sequence": [
          {
            "filters": { "test": "has_component", "operator": "!=", "value": "minecraft:variant" },
            "sequence": [
              // Transform baby villager to baby zombie
              {
                "filters": { "test": "has_component", "subject": "other", "value": "minecraft:is_baby" },
                "add": { "component_groups": [ "baby" ] }
              },
              // Transform adult villager to adult zombie
              {
                "filters": {  "test": "has_component",  "subject": "other", "operator": "!=", "value": "minecraft:is_baby" },
                "add": { "component_groups": [ "adult" ] }
              },
              // Transform unskilled zombie to unskilled villager
              {
                "filters": { "test": "is_family", "subject": "other", "value": "unskilled" },
                "add": { "component_groups": [ "unskilled" ] }
              },
              // Transform nitwit zombie to nitwit villager
              {
                "filters": { "test": "is_family", "subject": "other", "value": "nitwit" },
                "add": { "component_groups": [ "nitwit" ] }
              },
              // Transform farmer zombie to farmer villager
              {
                "filters": { "test": "is_family", "subject": "other", "value": "farmer" },
                "add": { "component_groups": [ "farmer" ] }
              },
              // Transform fisherman zombie to fisherman villager
              {
                "filters": { "test": "is_family", "subject": "other", "value": "fisherman" },
                "add": { "component_groups": [ "fisherman" ] }
              },
              // Transform shepherd zombie to shepherd villager
              {
                "filters": { "test": "is_family", "subject": "other", "value": "shepherd" },
                "add": { "component_groups": [ "shepherd" ] }
              },
              // Transform fletcher zombie to fletcher villager
              {
                "filters": { "test": "is_family", "subject": "other", "value": "fletcher" },
                "add": { "component_groups": [ "fletcher" ] }
              },
              // Transform librarian zombie to librarian villager
              {
                "filters": { "test": "is_family", "subject": "other", "value": "librarian" },
                "add": { "component_groups": [ "librarian" ] }
              },
              // Transform cartographer zombie to cartographer villager
              {
                "filters": { "test": "is_family", "subject": "other", "value": "cartographer" },
                "add": { "component_groups": [ "cartographer" ] }
              },
              // Transform cleric zombie to cleric villager
              {
                "filters": { "test": "is_family", "subject": "other", "value": "cleric" },
                "add": { "component_groups": [ "cleric" ] }
              },
              // Transform armorer zombie to armorer villager
              {
                "filters": { "test": "is_family", "subject": "other", "value": "armorer" },
                "add": { "component_groups": [ "armorer" ] }
              },
              // Transform weaponsmith zombie to weaponsmith villager
              {
                "filters": { "test": "is_family", "subject": "other", "value": "weaponsmith" },
                "add": { "component_groups": [ "weaponsmith" ] }
              },
              // Transform toolsmith zombie to toolsmith villager
              {
                "filters": { "test": "is_family", "subject": "other", "value": "toolsmith" },
                "add": { "component_groups": [ "toolsmith" ] }
              },
              // Transform butcher zombie to butcher villager
              {
                "filters": { "test": "is_family", "subject": "other", "value": "butcher" },
                "add": { "component_groups": [ "butcher" ] }
              },
              // Transform leatherworker zombie to leatherworker villager
              {
                "filters": { "test": "is_family", "subject": "other", "value": "leatherworker" },
                "add": { "component_groups": [ "leatherworker" ] }
              },
              // Transform mason zombie to mason villager
              {
                "filters": { "test": "is_family", "subject": "other", "value": "mason" },
                "add": { "component_groups": [ "mason" ] }
              }
            ]
          },
          {
            "filters": { "test": "has_component", "operator": "!=", "value": "minecraft:mark_variant" },
            "sequence": [
              // Transform desert zombie to desert villager
              {
                "filters": { "test": "is_mark_variant", "subject": "other", "value": 1 },
                "add": { "component_groups": [ "desert_villager" ] }
              },
              // Transform jungle zombie to jungle villager
              {
                "filters": { "test": "is_mark_variant", "subject": "other", "value": 2 },
                "add": { "component_groups": [ "jungle_villager" ] }
              },
              // Transform jungle zombie to jungle villager
              {
                "filters": { "test": "is_mark_variant", "subject": "other", "value": 3 },
                "add": { "component_groups": [ "savanna_villager" ] }
              },
              // Transform jungle zombie to jungle villager
              {
                "filters": { "test": "is_mark_variant", "subject": "other", "value": 4 },
                "add": { "component_groups": [ "snow_villager" ] }
              },
              // Transform jungle zombie to jungle villager
              {
                "filters": { "test": "is_mark_variant", "subject": "other", "value": 5 },
                "add": { "component_groups": [ "swamp_villager" ] }
              },
              // Transform taiga zombie to taiga villager
              {
                "filters": { "test": "is_mark_variant", "subject": "other", "value": 6 },
                "add": { "component_groups": [ "taiga_villager" ] }
              }
            ]
          },
          {
            "filters": { "test": "has_component", "operator": "!=", "value": "minecraft:skin_id" },
            "sequence": [
              {
                "filters": { "test": "is_skin_id", "subject": "other", "value": 0 },
                "add": { "component_groups": [ "villager_skin_0" ] }
              },
              {
                "filters": { "test": "is_skin_id", "subject": "other", "value": 1 },
                "add": { "component_groups": [ "villager_skin_1" ] }
              },
              {
                "filters": { "test": "is_skin_id", "subject": "other", "value": 2 },
                "add": { "component_groups": [ "villager_skin_2" ] }
              },
              {
                "filters": { "test": "is_skin_id", "subject": "other", "value": 3 },
                "add": { "component_groups": [ "villager_skin_3" ] }
              },
              {
                "filters": { "test": "is_skin_id", "subject": "other", "value": 4 },
                "add": { "component_groups": [ "villager_skin_4" ] }
              },
              {
                "filters": { "test": "is_skin_id", "subject": "other", "value": 5 },
                "add": { "component_groups": [ "villager_skin_5" ] }
              }
            ]
          }
        ]
      },

      "minecraft:become_cleric": {
        "add": { "component_groups": [ "cleric" ] }
      },

      "from_village": {
        "sequence": [
          {
            "filters": {
              "test": "has_component",
              "operator": "!=",
              "value": "minecraft:variant"
            },
            "randomize": [
              {
                "weight": 9500,
                "remove": {
                },
                "add": {
                  "component_groups": [
                    "adult"
                  ]
                }
              },
              {
                "weight": 425,
                "remove": {
                },
                "add": {
                  "component_groups": [
                    "baby"
                  ]

                }
              },
              {
                "weight": 75,
                "remove": {
                },
                "add": {
                  "component_groups": [
                    "baby",
                    "jockey"
                  ]

                }
              }
            ]
          },
          {
            "randomize": [
              {
                "weight": 1,
                "add": { "component_groups": [ "villager_skin_0" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "villager_skin_1" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "villager_skin_2" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "villager_skin_3" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "villager_skin_4" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "villager_skin_5" ] }
              }
            ]
          },
          {
            "filters": {
              "test": "has_component",
              "operator": "!=",
              "value": "minecraft:variant"
            },
            "randomize": [
              {
                "weight": 1,
                "add": { "component_groups": [ "unskilled" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "nitwit" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "farmer" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "fisherman" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "shepherd" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "fletcher" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "librarian" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "cartographer" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "cleric" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "armorer" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "weaponsmith" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "toolsmith" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "butcher" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "leatherworker" ] }
              },
              {
                "weight": 1,
                "add": { "component_groups": [ "mason" ] }
              }
            ]
          },
          {
            "filters": { 
              "any_of": [
                { "test": "has_biome_tag", "value": "desert" },
                { "test": "has_biome_tag", "value": "mesa" }
              ]
            },
            "add": { "component_groups": [ "desert_villager" ] }
          },
          {
            "filters": { "test": "has_biome_tag", "value": "jungle" },
            "add": { "component_groups": [ "jungle_villager" ] }
          },
          {
            "filters": { "test": "has_biome_tag", "value": "savanna" },
            "add": { "component_groups": [ "savanna_villager" ] }
          },
          {
            "filters": {
              "any_of": [
                { 
                  "all_of": [
                    { "test": "has_biome_tag", "value": "cold" },
                    { "test": "has_biome_tag", "operator": "!=", "value": "ocean" }
                  ]
                },
                { "test": "has_biome_tag", "value": "frozen" }
              ]
            },
            "add": { "component_groups": [ "snow_villager" ] }
          },
          {
            "filters": { "test": "has_biome_tag", "value": "swamp" },
            "add": { "component_groups": [ "swamp_villager" ] }
          },
          {
            "filters": {
              "any_of": [
                { "test": "has_biome_tag", "value": "taiga" },
                { "test": "has_biome_tag", "value": "extreme_hills" }
              ]
            },
            "add": { "component_groups": [ "taiga_villager" ] }
          },
          { "add": { "component_groups": [ "from_abandoned_village" ] } }
        ]
      }
    }
  }
}
