import { BlockVolume } from "@minecraft/server";

/**
 * 
 * @param { import("@minecraft/server").Block } block
 * @param { import("@minecraft/server").Dimension } dimension
 */
export const hoeGround = ( block, dimension ) => {
    const { x, y, z } = block.location;
    const blocks = new BlockVolume({ x: x+1, y: y+1, z: z+1 }, { x: x-1, y: y-1, z: z-1 }).getBlockLocationIterator();

    for (const b of blocks) {
        const block = dimension.getBlock(b);
        if(block.hasTag('minecraft:crop') || block.typeId == 'minecraft:tallgrass') {
        dimension.runCommandAsync( `setblock ${b.x} ${b.y} ${b.z} air [] destroy` );
    };}
};