onEvent('generic.loot_tables', (event) => {
    const pools = [
        {
            rolls: { min: 2, max: 3 },
            entries: [
                {
                    item: 'farmersdelight:noodle_soup',
                    weight: 50,
                    count: [4, 16]
                },
                {
                    item: 'alexsmobs:kangaroo_burger',
                    weight: 50,
                    count: [4, 8]
                },
                {
                    item: 'farmersdelight:apple_cider',
                    weight: 50,
                    count: [2, 8]
                },
                {
                    item: 'minecraft:carrot',
                    weight: 30,
                    count: [4, 16]
                },
                {
                    item: 'farmersdelight:shepherds_pie',
                    weight: 50,
                    count:[2, 8]
                },
                {
                    item: 'farmersdelight:fried_rice',
                    weight: 20,
                    count: [2, 8]
                },
                {
                    item: 'farmersdelight:mixed_salad',
                    weight: 20,
                    count: [2, 8]
                },
                {
                    item: 'minecraft:potato',
                    weight: 20,
                    count: [4, 16]
                },
                {
                    item: 'farmersdelight:steak_and_potatoes',
                    weight: 15,
                    count: [4, 8]
                },
                {
                    item: 'create:builders_tea',
                    weight: 10,
                    count: [4, 16]
                },
                {
                    item: 'farmersdelight:roasted_mutton_chops',
                    weight: 50,
                    count: [4, 16]
                },
                {
                    item: 'alexsmobs:shrimp_fried_rice',
                    weight: 50,
                    count: [4, 16]
                },
                {
                    item: 'create:honeyed_apple',
                    weight: 50,
                    count: [4, 16]
                },
                {
                    item: 'quark:golden_frog_leg',
                    weight: 50,
                    count: [4, 16]
                },
                {
                    item: 'create:sweet_roll',
                    weight: 50,
                    count: [4, 16]
                }
            ]
        }
    ];
    const mansions = [
        'birch',
        'desert',
        'jungle',
        'oak',
        'savanna',
        'snowy',
        'taiga'
    ];
    mansions.forEach((mansion) => {
        event.modify('repurposed_structures:chests/mansion/'+mansion+'_storage', (table) => {
            pools.forEach((pool) => {
                table.addPool((newPool) => {
                    newPool.setUniformRolls(pool.rolls.min, pool.rolls.max);
                    pool.entries.forEach((entry) => {
                        let count = entry.count ? entry.count : 1,
                            weight = entry.weight ? entry.weight : 1;

                        newPool.addItem(entry.item, weight, count);
                    });
                });
            });
        });
    });
});
