{
    "format_version": "1.19.20",
    "minecraft:entity": {
        "description": {
            "identifier": "rc:ground_backpack_container",
            "is_spawnable": false,
            "is_summonable": true,
            "is_experimental": false
        },
        "component_groups": {
            "minecraft:instant_despawn": {
                "minecraft:instant_despawn": {}
            },
            "big_hitbox": {
                "minecraft:collision_box": {
                    "width": 1.1,
                    "height": 0.9
                }
            },
            "small_hitbox": {
                "minecraft:collision_box": {
                    "width": 0.1,
                    "height": 0.1
                }
            },
            "on_inventory_open": {
                "minecraft:entity_sensor": {
                    "sensor_range": 3,
                    "relative_range": false,
                    "minimum_count": 1,
                    "event_filters": {
                        "any_of": [
                            {
                                "all_of": [
                                    {
                                        "test": "is_family",
                                        "subject": "other",
                                        "value": "player"
                                    },
                                    {
                                        "test": "has_container_open",
                                        "subject": "other",
                                        "operator": "="
                                    }
                                ]
                            }
                        ]
                    },
                    "event": "rc:on_inventory_open"
                }
            },
            "on_inventory_close": {
                "minecraft:entity_sensor": {
                    "sensor_range": 3,
                    "relative_range": false,
                    "minimum_count": 1,
                    "event_filters": {
                        "any_of": [
                            {
                                "all_of": [
                                    {
                                        "test": "is_family",
                                        "subject": "other",
                                        "value": "player"
                                    },
                                    {
                                        "test": "has_container_open",
                                        "subject": "other",
                                        "operator": "!="
                                    }
                                ]
                            }
                        ]
                    },
                    "event": "rc:on_inventory_close"
                }
            }
        },
        "components": {
            "minecraft:inventory": {
                "container_type": "inventory",
                "inventory_size": 46,
                "private": false
            },
            "minecraft:collision_box": {
                "width": 1.1,
                "height": 0.9
            },
            "minecraft:breathable": {
                "breathes_water": true
            },
            "minecraft:physics": {
                "has_gravity": false,
                "has_collision": false
            },
            "minecraft:damage_sensor": {
                "triggers": {
                    "deals_damage": false,
                    "on_damage": {
                        "event": "rc:on_hit"
                    }
                }
            },
            "minecraft:pushable": {
                "is_pushable": false,
                "is_pushable_by_piston": false
            },
            "minecraft:entity_sensor": {
                "sensor_range": 3,
                "relative_range": false,
                "minimum_count": 1,
                "event_filters": {
                    "any_of": [
                        {
                            "all_of": [
                                {
                                    "test": "is_family",
                                    "subject": "other",
                                    "value": "player"
                                },
                                {
                                    "test": "has_container_open",
                                    "subject": "other",
                                    "operator": "="
                                }
                            ]
                        }
                    ]
                },
                "event": "rc:on_inventory_open"
            }
        },
        "events": {
            "minecraft:despawn": {
                "add": {
                    "component_groups": [
                        "minecraft:instant_despawn"
                    ]
                }
            },
            "rc:on_hit": {
                "add": {
                    "component_groups": [
                        "small_hitbox"
                    ]
                },
                "remove": {
                    "component_groups": [
                        "big_hitbox"
                    ]
                }
            },
            "rc:big_hitbox": {
                "add": {
                    "component_groups": [
                        "big_hitbox"
                    ]
                },
                "remove": {
                    "component_groups": [
                        "small_hitbox"
                    ]
                }
            },
            "rc:on_inventory_open": {
                "sequence": [
                    {
                        "queue_command": {
                            "target": "other",
                            "command": [
                                "tag @s add inventoryOpen",
                                "tag @s remove inventoryClose"
                            ]
                        }
                    },
                    {
                        "queue_command": {
                            "target": "self",
                            "command": [
                                "tag @s add inventoryOpen",
                                "tag @s remove inventoryClose"
                            ]
                        }
                    }
                ],
                "remove": {
                    "component_groups": [
                        "on_inventory_open"
                    ]
                },
                "add": {
                    "component_groups": [
                        "on_inventory_close"
                    ]
                }
            },
            "rc:on_inventory_close": {
                "sequence": [
                    {
                        "queue_command": {
                            "target": "other",
                            "command": [
                                "tag @s add inventoryClose",
                                "tag @s remove inventoryOpen"
                            ]
                        }
                    },
                    {
                        "queue_command": {
                            "target": "self",
                            "command": [
                                "tag @s add inventoryClose",
                                "tag @s remove inventoryOpen"
                            ]
                        }
                    }
                ],
                "remove": {
                    "component_groups": [
                        "on_inventory_close"
                    ]
                },
                "add": {
                    "component_groups": [
                        "on_inventory_open"
                    ]
                }
            }
        }
    }
}