// priority: 12
//fun fact! serverevents.recipes is called in reverse order to the priority, this is because lat overlooked this possibility
// Visit the wiki for more info - https://kubejs.com/


//recipes to remove
var RemoveRecipes = 
[
    "create:crafting/materials/andesite_alloy",
    "create:crafting/materials/andesite_alloy_from_zinc",
    "create:mixing/andesite_alloy_from_zinc",
    "create:mixing/andesite_alloy",
    "create:mixing/brass_ingot",
    "create:crafting/materials/electron_tube",
    "botania:elven_trade/elementium_block",
    "botania:elven_trade/elementium",
    "ars_nouveau:imbuement_lapis",
    "ars_nouveau:imbuement_amethyst",

    "ars_nouveau:imbuement_amethyst_block"

];

//custom datapack formatted recipes
var CustomRecipes = 
[

    {
        "type": "ars_nouveau:imbuement",
        "count": 1,
        "input": {
            "item": "botania:mana_diamond"
        },
        "output": "ars_nouveau:source_gem",
        "pedestalItems": [],
        "source": 500
    },


    {
    
        type: "botania:mana_infusion",
        mana: 4000,

        catalyst: {
            type: "block",
            block: "botania:conjuration_catalyst"
        },

        input: 
        {
            tag: "create:sandpaper"
        },
        
        output: 
        {
            item: "create:sand_paper",
            count: 2
        }
        
    },

    {
    
        type: "botania:mana_infusion",
        mana: 4000,

        catalyst: {
            type: "block",
            block: "botania:alchemy_catalyst"
        },

        input: 
        {
            item: "minecraft:kelp"
        },
        
        output: 
        {
            item: "create:belt_connector",
            count: 1
        }
        
    },

    {
    
        type: "botania:mana_infusion",
        mana: 1000,

        input: 
        {
            item: "minecraft:andesite"
        },
        
        output: 
        {
            item: "create:andesite_alloy",
            count: 1
        }
        
    },

    {
    
        type: "botania:mana_infusion",
        mana: 50000,

        catalyst: {
            type: "block",
            block: "bloodmagic:sacrificerune2"
        },

        input: 
        {
            item: "bloodmagic:infusedslate"
        },
        
        output: 
        {
            item: "bloodmagic:demonslate",
            count: 1
        }
        
    },

    {
    
        type: "botania:mana_infusion",
        mana: 100000,

        catalyst: {
            type: "block",
            block: "bloodmagic:selfsacrificerune2"
        },

        input: 
        {
            item: "bloodmagic:demonslate"
        },
        
        output: 
        {
            item: "bloodmagic:etherealslate",
            count: 1
        }
        
    },

    {
        type: "botania:elven_trade",
        ingredients: [
            {
                tag: "botania:manasteel_ingots"
            }
        ],
        output: [
            {
                item: "botania:elementium_ingot"
            }
        ]

    },

    {
        type: "botania:elven_trade",
        ingredients: [
            {
                item: "botania:manasteel_block"
            }
        ],
        output: [
            {
                item: "botania:elementium_block"
            }
        ]

    },

    {
        type: "create:mixing",
        ingredients: [
            {
                fluid: "bloodmagic:life_essence_fluid",
                amount: 250
            },
            {
                tag: "forge:stone"
            }
        ],
        results: [
            {
                count: 1,
                item: "bloodmagic:blankslate"
            }
        ]
    },

    {
        type: "create:mixing",
        heatRequirement: "heated",
        ingredients: [
            {
                fluid: "bloodmagic:life_essence_fluid",
                amount: 500
            },
            {
                item: "bloodmagic:blankslate"
            }
        ],
        results: [
            {
                count: 1,
                item: "bloodmagic:reinforcedslate"
            }
        ]
    },

    {
        type: "create:mixing",
        heatRequirement: "heated",
        ingredients: [
            {
                fluid: "bloodmagic:life_essence_fluid",
                amount: 1000
            },
            {
                item: "bloodmagic:reinforcedslate"
            }
        ],
        results: [
            {
                count: 1,
                item: "bloodmagic:infusedslate"
            }
        ]
    },

    {
        type: "create:mixing",
        heatRequirement: "heated",
        ingredients: [
            {
                item: "botania:elementium_ingot"
            },
            {
                item: "create:zinc_ingot"
            }
        ],
        results: [
            {
                count: 3,
                item: "create:brass_ingot"
            }
        ]
    },

    {
        type: "create:mixing",
        heatRequirement: "heated",
        ingredients: [
            {
                item: "botania:terrasteel_ingot"
            },
            {
                count: 4,
                item: "create:zinc_ingot"
            }
        ],
        results: [
            {
                count: 12,
                item: "create:brass_ingot"
            }
        ]
    },

    {
        type: "create:mixing",
        heatRequirement: "superheated",
        ingredients: [
            {
                item: "kubejs:token_gaia"
            },
            {
                count: 8,
                item: "create:zinc_ingot"
            }
        ],
        results: [
            {
                count: 64,
                item: "create:brass_ingot"
            }
        ]
    }
];



console.info('Hello, World! (Loaded server scripts)');

ServerEvents.recipes(e => {
  console.log("kubejs recipes loading");
  //console.error(JSON.stringify(Object.keys(e)));
  
  RemoveRecipes.forEach((ele,idx,arr) => {
    e.remove({id: ele});
  });

  CustomRecipes.forEach((ele,idx,arr) => {
    e.custom(ele)
  });



});