{
  "format_version": "1.21.0",
  "minecraft:entity": {
    "description": {
      "identifier": "silverlabs:heyhe_chicken",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false,
      "properties": {
        "silverlabs:heyhe_tamed": {
          "type": "bool",
          "default": false,
          "client_sync": true
        },
        "silverlabs:heyhe_sitting": {
          "type": "bool",
          "default": false,
          "client_sync": true
        }
      }
    },

    "component_groups": {

      "silverlabs:tamed_following": {
        "minecraft:behavior.follow_owner": {
          "priority": 4,
          "speed_multiplier": 0.9,
          "start_distance": 8,
          "stop_distance": 3
        },
        "minecraft:teleport": {
          "dark_teleport_chance": 0.01,
          "light_teleport_chance": 0.01,
          "max_random_teleport_time": 30,
          "min_random_teleport_time": 15,
          "target_distance": 64,
          "target_teleport_chance": 0.05
        }
      },

      "silverlabs:sitting": {
        "minecraft:behavior.sit": {
          "start_chance": 1.0
        }
      }

    },

    "components": {
      "minecraft:type_family": {
        "family": ["heyhe_chicken", "chicken", "animal"]
      },
      "minecraft:physics": {},
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      },
      "minecraft:collision_box": {
        "width": 0.4,
        "height": 0.7
      },
      "minecraft:health": {
        "value": 10,
        "max": 10
      },
      "minecraft:movement": {
        "value": 0.25
      },
      "minecraft:navigation.walk": {
        "can_path_over_water": false,
        "avoid_water": true,
        "avoid_damage_blocks": true
      },
      "minecraft:movement.basic": {},
      "minecraft:jump.static": {},
      "minecraft:can_climb": {},
      "minecraft:breathable": {
        "total_supply": 15,
        "suffocate_time": -1
      },
      "minecraft:persistent": {},
      "minecraft:nameable": {},

      "minecraft:interact": {
        "interactions": [
          {
            "on_interact": {
              "filters": {
                "all_of": [
                  { "test": "is_family", "subject": "other", "value": "player" },
                  { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "wheat" },
                  {
                    "test": "bool_property",
                    "domain": "silverlabs:heyhe_tamed",
                    "value": false
                  }
                ]
              },
              "event": "silverlabs:become_tamed",
              "target": "self"
            },
            "use_item": true,
            "interact_text": "Tame Hey Hey (Wheat)",
            "play_sounds": "random.eat"
          },
          {
            "on_interact": {
              "filters": {
                "all_of": [
                  { "test": "is_family", "subject": "other", "value": "player" },
                  { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "wheat_seeds" },
                  {
                    "test": "bool_property",
                    "domain": "silverlabs:heyhe_tamed",
                    "value": false
                  }
                ]
              },
              "event": "silverlabs:become_tamed",
              "target": "self"
            },
            "use_item": true,
            "interact_text": "Tame Hey Hey (Seeds)",
            "play_sounds": "random.eat"
          },
          {
            "on_interact": {
              "filters": {
                "all_of": [
                  { "test": "is_family", "subject": "other", "value": "player" },
                  {
                    "test": "bool_property",
                    "domain": "silverlabs:heyhe_tamed",
                    "value": true
                  },
                  {
                    "test": "has_equipment",
                    "subject": "other",
                    "domain": "hand",
                    "operator": "not",
                    "value": "wheat"
                  }
                ]
              },
              "event": "silverlabs:toggle_sit",
              "target": "self"
            },
            "use_item": false,
            "interact_text": "Sit / Stand"
          }
        ]
      },

      "minecraft:behavior.float": { "priority": 0 },
      "minecraft:behavior.panic": {
        "priority": 1,
        "speed_multiplier": 1.5
      },
      "minecraft:behavior.random_look_around": { "priority": 10 },
      "minecraft:behavior.random_stroll": {
        "priority": 8,
        "speed_multiplier": 0.6
      },
      "minecraft:behavior.look_at_player": {
        "priority": 9,
        "target_distance": 6,
        "look_time": [2, 4]
      },
      "minecraft:behavior.tempt": {
        "priority": 3,
        "speed_multiplier": 0.6,
        "items": ["wheat", "wheat_seeds", "beetroot_seeds", "melon_seeds", "pumpkin_seeds"],
        "can_tempt_vertically": false
      }
    },

    "events": {
      "minecraft:entity_spawned": {
        "set_property": { "silverlabs:heyhe_tamed": false }
      },
      "silverlabs:hatched": {
        "set_property": { "silverlabs:heyhe_tamed": false }
      },
      "silverlabs:become_tamed": {
        "set_property": { "silverlabs:heyhe_tamed": true },
        "add": { "component_groups": ["silverlabs:tamed_following"] }
      },
      "silverlabs:toggle_sit": {
        "sequence": [
          {
            "filters": {
              "test": "bool_property",
              "domain": "silverlabs:heyhe_sitting",
              "value": false
            },
            "set_property": { "silverlabs:heyhe_sitting": true },
            "add": { "component_groups": ["silverlabs:sitting"] }
          },
          {
            "filters": {
              "test": "bool_property",
              "domain": "silverlabs:heyhe_sitting",
              "value": true
            },
            "set_property": { "silverlabs:heyhe_sitting": false },
            "remove": { "component_groups": ["silverlabs:sitting"] }
          }
        ]
      }
    }
  }
}
