// priority: 0

// Visit the wiki for more info - https://kubejs.com/

// onEvent('recipes', event => {
    
MoreJSEvents.villagerTrades((event) => {

    let trade = (profession, professionLevel, tradeItems, purchasedItem) => {
        event.addTrade(profession, professionLevel, tradeItems, purchasedItem);
    }

    let herbs = ["calendula", "rosemary", "thyme", "tarragon", "chamomile", "chives", "verbena", "sorrel", "marjoram", "chervil", "fennsel", "ceillis", "punuel", "essitte"]
    herbs.forEach(i => {
        // herbalTrade([TradeItem.of('4x minecraft:emerald')], `hibernalherbs:${i}`)
        event.addCustomTrade('farmer', 2, (offer, entity, random) => {
            offer.setFirstInput('4x minecraft:emerald');
            // offer.setSecondInput(item);
            offer.setOutput(`hibernalherbs:${i}`);
            offer.setMaxUses(8);
            offer.setVillagerExperience(2);
            offer.setPriceMultiplier(0.25);
        });

        event.addCustomTrade('cleric', 2, (offer, entity, random) => {
            offer.setFirstInput(`2x hibernalherbs:pounded_${i}`);
            offer.setOutput('1x minecraft:emerald');
            offer.setMaxUses(16);
            offer.setVillagerExperience(4);
            offer.setPriceMultiplier(0.15);
        })
    })
    let advancedHerbs = ["fennkystral", "thyocielle", "sage"]
    advancedHerbs.forEach(i => {
        event.addCustomTrade('farmer', 3, (offer, entity, random) => {
            offer.setFirstInput('8x minecraft:emerald');
            offer.setOutput(`hibernalherbs:${i}`);
            offer.setMaxUses(4);
            offer.setVillagerExperience(4);
            offer.setPriceMultiplier(0.45);
        })
    })
});