I want to make that when I touch a block with an item, this block changes its state, can you help me with the code?
import {world, ItemStack, BlockPermutation, Block, system} from '@minecraft/server';
world.afterEvents.itemUseOn.subscribe((event) => {
console.log('itemuse found');
if (event.itemStack.typeId == "bd:knife" && event.block.typeId == "bd:bar"){
console.log('if found');
event.block.setPermutation(permutation);
}
})