export async function chests(chest, Vector) {
    if (chest.typeId == 'betterend:chest_test') {
        const { x, y, z } = chest.location;
        const block = chest.dimension.getBlock(new Vector(x, y, z));
        const blockState = block.permutation.getAllStates()
        const cardinalPosition = blockState["minecraft:cardinal_direction"];
        const chestAnim = blockState["betterend:open_anim"];
        if (chest.hasTag('container_open') && !chest.hasTag('on_script')) {
            chest.addTag('on_script');
            block.setPermutation(block.permutation.withState('betterend:open_anim', 1));
        }
        else if (!chest.hasTag('container_open') && chest.hasTag('on_script')) {
            chest.removeTag('on_script');
            block.setPermutation(block.permutation.withState('betterend:open_anim', 7));
        }
    }
}