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

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