export function traverseVein(dimension, block, blocksToBreak, depth, silkTouch) {
    let queue = [
        block.north(),
        block.south(),
        block.east(),
        block.west(),
        block.above(),
        block.below()
    ];
    let visited = new Set([block]);
    let currentDepth = 0;
    while (queue.length > 0 && currentDepth < depth) {
        let currentLocation = queue.shift();
        let currentBlock = dimension.getBlock(currentLocation);
        if (blocksToBreak.includes(currentBlock.typeId) &&
            !visited.has(currentLocation)) {
            if (silkTouch) {
                dimension.spawnItem(currentBlock.getItemStack(), currentBlock);
                currentBlock.setType('minecraft:air');
            }
            else
                dimension.runCommand(`setblock ${currentBlock.x} ${currentBlock.y} ${currentBlock.z} air destroy`);
            visited.add(currentLocation);
            currentDepth++;
            let neighbours = [
                currentBlock.north(),
                currentBlock.south(),
                currentBlock.east(),
                currentBlock.west(),
                currentBlock.above(),
                currentBlock.below()
            ];
            for (let neighbour of neighbours)
                queue.push(neighbour);
        }
    }
}
