ServerEvents.recipes(event => {
  const flower = 'born_in_chaos_v1:transformative_flower';

  const goatHornVariants = [
    '{instrument:"minecraft:ponder_goat_horn"}',
    '{instrument:"minecraft:sing_goat_horn"}',
    '{instrument:"minecraft:seek_goat_horn"}',
    '{instrument:"minecraft:feel_goat_horn"}',
    '{instrument:"minecraft:admire_goat_horn"}',
    '{instrument:"minecraft:call_goat_horn"}',
    '{instrument:"minecraft:yearn_goat_horn"}',
    '{instrument:"minecraft:dream_goat_horn"}'
  ];

  const transformations = [
    ['blazingbamboo:blazing_bamboo_item', 'minecraft:bamboo'],
    ['mynethersdelight:powder_cannon', 'minecraft:bamboo'],
    ['minecraft:warped_stem', 'minecraft:oak_log'],
    ['minecraft:crimson_stem', 'minecraft:oak_log'],
    ['minecraft:blackstone', 'minecraft:stone'],
    ['minecraft:crimson_nylium', 'minecraft:grass_block'],
    ['minecraft:warped_nylium', 'minecraft:grass_block'],
    ['mynethersdelight:hoglin_loin', 'minecraft:porkchop'],
    ['minecraft:magma_cream', 'minecraft:slime_ball'],
    ['minecraft:crimson_fungus', 'minecraft:red_mushroom'],
    ['minecraft:warped_fungus', 'minecraft:brown_mushroom'],
    ['undead_unleashed:demon_horn', 'minecraft:goat_horn'],
    ['alexsmobs:tarantula_hawk_wing_fragment', 'minecraft:feather'],
    ['minecraft:quartz', 'minecraft:amethyst_shard'],
    ['nethers_exoticism:pitaya', 'minecraft:melon_slice'],
    ['nethers_exoticism:ramboutan', 'minecraft:apple'],
    ['nethers_exoticism:jaboticaba', 'minecraft:glow_berries'],
    ['nethers_exoticism:kiwano', 'minecraft:potato'],
    ['netherexp:sorrowsquash', 'minecraft:pumpkin'],
    ['luminous_nether:pale_melon', 'minecraft:melon'],
    ['netherexp:ancient_wax', 'minecraft:honeycomb'],
    ['mynethersdelight:strider_rock', 'minecraft:egg'],
    ['blazegear:brimsteel_ingot', 'scbrass:brass_ingot'],
    ['alexsmobs:soul_heart', 'minecraft:heart_of_the_sea'],
    ['scguns:gold_flare', 'scguns:ocean_flare'],
    ['brutalmobs:unyielding_will', 'minecraft:echo_shard'],  
    ['minecraft:diamond', 'minecraft:prismarine_shard']
  ];

  transformations.forEach(([input, output]) => {
    if (input === 'undead_unleashed:demon_horn' && output === 'minecraft:goat_horn') {
      event.shapeless('minecraft:goat_horn', [flower, input])
        .damageIngredient(flower)
        .modifyResult((grid, result) => {
          let randomNBT = goatHornVariants[Math.floor(Math.random() * goatHornVariants.length)];
          return Item.of('minecraft:goat_horn', randomNBT);
        });
    } else {
      event.shapeless(output, [flower, input])
        .damageIngredient(flower);
    }
  });
});