{
  "format_version": "1.20.50",
  "minecraft:entity": {
    "description": {
      "identifier": "cc_alien:alien_beacon_ufo_1",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false,
      "scripts": {
        "animate": [
          "despawn_controller",
          "crash_on_damage",
          "stage_controller",
          "fall_controller",
          { "player_near": "!q.property('cc_alien:crashed')" }
        ]
      },
      "animations": {
        "despawn_controller": "controller.animation.cc_alien.alien_beacon_ufo_1.despawn_controller",
        "spawn_mobs": "animation.cc_alien.alien_beacon_ufo_1.spawn_mobs",
        "crash_on_damage": "controller.animation.cc_alien.alien_beacon_ufo_1.crash_on_damage",
        "wait_2s": "animation.cc_alien.alien_beacon_ufo_1.wait_2s",
        "stage_controller": "controller.animation.cc_alien.alien_beacon_ufo_1.stage_controller",
        "fall_controller": "controller.animation.cc_alien.alien_beacon_ufo_1.fall_controller",
        "player_near": "animation.cc_alien.alien_beacon_player.player_near"
      },
      "properties": {
        "cc_alien:despawn": {
          "default": false,
          "type": "bool"
        },
        "cc_alien:crashed": {
          "default": false,
          "type": "bool",
          "client_sync": true
        },
        "cc_alien:player_near": {
          "default": false,
          "type": "bool",
          "client_sync": true
        }
      }
    },
    "components": {
      "minecraft:health": {
        "min": 9,
        "max": 55
      },
      "minecraft:damage_sensor": {
        "triggers": [
          {
            "cause": "fall",
            "deals_damage": false
          }
        ]
      },
      "minecraft:experience_reward": {
        "on_death": 4
      },
      "minecraft:loot": {
        "table": "loot_tables/cc/alien/entities/alien_beacon.json"
      },
      "minecraft:physics": {},
      "minecraft:pushable": {
        "is_pushable": false,
        "is_pushable_by_piston": true
      },
      "minecraft:knockback_resistance": {
        "value": 1.0
      },
      "minecraft:balloonable": {
        "mass": 0.4
      },
      "minecraft:behavior.float": {
        "priority": 0
      },
      "minecraft:variant": {
        "value": 0
      },
      "minecraft:type_family": {
        "family": [
          "cc_alien_beacon"
        ]
      }
    },
    "component_groups": {
      "crashed": {
        "minecraft:health": {
          "min": 0,
          "max": 10
        },
        "minecraft:knockback_resistance": {
          "value": 1.0
        },
        "minecraft:pushable": {
          "is_pushable": false,
          "is_pushable_by_piston": true
        },
        "minecraft:movement": {
          "value": 0
        }
      },
      "active": {
        "minecraft:variant": {
          "value": 1
        }
      },
      "spawn_mobs": {
        "minecraft:timer": {
          "time_down_event": {
            "event": "on_spawn_entity_off",
            "target": "self"
          },
          "time": [5, 5]
        },
        "minecraft:variant": {
          "value": 2
        }
      },
      "summon_timer": {
        "minecraft:timer": {
          "time": 300,
          "time_down_event": {
            "event": "on_spawn_entity",
            "target": "self"
          }
        }
      },
      "despawn_timer":{
        "minecraft:timer": {
          "time": 20,
          "looping": false,
          "time_down_event": {
            "event": "despawn",
            "target": "self"
          }
        }
      }
    },
    "events": {
      "on_crash": {
        "remove": {
          "component_groups": ["active", "spawn_mobs"]
        },
        "add": {
          "component_groups": ["crashed"]
        },
        "set_property": {
          "cc_alien:crashed": true
        }
      },
      "on_activate": {
        "remove": {
          "component_groups": ["spawn_mobs"]
        },
        "add": {
          "component_groups": ["active"]
        }
      },
      "on_deactivate": {
        "remove": {
          "component_groups": ["active"]
        }
      },
      "on_spawn_entity": {
        "remove": {
          "component_groups": ["active"]
        },
        "add": {
          "component_groups": ["spawn_mobs"]
        }
      },
      "on_spawn_entity_off": {
        "remove": {
          "component_groups": ["spawn_mobs"]
        },
        "add": {
          "component_groups": ["active", "summon_timer"]
        }
      },
      "cc:player_near": {
        "set_property": {
          "cc_alien:player_near": true
        }
      },
      "cc:player_not_near": {
        "set_property": {
          "cc_alien:player_near": false
        }
      },
      "remove_timers": {
        "sequence": [
          {
            "remove": {
              "component_groups": ["summon_timer", "spawn_mobs"]
            }
          },
          {
            "add": {
              "component_groups": [
                "despawn_timer"
              ]
            }
          }
        ]
      },
      "despawn":{
        "set_property": {
          "cc_alien:despawn": true
        }
      }
    }
  }
}
