MoreJSEvents.villagerTrades(event => {
    event.removeVanillaTrades('cartographer', 2);
    event.removeVanillaTrades('cartographer', 3);
    event.removeVanillaTrades('cartographer', 5);

    let gainEmerald = (profession, level, input, multi, max, exp) => {
        event.addTrade(profession, level, input, 'minecraft:emerald').priceMultiplier(multi).maxUses(max).villagerExperience(exp);
    };
    let giveEmerald = (profession, level, count, output, multi, max, exp) => {
        event.addTrade(profession, level, count + 'x minecraft:emerald', output).priceMultiplier(multi).maxUses(max).villagerExperience(exp);
    };

    gainEmerald('minecraft:cartographer', 2, '6x glass', 0.05, 16, 10);
    gainEmerald('minecraft:cartographer', 3, 'compass', 0.05, 12, 10);
    giveEmerald('minecraft:cartographer', 5, 8, 'globe_banner_pattern', 0.05, 12, 30);
});