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

system.beforeEvents.startup.subscribe(initEvent => {
    initEvent.itemComponentRegistry.registerCustomComponent('rustic:speed_on_cosume', {
      onConsume: e =>  {
        const source = e.source
        source.addEffect('speed', 100);

        if ( Math.random() * 100 > 33 ) return;

        source.applyDamage(1,{ cause: "fire" })
      }
    });
});