import { system, world } from '@minecraft/server';
import { decrementStack, getOppositeDirection, DirectionType, cardinalSides, randomFunction } from './utils/helper';
import { directionToVector3 } from './utils/math';

world.beforeEvents.worldInitialize.subscribe(initEvent => { initEvent.itemComponentRegistry.registerCustomComponent('rk_berry:trigger', {
  onConsume: e => {
  e.source.removeEffect("minecraft:fatal_poison");
e.source.removeEffect("minecraft:blindness");
e.source.removeEffect("minecraft:bad_omen");
e.source.removeEffect("minecraft:hunger");
e.source.removeEffect("minecraft:nausea");
e.source.removeEffect("minecraft:poison");
e.source.removeEffect("minecraft:wither");
e.source.removeEffect("minecraft:weakness");
  
},

  
});

initEvent.itemComponentRegistry.registerCustomComponent('rk_book:trigger', {
  onUse: e => { e.source.runCommand("function open_rksettings"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('rk_settings:trigger', {
  onUse: e => { e.source.runCommand("function open_rksettings"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('rk_spray_can:trigger', {
  onUse: e => { e.source.runCommand("function rk_spray_can"); },
  
  
  
});
 });

