{
  "format_version": "1.19.60",
  "minecraft:entity": {
    "description": {
      "identifier": "legacy:witch_villager",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false
    },
    "component_groups": {
      "minecraft:celebrate": {
        "minecraft:behavior.celebrate": {
          "priority": 5,
          "celebration_sound": "celebrate",
          "sound_interval": {
            "range_min": 2.0,
            "range_max": 7.0
          },
          "jump_interval": {
            "range_min": 1.0,
            "range_max": 3.5
          },
          "duration": 30.0,
          "on_celebration_end_event": {
            "event": "minecraft:stop_celebrating",
            "target": "self"
          }
        }
      },
      "regeneration": {
        "minecraft:spell_effects": {
          "add_effects": [
            {
              "effect": "regeneration",
              "amplifier": 2,
              "visible": 1,
              "ambient": false,
              "duration": 30
            }
          ]
        }
      },
      "desert_witch": {
        "minecraft:mark_variant": {
          "value": 1
        }
      },
      "jungle_witch": {
        "minecraft:mark_variant": {
          "value": 2
        }
      },
      "savanna_witch": {
        "minecraft:mark_variant": {
          "value": 3
        }
      },
      "snow_witch": {
        "minecraft:mark_variant": {
          "value": 4
        }
      },
      "swamp_witch": {
        "minecraft:mark_variant": {
          "value": 5
        }
      },
      "taiga_witch": {
        "minecraft:mark_variant": {
          "value": 6
        }
      },
      "wild": {
        "minecraft:tameable": {
          "probability": 1,
          "tame_items": [
            "legacy:contract"
          ],
          "tame_event": {
            "event": "on_tame",
            "target": "self"
          }
        }
      },
      "tame": {
        "minecraft:is_tamed": {},
        "minecraft:sittable": {},
        "minecraft:movement": {
          "value": 0.5
        },
        "minecraft:behavior.nearest_attackable_target": {
          "priority": 3,
          "within_radius": 25,
          "reselect_targets": true,
          "must_reach": false,
          "entity_types": [
            {
              "filters": {
                "any_of": [
                  {
                    "test": "is_family",
                    "subject": "other",
                    "value": "illager"
                  },
                  {
                    "test": "is_family",
                    "subject": "other",
                    "value": "monster"
                  },
                  {
                    "test": "is_family",
                    "subject": "other",
                    "value": "undead"
                  }
                ]
              },
              "max_dist": 20,
              "must_see": false
            }
          ],
          "must_see": false,
          "speed_multiplier": 1.0
        },
        "minecraft:type_family": {
          "family": [
            "player",
            "villager",
            "low_platinum_level"
          ]
        },
        "minecraft:behavior.owner_hurt_target": {
          "priority": 2,
          "entity_types": [
            {
              "filters": {
                "all_of": [
                  {
                    "test": "is_family",
                    "subject": "other",
                    "operator": "!\u003d",
                    "value": "villager"
                  },
                  {
                    "test": "is_family",
                    "subject": "other",
                    "operator": "!\u003d",
                    "value": "creeper"
                  },
                  {
                    "test": "has_component",
                    "subject": "other",
                    "operator": "!\u003d",
                    "value": "minecraft:is_tamed"
                  }
                ]
              }
            }
          ]
        },
        "minecraft:behavior.owner_hurt_by_target": {
          "priority": 1,
          "entity_types": [
            {
              "filters": {
                "all_of": [
                  {
                    "test": "is_family",
                    "subject": "other",
                    "operator": "!\u003d",
                    "value": "villager"
                  },
                  {
                    "test": "is_family",
                    "subject": "other",
                    "operator": "!\u003d",
                    "value": "creeper"
                  }
                ]
              }
            }
          ]
        },
        "minecraft:behavior.follow_owner": {
          "priority": 3,
          "speed_multiplier": 0.6,
          "start_distance": 6,
          "stop_distance": 3
        },
        "minecraft:behavior.random_stroll": {
          "priority": 8,
          "speed_multiplier": 0.6,
          "interval": 15
        }
      },
      "regeneration": {
        "minecraft:spell_effects": {
          "add_effects": [
            {
              "effect": "regeneration",
              "amplifier": 2,
              "visible": 1,
              "ambient": false,
              "duration": 30
            }
          ]
        }
      },
      "blessed_regeneration": {
        "minecraft:spell_effects": {
          "add_effects": [
            {
              "effect": "regeneration",
              "amplifier": 4,
              "visible": 1,
              "ambient": false,
              "duration": 35
            }
          ]
        }
      },
      "blessed_regeneration_cured": {
        "minecraft:spell_effects": {
          "add_effects": [
            {
              "effect": "regeneration",
              "amplifier": 4,
              "visible": 1,
              "ambient": false,
              "duration": 25
            }
          ],
          "remove_effects": "weakness"
        }
      },
      "blessed_regeneration_cured_1": {
        "minecraft:spell_effects": {
          "add_effects": [
            {
              "effect": "regeneration",
              "amplifier": 4,
              "visible": 1,
              "ambient": false,
              "duration": 25
            }
          ],
          "remove_effects": "poison"
        }
      },
      "blessed_regeneration_cured_2": {
        "minecraft:spell_effects": {
          "add_effects": [
            {
              "effect": "regeneration",
              "amplifier": 4,
              "visible": 1,
              "ambient": false,
              "duration": 25
            }
          ],
          "remove_effects": "wither"
        }
      },
      "blessed_regeneration_cured_3": {
        "minecraft:spell_effects": {
          "add_effects": [
            {
              "effect": "regeneration",
              "amplifier": 4,
              "visible": 1,
              "ambient": false,
              "duration": 25
            }
          ],
          "remove_effects": "slowness"
        }
      },
      "minecraft:spawn_on_village": {
        "minecraft:movement": {
          "value": 0.25
        },
        "minecraft:preferred_path": {
          "max_fall_blocks": 1,
          "jump_cost": 20,
          "default_block_cost": 3,
          "preferred_path_blocks": [
            {
              "cost": 0,
              "blocks": [
                "grass_path"
              ]
            },
            {
              "cost": 1,
              "blocks": [
                "cobblestone",
                "stone",
                "stonebrick",
                "sandstone",
                "mossy_cobblestone",
                "stone_slab",
                "stone_slab2",
                "stone_slab3",
                "stone_slab4",
                "double_stone_slab",
                "double_stone_slab2",
                "double_stone_slab3",
                "double_stone_slab4",
                "wooden_slab",
                "double_wooden_slab",
                "planks",
                "brick_block",
                "nether_brick",
                "red_nether_brick",
                "end_bricks",
                "red_sandstone",
                "stained_glass",
                "glass",
                "glowstone",
                "prismarine",
                "emerald_block",
                "diamond_block",
                "lapis_block",
                "gold_block",
                "redstone_block",
                "purple_glazed_terracotta",
                "white_glazed_terracotta",
                "orange_glazed_terracotta",
                "magenta_glazed_terracotta",
                "light_blue_glazed_terracotta",
                "yellow_glazed_terracotta",
                "lime_glazed_terracotta",
                "pink_glazed_terracotta",
                "gray_glazed_terracotta",
                "silver_glazed_terracotta",
                "cyan_glazed_terracotta",
                "blue_glazed_terracotta",
                "brown_glazed_terracotta",
                "green_glazed_terracotta",
                "red_glazed_terracotta",
                "black_glazed_terracotta"
              ]
            },
            {
              "cost": 50,
              "blocks": [
                "bed",
                "lectern",
                "composter",
                "grindstone",
                "blast_furnace",
                "smoker",
                "fletching_table",
                "cartography_table",
                "brewing_stand",
                "smithing_table",
                "cauldron",
                "barrel",
                "loom",
                "stonecutter"
              ]
            }
          ]
        },
        "minecraft:behavior.explore_outskirts": {
          "priority": 5,
          "explore_dist": 7,
          "speed_multiplier": 0.6,
          "wait_time": 30
        },
        "minecraft:behavior.move_to_village": {
          "priority": 6,
          "speed_multiplier": 0.7
        },
        "minecraft:behavior.move_through_village": {
          "priority": 3,
          "speed_multiplier": 0.6,
          "only_at_night": true
        },
        "minecraft:pushable": {
          "is_pushable": true,
          "is_pushable_by_piston": true
        },
        "minecraft:behavior.random_stroll": {
          "priority": 5,
          "speed_multiplier": 0.6
        }
      }
    },
    "components": {
      "minecraft:damage_sensor": {
        "triggers": [
          {
            "on_damage": {
              "filters": [
                {
                  "test": "is_family",
                  "subject": "other",
                  "value": "villager"
                }
              ]
            },
            "deals_damage": false
          }
        ]
      },
      "minecraft:is_hidden_when_invisible": {
      },
      "minecraft:experience_reward": {
        "on_death": "query.last_hit_by_player ? (query.is_baby ? 12 : 5) + (Math.die_roll(query.equipment_count,1,3)) : 0"
      },
      "minecraft:breathable": {
        "total_supply": 15,
        "suffocate_time": 0
      },
      "minecraft:nameable": {
      },
      "minecraft:loot": {
        "table": "loot_tables/entities/witch.json"
      },
      "minecraft:health": {
        "value": 26,
        "max": 26
      },
      "minecraft:hurt_on_condition": {
        "damage_conditions": [
          {
            "filters": { "test": "in_lava", "subject": "self", "operator": "==", "value": true },
            "cause": "lava",
            "damage_per_tick": 4
          }
        ]
      },
      "minecraft:movement": {
        "value": 0.25
      },
      "minecraft:navigation.walk": {
        "can_path_over_water": true,
        "can_pass_doors": true,
        "can_open_doors": true,
        "avoid_water": true
      },
      "minecraft:movement.basic": {
      },
      "minecraft:jump.static": {
      },
      "minecraft:can_climb": {
      },
      "minecraft:behavior.float": {
        "priority": 1
      },
      "minecraft:angry": {
        "duration": 30,
        "broadcast_anger": true,
        "broadcast_anger_on_attack": true,
        "broadcast_anger_on_being_attacked": true,
        "broadcast_range": 16,
        "broadcast_targets": [
			"villager"
        ]
      },
      "minecraft:behavior.ranged_attack": {
        "priority": 2,
        "speed_multiplier": 1.0,
        "attack_interval_min": 3,
        "attack_interval_max": 3,
        "attack_radius": 10.0
      },
      "minecraft:shooter": {
        "power" : 0.75,
        "def": "minecraft:splash_potion",
        "aux_val" : 23,   // harming
        "sound" : "throw",
        "projectiles" : [
          {
            "def" : "minecraft:splash_potion",
            "aux_val" : 21, // healing
            "filters" : {
              "all_of" : [
                { "test": "is_family", "subject": "other", "value": "villager" },
                { "test": "actor_health", "subject": "other", "value": 4, "operator" : "<=" }
              ]
            },
            "lose_target" : true
          },
          {
            "def" : "minecraft:splash_potion",
            "aux_val" : 28, // regeneration
            "filters" : {
              "all_of" : [
                { "test": "is_family", "subject": "other", "value": "villager" },
                {
                  "none_of":[
                    { "test": "has_mob_effect", "subject": "other", "value": "regeneration" }
                  ]
                }
              ]
            },
            "lose_target" : true
          },
          {
            "def" : "minecraft:splash_potion",
            "aux_val" : 17, // slowness
            "filters" : {
              "all_of" : [
                { "test" : "target_distance", "subject" : "self", "value" : 8.0, "operator" : ">="},
                {
                  "none_of":[
                    { "test": "has_mob_effect", "subject": "other", "value": "slowness" }
                  ]
                }
              ]
            }
          },
          {
            "def" : "minecraft:splash_potion",
            "aux_val" : 25, // poison
            "filters" : {
              "all_of" : [
                { "test" : "target_distance", "subject" : "self", "value" : 8.0, "operator" : ">="},
                {
                  "none_of": [
                    { "test": "has_mob_effect", "subject": "other", "value": "poison" }
                  ]
                }
              ]
            }
          },
          {
            "def" : "minecraft:splash_potion",
            "aux_val" : 34, // weakness
            "filters" : {
              "all_of" : [
                { "test" : "target_distance", "subject" : "self", "value" : 3, "operator" : "<="},
                {
                  "none_of":[
                    { "test": "has_mob_effect", "subject": "other", "value": "weakness" }
                  ]
                }
              ]
            },
            "chance" : 0.25
          }
        ],
        "magic" : true
      },
      "minecraft:behavior.random_stroll": {
        "priority": 4,
        "speed_multiplier": 1.0
      },
      "minecraft:behavior.look_at_player": {
        "priority": 5,
        "look_distance": 16.0
      },
      "minecraft:behavior.random_look_around": {
        "priority": 5,
        "look_distance": 8.0
      },
      "minecraft:behavior.drink_potion": {
        "priority": 1,
        "speed_modifier": -0.25,
        "potions": [
          {
            "id": 19, // Water breathing
            "chance": 0.15,
            "filters": {
              "all_of": [
                { "test": "is_underwater", "subject": "self", "value": true },
                {
                  "none_of": [
                    { "test": "has_mob_effect", "subject": "self", "value": "water_breathing" }
                  ]
                }
              ]
            }
          },
          {
            "id": 12, // Fire resistance
            "chance": 0.15,
            "filters": {
              "all_of": [
                {
                  "any_of": [
                    { "test": "on_fire", "subject": "self", "value": true },
                    { "test": "on_hot_block", "subject": "self", "value": true },
                    { "test": "taking_fire_damage", "subject": "self", "value": true }
                  ]
                },
                {
                  "none_of": [
                    { "test": "has_mob_effect", "subject": "self", "value": "fire_resistance" }
                  ]
                }
              ]
            }
          },
          {
            "id": 21, // Healing
            "chance": 0.05,
            "filters": {
              "all_of": [
                { "test": "is_missing_health", "subject": "self", "value": true }
              ]
            }
          },
          {
            "id": 14, // Swiftness
            "chance": 0.25,
            "filters": {
              "all_of": [
                { "test": "has_target", "subject": "self", "value": true },
                {
                  "none_of": [
                    { "test": "has_mob_effect", "subject": "self", "value": "speed" }
                  ]
                },
                { "test": "target_distance", "subject": "self", "value": 11.0, "operator": ">=" }
              ]
            }
          }
        ]
      },
      "minecraft:behavior.hurt_by_target": {
        "priority": 1,
        "entity_types": {
          "filters": {
            "test": "is_family",
            "subject": "other",
            "operator": "!\u003d",
            "value": "villager"
          },
          "max_dist": 64
        }
      },
      "minecraft:behavior.nearest_prioritized_attackable_target": {
        "priority": 2,
        "entity_types": [
          {
            "filters": {
              "any_of": [
                {
                  "test": "is_family",
                  "subject": "other",
                  "value": "player_illager"
                },
                {
                  "test": "is_family",
                  "subject": "other",
                  "value": "illager"
                },
                {
                  "test": "is_family",
                  "subject": "other",
                  "value": "enderman"
                }
              ]
            },
            "priority": 1,
            "max_dist": 10
          },
          {
            "filters": {
              "any_of": [
                {
                  "test": "is_family",
                  "subject": "other",
                  "value": "villager"
                },
                {
                  "test": "is_family",
                  "subject": "other",
                  "value": "player"
                },
                {
                  "none_of":[
                    {
                      "test": "is_family",
                      "subject": "other",
                      "value": "witch_villager"
                    }
                  ]
                }
              ]
            },
            "priority": 2,
            "cooldown" : 10,
            "max_dist": 10
          }
        ],
        "must_reach": true
      },
      "minecraft:type_family": {
        "family": [
          "witch_villager",
          "villager",
          "mob"
        ]
      },
      "minecraft:collision_box": {
        "width": 0.6,
        "height": 1.9
      },
      "minecraft:physics": {
      },
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      },
      "minecraft:follow_range": {
        "value": 64
      },
      "minecraft:conditional_bandwidth_optimization": {
      }
    },
    "events": {
      "minecraft:spawn_on_village": {
        "sequence": [
          {
            "add": {
              "component_groups": [
                "minecraft:spawn_on_village",
                "wild"
              ]
            }
          },
          {
            "filters": {
              "any_of": [
                {
                  "test": "has_biome_tag",
                  "value": "desert"
                },
                {
                  "test": "has_biome_tag",
                  "value": "mesa"
                }
              ]
            },
            "add": {
              "component_groups": [
                "desert_witch_illager"
              ]
            }
          },
          {
            "filters": {
              "test": "has_biome_tag",
              "value": "jungle"
            },
            "add": {
              "component_groups": [
                "jungle_witch_illager"
              ]
            }
          },
          {
            "filters": {
              "test": "has_biome_tag",
              "value": "savanna"
            },
            "add": {
              "component_groups": [
                "savanna_witch_illager"
              ]
            }
          },
          {
            "filters": {
              "any_of": [
                {
                  "all_of": [
                    {
                      "test": "has_biome_tag",
                      "value": "cold"
                    },
                    {
                      "test": "has_biome_tag",
                      "operator": "!\u003d",
                      "value": "ocean"
                    }
                  ]
                },
                {
                  "test": "has_biome_tag",
                  "value": "frozen"
                }
              ]
            },
            "add": {
              "component_groups": [
                "snow_witch_illager"
              ]
            }
          },
          {
            "filters": {
              "test": "has_biome_tag",
              "value": "swamp"
            },
            "add": {
              "component_groups": [
                "swamp_witch_illager"
              ]
            }
          },
          {
            "filters": {
              "all_of": [
                {
                  "any_of": [
                    {
                      "test": "has_biome_tag",
                      "value": "taiga"
                    },
                    {
                      "test": "has_biome_tag",
                      "value": "extreme_hills"
                    }
                  ]
                },
                {
                  "test": "has_biome_tag",
                  "operator": "!\u003d",
                  "value": "cold"
                }
              ]
            },
            "add": {
              "component_groups": [
                "taiga_witch_illager"
              ]
            }
          }
        ]
      },
      "minecraft:entity_spawned": {
        "sequence": [
          {
            "add": {
              "component_groups": [
                "wild"
              ]
            }
          },
          {
            "filters": {
              "any_of": [
                {
                  "test": "has_biome_tag",
                  "value": "desert"
                },
                {
                  "test": "has_biome_tag",
                  "value": "mesa"
                }
              ]
            },
            "add": {
              "component_groups": [
                "desert_witch"
              ]
            }
          },
          {
            "filters": {
              "test": "has_biome_tag",
              "value": "jungle"
            },
            "add": {
              "component_groups": [
                "jungle_witch"
              ]
            }
          },
          {
            "filters": {
              "test": "has_biome_tag",
              "value": "savanna"
            },
            "add": {
              "component_groups": [
                "savanna_witch"
              ]
            }
          },
          {
            "filters": {
              "any_of": [
                {
                  "all_of": [
                    {
                      "test": "has_biome_tag",
                      "value": "cold"
                    },
                    {
                      "test": "has_biome_tag",
                      "operator": "!\u003d",
                      "value": "ocean"
                    }
                  ]
                },
                {
                  "test": "has_biome_tag",
                  "value": "frozen"
                }
              ]
            },
            "add": {
              "component_groups": [
                "snow_witch"
              ]
            }
          },
          {
            "filters": {
              "test": "has_biome_tag",
              "value": "swamp"
            },
            "add": {
              "component_groups": [
                "swamp_witch"
              ]
            }
          },
          {
            "filters": {
              "all_of": [
                {
                  "any_of": [
                    {
                      "test": "has_biome_tag",
                      "value": "taiga"
                    },
                    {
                      "test": "has_biome_tag",
                      "value": "extreme_hills"
                    }
                  ]
                },
                {
                  "test": "has_biome_tag",
                  "operator": "!\u003d",
                  "value": "cold"
                }
              ]
            },
            "add": {
              "component_groups": [
                "taiga_witch"
              ]
            }
          }
        ]
      },
      "minecraft:entity_spawned": {
        "sequence": [
          {
            "add": {
              "component_groups": [
                "nope"
              ]
            }
          },
          {
            "filters": {
              "any_of": [
                {
                  "test": "has_biome_tag",
                  "value": "desert"
                },
                {
                  "test": "has_biome_tag",
                  "value": "mesa"
                }
              ]
            },
            "add": {
              "component_groups": [
                "desert_witch"
              ]
            }
          },
          {
            "filters": {
              "test": "has_biome_tag",
              "value": "jungle"
            },
            "add": {
              "component_groups": [
                "jungle_witch"
              ]
            }
          },
          {
            "filters": {
              "test": "has_biome_tag",
              "value": "savanna"
            },
            "add": {
              "component_groups": [
                "savanna_witch"
              ]
            }
          },
          {
            "filters": {
              "any_of": [
                {
                  "all_of": [
                    {
                      "test": "has_biome_tag",
                      "value": "cold"
                    },
                    {
                      "test": "has_biome_tag",
                      "operator": "!\u003d",
                      "value": "ocean"
                    }
                  ]
                },
                {
                  "test": "has_biome_tag",
                  "value": "frozen"
                }
              ]
            },
            "add": {
              "component_groups": [
                "snow_witch"
              ]
            }
          },
          {
            "filters": {
              "test": "has_biome_tag",
              "value": "swamp"
            },
            "add": {
              "component_groups": [
                "swamp_witch"
              ]
            }
          },
          {
            "filters": {
              "all_of": [
                {
                  "any_of": [
                    {
                      "test": "has_biome_tag",
                      "value": "taiga"
                    },
                    {
                      "test": "has_biome_tag",
                      "value": "extreme_hills"
                    }
                  ]
                },
                {
                  "test": "has_biome_tag",
                  "operator": "!\u003d",
                  "value": "cold"
                }
              ]
            },
            "add": {
              "component_groups": [
                "taiga_witch"
              ]
            }
          }
        ]
      },
      "minecraft:start_celebrating": { // Event must be called exactly this for village to fire it when a raid is lost
        "sequence": [
          {
            "add": { "component_groups": [ "minecraft:celebrate" ] }
          },
          {
            "filters": { "test": "has_nametag", "value": false },
            "remove": { "component_groups": [ "minecraft:raid_persistence" ] }
          }
        ]
      },
      "minecraft:give_regeneration_villager": {
        "add": {
          "component_groups": [
            "regeneration"
          ]
        }
      },
      "minecraft:stop_celebrating": {
        "remove": { "component_groups": [ "minecraft:celebrate" ] }
      }
    }
  }
}
