{
  "format_version": "1.19.0",
  "minecraft:entity": {
    "description": {
      "identifier": "minecraft:parrot",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false
    },

    "component_groups": {
      "minecraft:parrot_red": {
        "minecraft:variant": { "value": 0 }
      },
      "minecraft:parrot_blue": {
        "minecraft:variant": { "value": 1 }
      },
      "minecraft:parrot_green": {
        "minecraft:variant": { "value": 2 }
      },
      "minecraft:parrot_cyan": {
        "minecraft:variant": { "value": 3 }
      },
      "minecraft:parrot_silver": {
        "minecraft:variant": { "value": 4 }
      },

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

      "minecraft:parrot_wild": {
        "minecraft:type_family": {
          "family": [ "parrot_wild", "mob" ]
        },
        "minecraft:tameable": {
          "probability": 0.33,
          "tame_items": [
            "wheat_seeds",
            "pumpkin_seeds",
            "melon_seeds",
            "beetroot_seeds"
          ],
          "tame_event": {
            "event": "minecraft:on_tame",
            "target": "self"
          }
        },
        "minecraft:behavior.random_fly": {
          "priority": 2,
          "xz_dist": 15,
          "y_dist": 1,
          "y_offset": 0,
          "speed_multiplier": 1.0,
          "can_land_on_trees": true,
          "avoid_damage_blocks": true
        },
        "minecraft:behavior.follow_mob": {
          "priority": 3,
          "speed_multiplier": 1.0,
          "stop_distance": 3,
          "search_range": 20
        }
      },

      "minecraft:parrot_tame": {
        "minecraft:type_family": {
          "family": [ "parrot_tame", "mob" ]
        },
        "minecraft:is_tamed": {
        },
        "minecraft:behavior.follow_owner": {
          "priority": 2,
          "speed_multiplier": 1.0,
          "start_distance": 5,
          "stop_distance": 1
        },
        "minecraft:sittable": {
        },
        "minecraft:behavior.stay_while_sitting": {
          "priority": 1
        },
        "minecraft:behavior.find_mount": {
          "priority": 3,
          "within_radius": 16,
          "avoid_water": true,
          "start_delay": 100,
          "target_needed": false,
          "mount_distance": 2.0
        }
      },
      "minecraft:parrot_not_riding_player": {
        "minecraft:entity_sensor": {
          "sensor_range": 2.0,
          "relative_range": false,
          "event_filters": {
            "all_of": [
              {
                "test": "is_riding",
                "subject": "self",
                "operator": "equals",
                "value": true
              },
              {
                "test": "has_component",
                "subject": "self",
                "operator": "equals",
                "value": "minecraft:behavior.look_at_player"
              }
            ]
          },
          "event": "minecraft:on_riding_player"
        },
        "minecraft:behavior.look_at_player": {
          "priority": 1,
          "look_distance": 8.0
        }
      },
      "minecraft:parrot_riding_player": {
        "minecraft:entity_sensor": {
          "sensor_range": 2.0,
          "relative_range": false,
          "event_filters": {
            "all_of": [
              {
                "test": "is_riding",
                "subject": "self",
                "operator": "equals",
                "value": false
              },
              {
                "test": "has_component",
                "subject": "self",
                "operator": "not",
                "value": "minecraft:behavior.look_at_player"
              }
            ]
          },
          "event": "minecraft:on_not_riding_player"
        }
      }
    },

    "components": {
      "minecraft:is_hidden_when_invisible": {
      },
      "minecraft:breathable": {
        "total_supply": 15,
        "suffocate_time": 0
      },
      "minecraft:collision_box": {
        "width": 0.5,
        "height": 1
      },
      "minecraft:nameable": {
      },
      "minecraft:health": {
        "value": 6,
        "max": 6
      },
      "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.4
      },
      "minecraft:damage_sensor": {
        "triggers": {
          "cause": "fall",
          "deals_damage": false
        }
      },
      "minecraft:jump.static": {
      },
      "minecraft:can_fly": {
      },
      "minecraft:navigation.fly": {
        "can_path_over_water": true,
        "can_path_from_air": true
      },
      "minecraft:movement.fly": {
      },
      "minecraft:physics": {
      },
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      },
      "minecraft:despawn": {
        "despawn_from_distance": {}
      },
      "minecraft:behavior.float": {
        "priority": 0
      },
      "minecraft:behavior.panic": {
        "priority": 0,
        "speed_multiplier": 1.25
      },
      "minecraft:conditional_bandwidth_optimization": {
      },
      "minecraft:healable": {
        "force_use": true,
        "filters": {
          "test": "is_riding",
          "operator": "!=",
          "value": true
        },
        "items": [
          {
            "item": "cookie",
            "heal_amount": 0,
            "effects": [
              {
                "name": "fatal_poison",
                "chance": 1.0,
                "duration": 1000,
                "amplifier": 0
              }
            ]
          }
        ]
      },
      "minecraft:leashable": {
        "soft_distance": 4.0,
        "hard_distance": 6.0,
        "max_distance": 10.0
      },
      "minecraft:balloonable": {
      }
    },

    "events": {
      "minecraft:entity_spawned": {
        "randomize": [
          {
            "weight": 20,
            "add": {
              "component_groups": [
                "minecraft:parrot_red",
                "minecraft:parrot_adult",
                "minecraft:parrot_wild",
                "minecraft:parrot_not_riding_player"
              ]
            }
          },
          {
            "weight": 20,
            "add": {
              "component_groups": [
                "minecraft:parrot_blue",
                "minecraft:parrot_adult",
                "minecraft:parrot_wild",
                "minecraft:parrot_not_riding_player"
              ]
            }
          },
          {
            "weight": 20,
            "add": {
              "component_groups": [
                "minecraft:parrot_green",
                "minecraft:parrot_adult",
                "minecraft:parrot_wild",
                "minecraft:parrot_not_riding_player"
              ]
            }
          },
          {
            "weight": 20,
            "add": {
              "component_groups": [
                "minecraft:parrot_cyan",
                "minecraft:parrot_adult",
                "minecraft:parrot_wild",
                "minecraft:parrot_not_riding_player"
              ]
            }
          },
          {
            "weight": 20,
            "add": {
              "component_groups": [
                "minecraft:parrot_silver",
                "minecraft:parrot_adult",
                "minecraft:parrot_wild",
                "minecraft:parrot_not_riding_player"
              ]
            }
          }
        ]
      },
      "minecraft:on_tame": {
        "remove": {
          "component_groups": [
            "minecraft:parrot_wild"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:parrot_tame"
          ]
        }
      },
      "minecraft:on_riding_player": {
        "remove": {
          "component_groups": [
            "minecraft:parrot_not_riding_player"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:parrot_riding_player"
          ]
        }
      },
      "minecraft:on_not_riding_player": {
        "remove": {
          "component_groups": [
            "minecraft:parrot_riding_player"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:parrot_not_riding_player"
          ]
        }
      }
    }
  }
}
