events.listen('item.right_click', event => {
    
  if (event.item.id == 'kubejs:food_bag') {

	event.player.playSound('blue_skies:item.bag.open');

	event.server.runCommandSilent(`execute as ${event.player.name} in ${event.player.world.dimension} run loot spawn ${event.player.x} ${event.player.y} ${event.player.z} loot kubejs:blocks/lootblock_food`);
      
    if (!event.player.isCreativeMode()) {
    
    event.item.setCount(event.item.getCount() - 1)
    }
    }
});