import { world } from '@minecraft/server';

world.beforeEvents.worldInitialize.subscribe(initEvent => {
  initEvent.blockComponentRegistry.registerCustomComponent('pa:petalo_de_lavanda', {
    onRandomTick: ({ block }) => {
      if (Math.random() < 0.1) {
        block.dimension.spawnParticle("pa:petalo_de_lavanda", {
          x: block.location.x + 0.0,
          y: block.location.y + 0.0,
          z: block.location.z + 0.0
        });
      }
    }
  });
});