import {
  world
} from "@minecraft/server";
world.beforeEvents.worldInitialize.subscribe(initEvent => {

initEvent.blockComponentRegistry.registerCustomComponent('we:paper_collapse', {
    onStepOn(e) {
      const {
        block
      } = e;
      const {
        x, y, z
      } = block.center();

      if(!block.below().isAir) return;
     

      e.dimension.runCommandAsync(`setblock ${x} ${y} ${z} air destroy`);
      e.dimension.playSound('item.book.page_turn', block.center());
    }
  });
});