{
  "format_version": "1.21.0",
  "minecraft:entity": {
    "description": {
      "identifier": "minecraft:polar_bear",
      "spawn_category": "creature",
      "is_spawnable": true,
      "is_summonable": true
    },

    "component_groups": {
      "minecraft:baby": {
        "minecraft:is_baby": {
        },
        "minecraft:scale": {
          "value": 0.5
        },
        "minecraft:ageable": {
          "duration": 1200,
          "grow_up": {
            "event": "minecraft:ageable_grow_up",
            "target": "self"
          }
        },
        "minecraft:behavior.follow_parent": {
          "priority": 4,
          "speed_multiplier": 1.25
        }
      },

      "minecraft:baby_wild": {
        "minecraft:on_target_acquired": {
          "event": "minecraft:on_scared",
          "target": "self"
        },
        "minecraft:behavior.nearest_attackable_target": {
          "priority": 4,
          "entity_types": [
            {
              "filters": { "test" :  "is_family", "subject" : "other", "value" :  "player"},
              "max_dist": 16
            }
          ]
        }
      },

      "minecraft:baby_scared": {
        "minecraft:angry": {
          "duration": 1,
          "broadcast_anger": true,
          "broadcast_range": 41,
          "calm_event": {
            "event": "minecraft:baby_on_calm",
            "target": "self"
          }
        }
      },

      "minecraft:adult": {
        "minecraft:experience_reward": {
          "on_death": "query.last_hit_by_player ? Math.Random(1,3) : 0"
        },
        "minecraft:loot": {
          "table": "loot_tables/entities/polar_bear.json"
        }
      },

      "minecraft:adult_wild": {
        "minecraft:on_target_acquired": {
          "event": "minecraft:on_anger",
          "target": "self"
        },
        "minecraft:on_friendly_anger": {
          "event": "minecraft:on_anger",
          "target": "self"
        },
        "minecraft:behavior.nearest_attackable_target": {
          "priority": 4,
          "entity_types": [
            {
              "filters": {
                "test": "is_family", "subject": "other", "value": "fox"
              },
              "max_dist": 16
            }
          ],
          "must_see": false
        }
      },

      "minecraft:adult_hostile": {
        "minecraft:attack": {
          "damage": 6.0
        },
        "minecraft:angry": {
          "duration": 500,
          "broadcast_anger": false,
          "broadcast_range": 20,
          "calm_event": {
            "event": "minecraft:on_calm",
            "target": "self"
          }
        },

        "minecraft:behavior.stomp_attack": {
          "priority": 1,
          "track_target": true,
          "require_complete_path": true,
          "stomp_range_multiplier": 2.0,
          "no_damage_range_multiplier": 2.0
        }
      }
    },

    "components": {
      "minecraft:is_hidden_when_invisible": {
      },
      "minecraft:type_family": {
        "family": [ "polarbear", "mob" ]
      },
      "minecraft:breathable": {
        "total_supply": 15,
        "suffocate_time": 0
      },
      "minecraft:nameable": {
      },
      "minecraft:health": {
        "value": 30
      },
      "minecraft:hurt_on_condition": {
        "damage_conditions": [
          {
            "filters": { "test": "in_lava", "subject": "self", "operator": "==", "value": true },
            "cause": "lava",
            "damage_per_tick": 4
          }
        ]
      },
      "minecraft:collision_box": {
        "width": 1.4,
        "height": 1.4
      },
      "minecraft:movement": {
        "value": 0.25
      },
      "minecraft:water_movement": {
        "drag_factor": 0.98
      },
      "minecraft:navigation.walk": {
        "can_path_over_water": true,
        "avoid_damage_blocks": true
      },
      "minecraft:movement.basic": {

      },
      "minecraft:jump.static": {
      },
      "minecraft:can_climb": {
      },
      "minecraft:follow_range": {
        "value": 48
      },
      "minecraft:despawn": {
        "despawn_from_distance": {}
      },
      "minecraft:behavior.float": {
        "priority": 0
      },
      "minecraft:behavior.hurt_by_target": {
        "priority": 1
      },
      "minecraft:behavior.random_stroll": {
        "priority": 5
      },
      "minecraft:behavior.look_at_player": {
        "priority": 6,
        "target_distance": 6.0,
        "probability": 0.02
      },
      "minecraft:behavior.random_look_around": {
        "priority": 7
      },
      "minecraft:physics": {
      },
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      },
      "minecraft:leashable": {
        "soft_distance": 4.0,
        "hard_distance": 6.0,
        "max_distance": 10.0
      },
      "minecraft:balloonable": {
      },
      "minecraft:conditional_bandwidth_optimization": {
      }
    },

    "events": {
      "minecraft:entity_spawned": {
        "randomize": [
          {
            "weight": 9,
            "add": {
              "component_groups": [
                "minecraft:adult",
                "minecraft:adult_wild"
              ]
            }
          },
          {
            "weight": 1,
            "add": {
              "component_groups": [
                "minecraft:baby",
                "minecraft:baby_wild"
              ]
            }
          }
        ]
      },

      "minecraft:entity_born": {
        "add": {
          "component_groups": [
            "minecraft:baby",
            "minecraft:baby_wild"
          ]
        }
      },

      "minecraft:ageable_grow_up": {
        "remove": {
          "component_groups": [
            "minecraft:baby",
            "minecraft:baby_wild",
            "minecraft:baby_scared"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:adult",
            "minecraft:adult_wild"
          ]
        }
      },

      "minecraft:on_calm": {
        "remove": {
          "component_groups": [
            "minecraft:adult_hostile"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:adult_wild"
          ]
        }
      },

      "minecraft:on_anger": {
        "remove": {
          "component_groups": [
            "minecraft:adult_wild"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:adult_hostile"
          ]
        }
      },

      "minecraft:baby_on_calm": {
        "remove": {
          "component_groups": [
            "minecraft:baby_scared"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:baby_wild"
          ]
        }
      },

      "minecraft:on_scared": {
        "remove": {
          "component_groups": [
            "minecraft:baby_wild"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:baby_scared"
          ]
        }
      }
    }
  }
}
