import { Block, Dimension, world } from "@minecraft/server";

/**
 * 
 * @param {Block[]} blocks 
 * @param {Dimension} dimension 
 */
export function sortBlocksAndBreak(blocks, dimension) {
    blocks.filter(block => block.hasTag("dirt") || block.hasTag("sand") || block.hasTag("gravel") || block.hasTag("grass") || block.hasTag("snow") || block.permutation.matches("clay") || block.permutation.matches("concretePowder") || block.permutation.matches("mycelium") || block.permutation.matches("soul_sand") || block.permutation.matches("soul_soil") || block.typeId == "minecraft:snow").forEach(block => {
        dimension.runCommandAsync(`fill ${block.location.x} ${block.location.y} ${block.location.z} ${block.location.x} ${block.location.y} ${block.location.z} air destroy`)
    })
}