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


const AncientOreNodesBlock = {
    onTick(event) {
        const block = event.block;
        const location = {
            x: block.location.x + 0.5,
            y: block.location.y,
            z: block.location.z + 0.5
        };
        block.dimension.spawnParticle("pm_mock:ancient_ore_shine_1", location);
        
    },

    onPlayerDestroy(event) {
        const block = event.block;
        const location = {
            x: block.location.x + 0.5,
            y: block.location.y,
            z: block.location.z + 0.5
        };
        // block.dimension.runCommand(`execute positioned ${location.x} ${location.y} ${location.z} run playsound mock.ancient_ore.min_ref @a ~~~`);
    }
}

// 注册自定义组件
world.beforeEvents.worldInitialize.subscribe(({ blockComponentRegistry }) => {
    blockComponentRegistry.registerCustomComponent(
        "pm_mock:ancient_ore_nodes", AncientOreNodesBlock
    );
});

