{
  "format_version": "1.26.0",
  "minecraft:entity": {
    "description": {
      "identifier": "minecraft:zoglin",
      "spawn_category": "monster",
      "is_spawnable": true,
      "is_summonable": true
    },

    "component_groups": {
      "zoglin_baby": {
        "minecraft:type_family": {
          "family": ["zoglin", "zoglin_baby", "undead", "monster", "mob"]
        },
        "minecraft:is_baby": {},
        "minecraft:attack": {
          "damage": 0.5
        },
        "minecraft:scale": {
          "value": 0.5
        },
        "minecraft:collision_box": {
          "width": 0.85,
          "height": 0.85
        },
        "minecraft:custom_hit_test": {
          "hitboxes": [
            {
              "width": 1.0,
              "height": 0.85,
              "pivot": [0, 0.5, 0]
            }
          ]
        }
      },
      "zoglin_adult": {
        "minecraft:type_family": {
          "family": ["zoglin", "zoglin_adult", "undead", "monster", "mob"]
        },
        "minecraft:collision_box": {
          "width": 1.4,
          "height": 1.4
        },
        "minecraft:leashable_to": {},
        "minecraft:custom_hit_test": {
          "hitboxes": [
            {
              "width": 2.0,
              "height": 1.75,
              "pivot": [0, 1, 0]
            }
          ]
        },
        "minecraft:behavior.hurt_by_target": {
          "priority": 1
        },
        "minecraft:attack": {
          "damage": [3, 8]
        }
      },
      "angry_zoglin": {
        "minecraft:angry": {
          "duration": 10,
          "calm_event": {
            "event": "become_calm_event",
            "target": "self"
          },
          "angry_sound": "angry",
          "sound_interval": {
            "range_min": 2.0,
            "range_max": 5.0
          }
        }
      }
    },

    "components": {
      "minecraft:on_target_acquired": {
        "event": "become_angry_event",
        "target": "self"
      },
      "minecraft:is_hidden_when_invisible": {},
      "minecraft:nameable": {},
      "minecraft:offspring": {
        "offspring_pairs": {
          "minecraft:zoglin": "minecraft:zoglin"
        }
      },
      "minecraft:spawn_egg_interaction": {},
      "minecraft:loot": {
        "table": "loot_tables/entities/zoglin.json"
      },
      "minecraft:experience_reward": {
        "on_death": "query.last_hit_by_player ? 5 : 0"
      },
      "minecraft:health": {
        "value": 40,
        "max": 40
      },
      "minecraft:knockback_resistance": {
        "value": 0.6
      },
      "minecraft:behavior.nearest_attackable_target": {
        "priority": 3,
        "within_radius": 16.0,
        "entity_types": [
          {
            "filters": {
              "all_of": [
                {
                  "test": "is_family",
                  "subject": "other",
                  "operator": "!=",
                  "value": "zoglin"
                },
                {
                  "test": "is_family",
                  "subject": "other",
                  "operator": "!=",
                  "value": "creeper"
                }
              ]
            },
            "max_dist": 16
          }
        ],
        "must_see": true
      },
      "minecraft:behavior.melee_box_attack": {
        "priority": 4,
        "speed_multiplier": 1.15,
        "track_target": true
      },
      "minecraft:breathable": {
        "total_supply": 15,
        "suffocate_time": 0,
        "breathes_water": true
      },
      "minecraft:movement": {
        "value": 0.25
      },
      "minecraft:navigation.walk": {
        "is_amphibious": true,
        "can_path_over_water": false,
        "avoid_water": true,
        "avoid_damage_blocks": true
      },
      "minecraft:movement.basic": {},
      "minecraft:jump.static": {},
      "minecraft:can_climb": {},
      "minecraft:fire_immune": {},
      "minecraft:leashable": {},
      "minecraft:balloonable": {},
      "minecraft:despawn": {
        "filters": {
          "any_of": [
            {
              "all_of": [
                { "test": "is_persistent", "value": false },
                {
                  "test": "distance_to_nearest_player",
                  "operator": ">",
                  "value": 54
                }
              ]
            },
            {
              "all_of": [
                { "test": "is_persistent", "value": false },
                { "test": "inactivity_timer", "subject": "self", "value": 30 },
                { "test": "random_chance", "value": 800 },
                {
                  "test": "distance_to_nearest_player",
                  "operator": ">",
                  "value": 32
                }
              ]
            }
          ]
        }
      },
      "minecraft:behavior.random_stroll": {
        "priority": 7,
        "speed_multiplier": 1.0
      },
      "minecraft:behavior.random_look_around": {
        "priority": 9
      },
      "minecraft:behavior.look_at_player": {
        "priority": 8,
        "look_distance": 6.0,
        "probability": 0.02
      },
      "minecraft:physics": {},
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      },
      "minecraft:conditional_bandwidth_optimization": {}
    },

    "events": {
      "become_angry_event": {
        "add": {
          "component_groups": ["angry_zoglin"]
        }
      },
      "become_calm_event": {
        "remove": {
          "component_groups": ["angry_zoglin"]
        }
      },
      "minecraft:entity_transformed": {
        "sequence": [
          {
            "filters": {
              "test": "has_component",
              "subject": "other",
              "value": "minecraft:is_baby"
            },
            "add": {
              "component_groups": ["zoglin_baby"]
            }
          },
          {
            "filters": {
              "test": "has_component",
              "subject": "other",
              "operator": "!=",
              "value": "minecraft:is_baby"
            },
            "add": {
              "component_groups": ["zoglin_adult"]
            }
          }
        ]
      },
      "minecraft:entity_spawned": {
        "randomize": [
          {
            "weight": 95,
            "add": {
              "component_groups": ["zoglin_adult"]
            }
          },
          {
            "weight": 5,
            "add": {
              "component_groups": ["zoglin_baby"]
            }
          }
        ]
      },
      "minecraft:entity_born": {
        "trigger": "minecraft:as_baby"
      },
      "minecraft:as_adult": {
        "add": {
          "component_groups": ["zoglin_adult"]
        }
      },
      "minecraft:as_baby": {
        "add": {
          "component_groups": ["zoglin_baby"]
        }
      }
    }
  }
}
