zoglin

{
  "format_version": "1.18.30",
  "minecraft:entity": {
    "description": {
      "identifier": "minecraft:zoglin",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false
    },

    "component_groups": {
      "zoglin_baby": {
        "minecraft:type_family": {
          "family": [ "zoglin", "zoglin_baby", "undead", "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", "mob" ]
        },
        "minecraft:collision_box": {
          "width": 0.9,
          "height": 0.9
        },
        "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 ]
        }
      }
    },

    "components": {
      "minecraft:is_hidden_when_invisible": {
      },
      "minecraft:nameable": {
      },
      "minecraft:loot": {
        "table": "loot_tables/entities/zoglin.json"
      },
      "minecraft:experience_reward": {
        "on_bred": "Math.Random(1,7)",
        "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_attack": {
        "priority": 4,
        "speed_multiplier": 1.4,
        "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": {
        "soft_distance": 4.0,
        "hard_distance": 6.0,
        "max_distance": 10.0
      },
      "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": {
      "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:as_adult": {
        "add": {
          "component_groups": [
            "zoglin_adult"
          ]
        }
      },
      "minecraft:as_baby": {
        "add": {
          "component_groups": [
            "zoglin_baby"
          ]
        }
      }
    }
  }
}