I'm trying to make a script where, when you break a grass block with a hoe, it sets the grass block to a coarse dirt, and if you do it again, it'll become a farmland.
it seems like most of the code is running fine, besides the block.set event which is the most important!!
BlockEvents.broken('grass_block', e => {
const hoe = ['iron_hoe', 'diamond_hoe', 'netherite_hoe'];
const { player, block, item, hand } = e;
const { x, y, z } = block;
if (hand != 'OFF_HAND' || item == hoe) {
player.server.runCommandSilent(`playsound minecraft:block.rooted_dirt.step player @p ${x} ${y} ${z}`);
block.set("coarse_dirt");
player.potionEffects.add("mining_fatigue", 3, 0, false, false)
player.addExhaustion(2)
} else return;
})```