// kubejs/data/modpack/kubejs/example.js
// This is just an example script to show off multiple types of recipes and removal methods
// Supports /reload

// Enable recipe logging, off by default
settings.logAddedRecipes = true
settings.logRemovedRecipes = true

// Listen to server recipe event
events.listen('recipes', event => {
  // Remove broken recipes from vanilla and other mods
  // This is on by default, so you don't need this line
  //event.removeBrokenRecipes = true

  event.remove({}) // Deletes all recipes
  event.remove({id: 'minecraft:glowstone'}) // Removes data/minecraft/recipes/glowstone.json
  event.remove({input: '#forge:dusts/redstone'}) // Removes all recipes where input is Redstone Dust tag
  event.remove({output: '#minecraft:wool'}) // Removes all recipes where output is Wool tag
  event.remove({mod: 'quartzchests'}) // Remove all recipes from Quartz Chests mod
  event.remove({type: 'minecraft:campfire_cooking'}) // Remove all campfire cooking recipes

  // Add shaped recipe for 3 Stone from 8 Sponge in chest shape
  // (Shortcut for
  event.shaped(item.of('minecraft:stone', 3), [
    'S S',
  ], {
    S: 'minecraft:sponge'

  // Add shapeless recipe for 4 Cobblestone from 1 Stone and 1 Glowstone
  // (Shortcut for
  event.shapeless(item.of('minecraft:cobblestone', 4), ['minecraft:stone', '#forge:dusts/glowstone'])

  // Add Stonecutter recipe for Golden Apple to 4 Apples'minecraft:apple', 4), 'minecraft:golden_apple')
  // Add Stonecutter recipe for Golden Apple to 2 Carrots'minecraft:carrot', 2), 'minecraft:golden_apple')

  // Add Furnace recipe for Golden Apple to 3 Carrots
  // (Shortcut for
  event.smelting(item.of('minecraft:carrot', 2), 'minecraft:golden_apple')

  // Add similar recipes for Blast Furnace, Smoker and Campfire'minecraft:apple', 3), 'minecraft:golden_apple')'minecraft:apple', 5), 'minecraft:golden_apple')'minecraft:apple', 'minecraft:golden_apple')
  // You can also add .xp(1.0) at end of any smelting recipe to change given XP

  // Create a variable for function and use that to make things shorter
  var s =
  s('minecraft:blue_dye', '#forge:gems/lapis')
  s('minecraft:black_dye', 'minecraft:ink_sac')
  s('minecraft:white_dye', 'minecraft:bone_meal')

  // Add Create's crushing recipe, Apple to Apple + 50% Carrot['minecraft:apple', item.of('minecraft:carrot').chance(0.5)], 'minecraft:apple', 100)

  // If you use {} as only argument, it will be using vanilla Json syntax
  // You can add recipe to any recipe handler that uses vanilla recipe system or isn't supported by KubeJS{
    ingredients: [
      { item: 'minecraft:carrot' }
    results: [
      { item: 'minecraft:apple', count: 1, chance: 0.5 },
      { item: 'minecraft:carrot', count: 1 }
    processingTime: 100
  // In all shapeless crafting recipes, replace any planks with Gold Nugget in input items
  event.replaceInput({type: 'minecraft:crafting_shapeless'}, '#minecraft:planks', 'minecraft:gold_nugget')
  // In all recipes, replace Stick with Oak Sapling in output items 
  event.replaceOutput({}, 'minecraft:stick', 'minecraft:oak_sapling')