{
  "format_version": "1.21.0",
  "minecraft:entity": {
    "description": {
      "identifier": "silverlabs:heyhe_egg",
      "is_spawnable": false,
      "is_summonable": true,
      "is_experimental": false
    },

    "component_groups": {

      "silverlabs:egg_waiting": {
        "minecraft:timer": {
          "looping": false,
          "time": 10,
          "time_down_event": {
            "event": "silverlabs:start_hatching",
            "target": "self"
          }
        }
      },

      "silverlabs:egg_hatching": {
        "minecraft:spawn_entity": {
          "entities": [
            {
              "min_wait_time": 0,
              "max_wait_time": 1,
              "spawn_sound": "mob.chicken.egg",
              "spawn_entity": "silverlabs:heyhe_chicken",
              "spawn_event": "silverlabs:hatched",
              "num_to_spawn": 1,
              "single_use": true
            }
          ]
        },
        "minecraft:timer": {
          "looping": false,
          "time": 2,
          "time_down_event": {
            "event": "silverlabs:despawn_egg",
            "target": "self"
          }
        }
      },

      "silverlabs:egg_despawning": {
        "minecraft:instant_despawn": {}
      }

    },

    "components": {
      "minecraft:type_family": { "family": ["heyhe_egg"] },
      "minecraft:physics": { "has_gravity": true, "has_collision": true },
      "minecraft:collision_box": { "width": 0.5, "height": 0.6 },
      "minecraft:pushable": { "is_pushable": false, "is_pushable_by_piston": false },
      "minecraft:knockback_resistance": { "value": 1.0 },
      "minecraft:persistent": {},
      "minecraft:health": { "value": 5, "max": 5 }
    },

    "events": {
      "minecraft:entity_spawned": {
        "add": { "component_groups": ["silverlabs:egg_waiting"] }
      },
      "silverlabs:start_hatching": {
        "remove": { "component_groups": ["silverlabs:egg_waiting"] },
        "add": { "component_groups": ["silverlabs:egg_hatching"] }
      },
      "silverlabs:despawn_egg": {
        "add": { "component_groups": ["silverlabs:egg_despawning"] }
      }
    }
  }
}
