{
    "format_version": "1.19.0",
    "minecraft:entity": {
        "description": {
            "identifier": "hatchi:spaceship",
            "is_spawnable": true,
            "is_summonable": true,
            "scripts": {
                "animate": [
                    { "hatchi:flight": "query.modified_move_speed > 0.1 && q.has_rider"},
                    { "hatchi:float": "query.modified_move_speed <= 0.1 && q.has_rider"}
                ]
            },
            "animations": {
                "hatchi:flight": "animation.spaceship.flight",
                "hatchi:float": "animation.spaceship.float"
            },
            "properties": {
                "hatchi:movement":{
                    "type": "enum",
                    "values": [
                      "grounded",
                      "flying",
                      "none"
                    ],
                    "default": "none"
                }
            }

        },
        "permutations":[
            {
                "condition":"q.property('hatchi:movement') == 'none'",
                "components": {
                    "minecraft:movement": { "value": 0 },
                    "minecraft:scale": { "value": 1 }
                }
            },
            {
                "condition":"q.property('hatchi:movement') == 'grounded'",
                "components": {
                    "minecraft:movement": { "value": 0 },
                    "minecraft:scale": { "value": 2 }
                }
            },
            {
                "condition":"q.property('hatchi:movement') == 'flying'",
                "components": {
                    "minecraft:movement": { "value": 1 },
                    "minecraft:scale": { "value": 5 }
                }
            }
        ],
        
        "components": {
            "minecraft:movement": {
                "value": 0
            },
            "minecraft:is_stackable": {},
            "minecraft:collision_box": {
                "height": 2,
                "width": 3
            },
			"minecraft:input_ground_controlled": {},
            "minecraft:physics": {
                "has_collision": true,
                "has_gravity": true
            },
            "minecraft:damage_sensor": {
                "triggers": [
                    {
                        "on_damage": {
                            "filters": {
                                "test": "has_damage",
                                "subject": "self",
                                "value": "fall"
                            }
                        },
                        "deals_damage": false
                    }
                ]
            },
            "minecraft:rideable": {
                "seat_count": 1,
                "interact_text": "action.interact.ride.minecart",
                "pull_in_entities": true,
        
                "seats": {
                  "position": [ 0.0, 0.05, 0.0 ]
                }
            },
            "minecraft:environment_sensor": {
                "triggers": [
                    {
                        "filters": {
                            "test": "rider_count",
                            "value": 1
                        },
                        "event": "hatchi:rider"
                    },
                    {
                        "filters": {
                            "test": "rider_count",
                            "value": 0
                        },
                        "event": "hatchi:no_rider"
                    },
                    {
                        "filters": {
                            "test": "on_ground",
                            "value": true
                        },
                        "event": "hatchi:grounded"
                    }
                ]
            }
        },
        "events": {
            "minecraft:entity_spawned": {
                "add": {
                    "component_groups": [
                        "hatchi:flying"
                    ]
                },
                "set_property": {
                    "hatchi:movement": "none"
                }
            },
            "hatchi:grounded": {
                "set_property": {
                    "hatchi:movement": "grounded"
                }
            },
            "hatchi:rider": {
                "set_property": {
                    "hatchi:movement": "flying"
                }
            },
            "hatchi:no_rider": {
                "set_property": {
                    "hatchi:movement": "none"
                }
            }
        }
    }
}