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

system.beforeEvents.startup.subscribe(initEvent => {
    initEvent.itemComponentRegistry.registerCustomComponent('rustic:wildberry_juice', {
      onConsume: e =>  {
        const source = e.source

        let random = Math.random()

        if (random < 0.05)source.addEffect('poison', 100);
        else if (random < 0.4)source.addEffect('regeneration', 200);
        
      }
    });
});