//TIER2 PARTS
onEvent('block.loot_tables', event => {

event.build('kubejs:lootblock_tinkers', table => {
	
var materialTypes =
	[
	'lead',
	'silver',
	'scorched_stone',
	'slimesteel',
	'steel',
	'tinkers_bronze',
	'nahuatl',
	'pig_iron',
	'rose_gold',
	'wood',
	'stone',
	'flint',
	'bone',
	'necrotic_bone',
	'seared_stone',
	'slimewood',
	'constantan',
	'electrum',
	'cobalt',
	'queens_slime',
	'hepatizon',
	'manyullyn'
	]	
table.pool(pool => {
    pool.rolls = 2
	materialTypes.forEach(mat => {
	const tcnbt = `{Material:"tconstruct:${mat}"}`
	Ingredient.of(['#tconstruct:parts']).stacks.forEach(parts => {
            pool.addEntry({
          "type": "minecraft:item",
          "name": parts.id,
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 0,
                "max": 1
              }
            },
            {
              "function": "minecraft:set_nbt",
              "tag": tcnbt
            }
			]
			})
		})
	})
	})
})

})