{
  "format_version": "1.16.0",
  "minecraft:entity": {
    "description": {
      "identifier": "legacy:spearman_cavalry_villager_diamond",
      "is_spawnable": false,
      "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"
          }
        }
      },
      "type_family": {
        "minecraft:type_family": {
          "family": [
            "villager",
            "guards",
            "enchanted_level"
          ]
        }
      },
      "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.35
        },
        "minecraft:behavior.nearest_attackable_target": {
          "priority": 2,
          "must_see": true,
          "reselect_targets": true,
          "within_radius": 18.0,
          "entity_types": [
            {
              "filters": {
                "all_of": [
                  {
                    "test": "is_family",
                    "subject": "other",
                    "value": "undead"
                  },
                  {
                    "test": "is_underwater",
                    "subject": "other",
                    "value": false
                  }
                ]
              },
              "max_dist": 24
            },
            {
              "filters": {
                "all_of": [
                  {
                    "test": "is_family",
                    "subject": "other",
                    "value": "monster"
                  },
                  {
                    "test": "is_family",
                    "subject": "other",
                    "operator": "!\u003d",
                    "value": "creeper"
                  },
                  {
                    "test": "is_underwater",
                    "subject": "other",
                    "value": false
                  }
                ]
              },
              "max_dist": 24
            },
            {
              "filters": {
                "all_of": [
                  {
                    "test": "is_family",
                    "subject": "other",
                    "value": "illager"
                  },
                  {
                    "test": "has_component",
                    "subject": "other",
                    "operator": "!\u003d",
                    "value": "minecraft:is_baby"
                  }
                ]
              },
              "max_dist": 15
            }
          ]
        },
        "minecraft:type_family": {
          "family": [
            "player",
            "villager",
            "guards",
            "diamond_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": 1.0,
          "start_distance": 6,
          "stop_distance": 3
        },
        "minecraft:behavior.random_stroll": {
          "priority": 8,
          "speed_multiplier": 0.75,
          "interval": 15
        }
      },
      "upgrade": {
        "minecraft:interact": {
          "interactions": [
            {
              "on_interact": {
                "filters": {
                  "all_of": [
                    {
                      "test": "has_equipment",
                      "subject": "other",
                      "domain": "hand",
                      "value": "legacy:contract_strength_level_3"
                    },
                    {
                      "test": "is_family",
                      "subject": "other",
                      "value": "player"
                    },
                    {
                      "test": "is_family",
                      "subject": "other",
                      "operator": "!\u003d",
                      "value": "low_platinum_level"
                    },
                    {
                      "test": "is_family",
                      "subject": "other",
                      "operator": "!\u003d",
                      "value": "high_platinum_level"
                    },
                    {
                      "test": "is_family",
                      "subject": "other",
                      "operator": "!\u003d",
                      "value": "gold_level"
                    },
                    {
                      "test": "is_family",
                      "subject": "other",
                      "operator": "!\u003d",
                      "value": "enchanted_level"
                    }
                  ]
                },
                "event": "minecraft:enchanted",
                "target": "self"
              },
              "swing": true,
              "particle_on_start": {
                "particle_type": "villagerhappy",
                "particle_offset_towards_interactor": false,
                "particle_y_offset": 1.25
              },
              "use_item": true,
              "interact_text": "Upgrade"
            }
          ]
        }
      },
      "enchant": {
        "minecraft:behavior.delayed_attack": {
          "priority": 3,
          "speed_multiplier": 1.0,
          "require_complete_path": false,
          "track_target": true,
          "hit_delay_pct": 0.48,
          "attack_duration": 0.76,
          "reach_multiplier": 4
        },
        "minecraft:attack": {
          "damage": 14
        },
        "minecraft:variant": {
          "value": 0
        },
        "minecraft:mark_variant": {
          "value": 0
        },
        "minecraft:equipment": {
          "table": "loot_tables/entities/spearman/villager_spearman_diamond_enchant_gear.json",
          "slot_drop_chance": [
            {
              "slot": "slot.armor.head",
              "drop_chance": 0.1
            },
            {
              "slot": "slot.armor.chest",
              "drop_chance": 0.1
            },
            {
              "slot": "slot.armor.legs",
              "drop_chance": 0.1
            },
            {
              "slot": "slot.armor.feet",
              "drop_chance": 0.1
            }
          ]
        }
      },
      "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: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.9,
          "wait_time": 30
        },
        "minecraft:behavior.move_to_village": {
          "priority": 6,
          "speed_multiplier": 1.0
        },
        "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": 1
        }
      }
    },

    "components": {
      "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:behavior.stay_while_sitting": {
        "priority": 3
      },
      "minecraft:conditional_bandwidth_optimization": {
      },
      "minecraft:nameable": {},
      "minecraft:type_family": {
        "family": [
          "villager",
          "iron_golem",
          "guards",
          "diamond_level",
          "mob"
        ]
      },
      "minecraft:variant": {
        "value": 0
      },
      "minecraft:breathable": {
        "total_supply": 15,
        "suffocate_time": 0
      },
      "minecraft:collision_box": {
        "width": 1.0,
        "height": 2.5
      },
      "minecraft:health": {
        "value": 120,
        "max": 120
      },
      "minecraft:knockback_resistance": {
        "value": 0.7
      },
      "minecraft:environment_sensor": {
        "triggers": [
          {
            "filters": {
              "test": "has_mob_effect",
              "subject": "other",
              "operator": "\u003d\u003d",
              "value": "village_hero"
            },
            "event": "minecraft:start_celebrating",
            "target": "self"
          }
        ]
      },
      "minecraft:hurt_on_condition": {
        "damage_conditions": [
          {
            "filters": { "test": "in_lava", "subject": "self", "operator": "==", "value": true },
            "cause": "lava",
            "damage_per_tick": 4
          }
        ]
      },
      "minecraft:damage_sensor": {
        "triggers": [
          {
            "on_damage": {
              "filters": {
                "test": "is_family",
                "subject": "other",
                "value": "villager"
              }
            },
            "deals_damage": false
          }
        ]
      },
      "minecraft:attack": {
        "damage": 13
      },
      "minecraft:movement": {
        "value": 0.35
      },
      "minecraft:navigation.walk": {
        "can_path_over_water": true,
        "can_pass_doors": true,
        "can_open_doors": true,
        "avoid_water": true
      },
      "minecraft:annotation.open_door": {
      },
      "minecraft:movement.basic": {},
      "minecraft:jump.static": {},
      "minecraft:follow_range": {
        "value": 64
      },
      "minecraft:loot": {
        "table": "loot_tables/entities/vindication_illager.json"
      },
      "minecraft:equipment": {
        "table": "loot_tables/entities/spearman/villager_spearman_diamond_gear.json"
      },
      "minecraft:behavior.float": {
        "priority": 0
      },
      "minecraft:behavior.delayed_attack": {
        "priority": 3,
        "speed_multiplier": 1.2,
        "require_complete_path": false,
        "track_target": true,
        "hit_delay_pct": 0.60,
        "attack_duration": 0.84,
        "reach_multiplier": 4
      },
      "minecraft:mark_variant": {
        "value": 0
      },
      "minecraft:behavior.random_stroll": {
        "priority": 9,
        "speed_multiplier": 0.55
      },
      "minecraft:behavior.look_at_player": {
        "priority": 10,
        "look_distance": 8,
        "probability": 0.02
      },
      "minecraft:behavior.hurt_by_target": {
        "priority": 1,
        "entity_types": {
          "filters": {
            "test": "is_family",
            "subject": "other",
            "operator": "!=",
            "value": "villager"
          },
          "max_dist": 64
        }
      },
      "minecraft:angry": {
        "duration": 30,
        "broadcast_anger": true,
        "broadcast_anger_on_attack": true,
        "broadcast_anger_on_being_attacked": true,
        "broadcast_range": 16,
        "broadcast_targets": [
          "villager"
        ],
        "angry_sound": "angry",
        "sound_interval": {
          "range_min": 2.0,
          "range_max": 5.0
        }
      },
      "minecraft:behavior.nearest_attackable_target": {
        "priority": 2,
        "must_see": true,
        "reselect_targets": true,
        "within_radius": 16.0,
        "entity_types": [
          {
            "filters": {
              "all_of": [
                {
                  "test": "is_family",
                  "subject": "other",
                  "value": "undead"
                },
                {
                  "test": "is_underwater",
                  "subject": "other",
                  "value": false
                }
              ]
            },
            "max_dist": 24
          },
          {
            "filters": {
              "all_of": [
                {
                  "test": "is_family",
                  "subject": "other",
                  "value": "monster"
                },
                {
                  "test": "is_family",
                  "subject": "other",
                  "operator": "!\u003d",
                  "value": "creeper"
                },
                {
                  "test": "is_underwater",
                  "subject": "other",
                  "value": false
                }
              ]
            },
            "max_dist": 24
          },
          {
            "filters": {
              "all_of": [
                {
                  "test": "is_family",
                  "subject": "other",
                  "value": "illager"
                },
                {
                  "test": "has_component",
                  "subject": "other",
                  "operator": "!\u003d",
                  "value": "minecraft:is_baby"
                }
              ]
            },
            "max_dist": 16
          }
        ]
      },
      "minecraft:physics": {
      },
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      }
    },
    "events": {
      "minecraft:entity_spawned": {
        "sequence": [
          {
            "randomize": [
              {
                "weight": 50,
                "add": {
                  "component_groups": [
                    "wild",
                    "upgrade"
                  ]
                }
              },
              {
                "weight": 50,
                "add": {
                  "component_groups": [
                    "wild",
                    "upgrade"
                  ]
                }
              }
            ]
          }
        ]
      },
      "minecraft:spawn_on_village": {
        "sequence": [
          {
            "randomize": [
              {
                "weight": 50,
                "add": {
                  "component_groups": [
                    "wild",
                    "spawn_on_village",
                    "minecraft:spawn_on_village",
                    "upgrade"
                  ]
                }
              },
              {
                "weight": 50,
                "add": {
                  "component_groups": [
                    "wild",
                    "spawn_on_village",
                    "minecraft:spawn_on_village",
                    "upgrade"
                  ]
                }
              }
            ]
          }
        ]
      },
      "minecraft:entity_transformed": {
        "sequence": [
          {
            "randomize": [
              {
                "weight": 50,
                "add": {
                  "component_groups": [
                    "wild",
                    "spawn_on_village",
                    "minecraft:spawn_on_village",
                    "upgrade"
                  ]
                }
              },
              {
                "weight": 50,
                "add": {
                  "component_groups": [
                    "wild",
                    "spawn_on_village",
                    "minecraft:spawn_on_village",
                    "upgrade"
                  ]
                }
              }
            ]
          }
        ]
      },
      "on_tame": {
        "add": {
          "component_groups": [
            "tame"
          ]
        },
        "remove": {
          "component_groups": [
            "wild"
          ]
        }
      },
      "minecraft:enchanted": {
        "sequence": [
          {
            "remove": {
              "component_groups": [
                "spear_melee_unit",
                "crossbow_unit",
                "melee_unit"
              ]
            },
            "run_command": {
              "command": [
                "playsound mob.villager.yes @r ~~~",
                "playsound armor.equip_iron @r ~~~"
              ]
            }
          },
          {
            "randomize": [
              {
                "weight": 50,
                "add": {
                  "component_groups": [
                    "wild",
                    "enchant",
                    "minecraft:spawn_on_village",
                    "type_family"
                  ]
                }
              },
              {
                "weight": 40,
                "add": {
                  "component_groups": [
                    "wild",
                    "enchant",
                    "minecraft:spawn_on_village",
                    "type_family"
                  ]
                }
              }
            ]
          }
        ]
      },
      "minecraft:start_celebrating": {
        "add": {
          "component_groups": [
            "minecraft:celebrate"
          ]
        }
      },
      "minecraft:stop_celebrating": {
        "remove": {
          "component_groups": [
            "minecraft:celebrate"
          ]
        }
      },
      "minecraft:calm": {
        "remove": {
          "component_groups": [
            "melee_unit",
            "crossbow_unit"
          ]
        }
      },
      "minecraft:give_regeneration_villager": {
        "add": {
          "component_groups": [
            "regeneration"
          ]
        }
      },
      "minecraft:give_blessed_regeneration_villager": {
        "add": {
          "component_groups": [
            "blessed_regeneration"
          ]
        }
      },
      "minecraft:give_blessed_regeneration_villager_cured": {
        "add": {
          "component_groups": [
            "blessed_regeneration_cured"
          ]
        }
      },
      "minecraft:give_blessed_regeneration_villager_cured_1": {
        "add": {
          "component_groups": [
            "blessed_regeneration_cured_1"
          ]
        }
      },
      "minecraft:give_blessed_regeneration_villager_cured_2": {
        "add": {
          "component_groups": [
            "blessed_regeneration_cured_2"
          ]
        }
      },
      "minecraft:give_blessed_regeneration_villager_cured_3": {
        "add": {
          "component_groups": [
            "blessed_regeneration_cured_3"
          ]
        }
      }
    }
  }
}