{
    "format_version": "1.16.0",
    "minecraft:entity": {
        "description": {
            "identifier": "cero:button",
            "is_spawnable": true,
            "is_summonable": true,
            "is_experimental": false,

            "animations": {
                "animation_controller": "controller.animation.button.behavior"
            },

            "scripts": {
                "animate": [
                    "animation_controller"
                ]
            }
        },


        "components": {
            "minecraft:damage_sensor": { "triggers": { "cause": "all", "deals_damage": false }},
            "minecraft:loot": { "table": "loot_tables/empty.json" },
            "minecraft:scale": { "value": 1},
            "minecraft:health": { "value": 1, "max": 1 },
            "minecraft:physics": { "has_collision": false, "has_gravity": false }
        },















        "component_groups": {

            "not_clickable": {"minecraft:health": {"value": 1,"max": 0}},
            




            "clickable_play": {"minecraft:health": {"value": 2,"max": 0},
            "minecraft:interact": {
                "interactions": [{
                    "on_interact": {
                        "filters": {
                            "all_of": [
                                {
                                    "test":"has_tag",
                                    "subject": "player",
                                    "operator": "equals",
                                    "value": "turn"
                                }]},
                      "event": "clicked_play"
                    },
                    "swing": true,
                    "cooldown": 1,
                    "interact_text": "Play"
                }]}},

            "clicked_play": {"minecraft:health": {"value": 5,"max": 0}},
            





            "clickable_draw": {"minecraft:health": {"value": 3,"max": 0},
            "minecraft:interact": {
                "interactions": [{
                    "on_interact": {
                        "filters": {
                            "all_of": [
                                {
                                    "test":"has_tag",
                                    "subject": "player",
                                    "operator": "equals",
                                    "value": "turn"
                                }]},
                      "event": "clicked_draw"
                    },
                    "swing": true,
                    "cooldown": 1,
                    "interact_text": "Draw"
                }]}},

            "clicked_draw": {"minecraft:health": {"value": 6,"max": 0}},
            




            "clickable_keep": {"minecraft:health": {"value": 4,"max": 0},
            "minecraft:interact": {
                "interactions": [{
                    "on_interact": {
                        "filters": {
                            "all_of": [
                                {
                                    "test":"has_tag",
                                    "subject": "player",
                                    "operator": "equals",
                                    "value": "turn"
                                }]},
                      "event": "clicked_keep"
                    },
                    "swing": true,
                    "cooldown": 1,
                    "interact_text": "Keep"
                }]}},

            "clicked_keep": {"minecraft:health": {"value": 7,"max": 0}},
            






            "play": {"minecraft:variant":{ "value": 0 }},
            "draw": {"minecraft:variant":{ "value": 1 }},
            "keep": {"minecraft:variant":{ "value": 2 }},



























            
            "ui_startminus": {
                "minecraft:variant":{ "value": 3 },
                "minecraft:health": {"value": 13,"max": 0},
                "minecraft:scale": { "value": 0.2 },
                "minecraft:custom_hit_test": {
                    "hitboxes": [
                        {
                            "width": 0.2,
                            "height": 0.2,
                            "pivot": [
                                0,
                                0,
                                0
                            ]
                        }
                    ]
                },
                "minecraft:collision_box": {
                    "height": 0,
                    "width": 0
                },
                "minecraft:interact": {
                    "interactions": [{
                        "on_interact": {
                            "filters": {
                                "all_of": [
                                    {
                                        "test":"is_family",
                                        "subject": "other",
                                        "value": "player"
                                    }]},
                          "event": "ui_startminus_clicked"
                        },
                        "swing": true,
                        "cooldown": 0,
                        "interact_text": "-"
                    }]}
            },

            "ui_startminus_clicked": {
                "minecraft:variant":{ "value": 3 },
                "minecraft:health": {"value": 23,"max": 0},
                "minecraft:scale": { "value": 0.2 },
                "minecraft:custom_hit_test": {
                    "hitboxes": [
                        {
                            "width": 0.2,
                            "height": 0.2,
                            "pivot": [
                                0,
                                0,
                                0
                            ]
                        }
                    ]
                },
                "minecraft:collision_box": {
                    "height": 0,
                    "width": 0
                },
                "minecraft:interact": {
                    "interactions": [{
                        "on_interact": {
                            "filters": {
                                "all_of": [
                                    {
                                        "test":"is_family",
                                        "subject": "other",
                                        "value": "player"
                                    }]},
                          "event": "ui_startminus"
                        },
                        "swing": true,
                        "cooldown": 0,
                        "interact_text": "-"
                    }]}
            },











            "ui_startplus": {
                "minecraft:variant":{ "value": 4 },
                "minecraft:health": {"value": 14,"max": 0},
                "minecraft:scale": { "value": 0.2 },
                "minecraft:custom_hit_test": {
                    "hitboxes": [
                        {
                            "width": 0.2,
                            "height": 0.2,
                            "pivot": [
                                0,
                                0,
                                0
                            ]
                        }
                    ]
                },
                "minecraft:collision_box": {
                    "height": 0,
                    "width": 0
                },
                "minecraft:interact": {
                    "interactions": [{
                        "on_interact": {
                            "filters": {
                                "all_of": [
                                    {
                                        "test":"is_family",
                                        "subject": "other",
                                        "value": "player"
                                    }]},
                          "event": "ui_startplus_clicked"
                        },
                        "swing": true,
                        "cooldown": 0,
                        "interact_text": "+"
                    }]}
            },

            "ui_startplus_clicked": {
                "minecraft:variant":{ "value": 4 },
                "minecraft:health": {"value": 24,"max": 0},
                "minecraft:scale": { "value": 0.2 },
                "minecraft:custom_hit_test": {
                    "hitboxes": [
                        {
                            "width": 0.2,
                            "height": 0.2,
                            "pivot": [
                                0,
                                0,
                                0
                            ]
                        }
                    ]
                },
                "minecraft:collision_box": {
                    "height": 0,
                    "width": 0
                },
                "minecraft:interact": {
                    "interactions": [{
                        "on_interact": {
                            "filters": {
                                "all_of": [
                                    {
                                        "test":"is_family",
                                        "subject": "other",
                                        "value": "player"
                                    }]},
                          "event": "ui_startplus"
                        },
                        "swing": true,
                        "cooldown": 0,
                        "interact_text": "+"
                    }]}
            },












            "ui_drawstack_disabled": {
                "minecraft:variant":{ "value": 5 },
                "minecraft:health": {"value": 15,"max": 0},
                "minecraft:scale": { "value": 0 },
                "minecraft:custom_hit_test": {
                    "hitboxes": [
                        {
                            "width": 0.8,
                            "height": 0.35,
                            "pivot": [
                                -0.35,
                                0.5,
                                0
                            ]
                        }
                    ]
                },
                "minecraft:collision_box": {
                    "height": 0,
                    "width": 0
                },
                "minecraft:interact": {
                    "interactions": [{
                        "on_interact": {
                            "filters": {
                                "all_of": [
                                    {
                                        "test":"is_family",
                                        "subject": "other",
                                        "value": "player"
                                    }]},
                          "event": "ui_drawstack_enabled"
                        },
                        "swing": true,
                        "cooldown": 0,
                        "interact_text": "Enable stacking draw cards"
                    }]}
            },



















            "ui_drawstack_enabled": {
                "minecraft:variant":{ "value": 6 },
                "minecraft:health": {"value": 16,"max": 0},
                "minecraft:scale": { "value": 0 },
                "minecraft:custom_hit_test": {
                    "hitboxes": [
                        {
                            "width": 0.8,
                            "height": 0.35,
                            "pivot": [
                                -0.35,
                                0.5,
                                0
                            ]
                        }
                    ]
                },
                "minecraft:collision_box": {
                    "height": 0,
                    "width": 0
                },
                "minecraft:interact": {
                    "interactions": [{
                        "on_interact": {
                            "filters": {
                                "all_of": [
                                    {
                                        "test":"is_family",
                                        "subject": "other",
                                        "value": "player"
                                    }]},
                          "event": "ui_drawstack_disabled"
                        },
                        "swing": true,
                        "cooldown": 0,
                        "interact_text": "Disable stacking draw cards"
                    }]}},










                    "ui_resetlb": {
                        "minecraft:variant":{ "value": 6 },
                        "minecraft:skin_id": {
                            "value": 3
                        },
                        "minecraft:scale": { "value": 0 },
                        "minecraft:custom_hit_test": {
                            "hitboxes": [
                                {
                                    "width": 0.8,
                                    "height": 0.35,
                                    "pivot": [
                                        -0.35,
                                        0.5,
                                        0
                                    ]
                                }
                            ]
                        },
                        "minecraft:collision_box": {
                            "height": 0,
                            "width": 0
                        },
                        "minecraft:interact": {
                            "interactions": [{
                                "on_interact": {
                                    "filters": {
                                        "all_of": [
                                            {
                                                "test":"is_family",
                                                "subject": "other",
                                                "value": "player"
                                            }]},
                                  "event": "ui_resetlb2"
                                },
                                "swing": true,
                                "cooldown": 0,
                                "interact_text": "Reset leaderbord scores"
                            }]}},
                            "ui_resetlb2": {
                                "minecraft:scale": { "value": 0 },
                                "minecraft:skin_id": {
                                    "value": 4
                                }

                                    },










                    "ui_showlb_off": {
                        "minecraft:variant":{ "value": 6 },
                        "minecraft:skin_id": {
                            "value": 2
                        },
                        "minecraft:scale": { "value": 0 },
                        "minecraft:custom_hit_test": {
                            "hitboxes": [
                                {
                                    "width": 0.8,
                                    "height": 0.35,
                                    "pivot": [
                                        -0.35,
                                        0.5,
                                        0
                                    ]
                                }
                            ]
                        },
                        "minecraft:collision_box": {
                            "height": 0,
                            "width": 0
                        },
                        "minecraft:interact": {
                            "interactions": [{
                                "on_interact": {
                                    "filters": {
                                        "all_of": [
                                            {
                                                "test":"is_family",
                                                "subject": "other",
                                                "value": "player"
                                            }]},
                                  "event": "ui_showlb_on"
                                },
                                "swing": true,
                                "cooldown": 0,
                                "interact_text": "Show leaderbord"
                            }]}},


                            
                            "ui_showlb_on": {
                                "minecraft:variant":{ "value": 6 },
                                "minecraft:skin_id": {
                                    "value": 1
                                },
                                "minecraft:scale": { "value": 0 },
                                "minecraft:custom_hit_test": {
                                    "hitboxes": [
                                        {
                                            "width": 0.8,
                                            "height": 0.35,
                                            "pivot": [
                                                -0.35,
                                                0.5,
                                                0
                                            ]
                                        }
                                    ]
                                },
                                "minecraft:collision_box": {
                                    "height": 0,
                                    "width": 0
                                },
                                "minecraft:interact": {
                                    "interactions": [{
                                        "on_interact": {
                                            "filters": {
                                                "all_of": [
                                                    {
                                                        "test":"is_family",
                                                        "subject": "other",
                                                        "value": "player"
                                                    }]},
                                          "event": "ui_showlb_off"
                                        },
                                        "swing": true,
                                        "cooldown": 0,
                                        "interact_text": "Hide leaderbord"
                                    }]}}





        },


















        "events": {
            
            "not_clickable":{
                "add": {"component_groups": ["not_clickable" ]},
                "remove": {"component_groups": ["clickable_play", "clickable_draw", "clickable_keep" ]}},


                "clickable_play":{
                    "add": {"component_groups": ["clickable_play" ]},
                    "remove": {"component_groups": ["not_clickable" ]}},


                "clickable_draw":{
                    "add": {"component_groups": ["clickable_draw" ]},
                    "remove": {"component_groups": ["not_clickable" ]}},


                "clickable_keep":{
                    "add": {"component_groups": ["clickable_keep" ]},
                    "remove": {"component_groups": ["not_clickable" ]}},





            "clicked_play":{
                "add": {"component_groups": ["clicked_play" ]},
                "remove": {"component_groups": ["clickable_play", "clickable_draw", "clickable_keep" ]}},

            "clicked_draw":{
                "add": {"component_groups": ["clicked_draw" ]},
                "remove": {"component_groups": ["clickable_play", "clickable_draw", "clickable_keep" ]}},
    
            "clicked_keep":{
                "add": {"component_groups": ["clicked_keep" ]},
                "remove": {"component_groups": ["clickable_play", "clickable_draw", "clickable_keep" ]}},




    
            "clicked_done":{
                "add": {"component_groups": ["not_clickable" ]},
                "remove": {"component_groups": ["clicked_play", "clicked_draw", "clicked_keep" ]}},










    
            "ui_drawstack_disabled":{
                "add": {"component_groups": ["ui_drawstack_disabled" ]},
                "remove": {"component_groups": ["ui_drawstack_enabled"]}
                },
                
            "ui_drawstack_enabled":{
            "add": {"component_groups": ["ui_drawstack_enabled" ]},
            "remove": {"component_groups": ["ui_drawstack_disabled"]}
                },



            "ui_startminus":{
            "add": {"component_groups": ["ui_startminus" ]},
            "remove": {"component_groups": ["ui_startminus_clicked"]}
                },

            "ui_startplus":{
            "add": {"component_groups": ["ui_startplus" ]},
            "remove": {"component_groups": ["ui_startplus_clicked"]}
                },

            "ui_startminus_clicked":{
            "add": {"component_groups": ["ui_startminus_clicked" ]},
            "remove": {"component_groups": ["ui_startminus"]}
                },

            "ui_startplus_clicked":{
            "add": {"component_groups": ["ui_startplus_clicked" ]},
            "remove": {"component_groups": ["ui_startplus"]}
                },





            "ui_showlb_off":{
            "add": {"component_groups": ["ui_showlb_off" ]},
            "remove": {"component_groups": ["ui_showlb_on", "not_clickable"]}
                },


            "ui_showlb_on":{
            "add": {"component_groups": ["ui_showlb_on" ]},
            "remove": {"component_groups": ["ui_showlb_off", "not_clickable"]}
                },


            "ui_resetlb":{
            "add": {"component_groups": ["ui_resetlb" ]},
            "remove": {"component_groups": ["ui_resetlb2" ]}
                },


            "ui_resetlb2":{
                "add": {"component_groups": ["ui_resetlb2" ]},
                "remove": {"component_groups": ["ui_resetlb" ]}
                },






            "play":{"add": {"component_groups": ["play", "not_clickable" ]}},
            "draw":{"add": {"component_groups": ["draw", "not_clickable" ]}},
            "keep":{"add": {"component_groups": ["keep", "not_clickable" ]}}
        }

        
    }
}
