
// Custom Loot Tables
onEvent('block.loot_tables', event => {
	event.addBlock('minecraft:cobblestone', table => {
		table.addPool(pool => {
			pool.addItem('minecraft:coal', 1).randomChance(0.3)
			pool.addItem('minecraft:cobblestone', 1)
		})
	})

	// stone loot table
	// default, 0.02, 2%
	const stoneLootChance = 0.02
	const stoneLootTable = [
		"minecraft:redstone",
		"minecraft:raw_iron",
		"minecraft:raw_gold",
		"minecraft:lapis_lazuli",
	]
	event.addBlock('minecraft:stone', table => {
		table.addPool(pool => {
			pool.addItem('minecraft:cobblestone', 1)
			
			for (i = 0; i < stoneLootTable.length; i++) {
				pool.addItem(stoneLootTable[i],1).randomChance(stoneLootChance)
			}
		})
	})

	const deepSlateLootChance = 0.02
	const deepSlateLootTable = [
		"minecraft:tuff",
	]
	event.addBlock('minecraft:deepslate', table => {
		table.addPool(pool => {
			pool.addItem('minecraft:cobbled_deepslate', 1)
			
			for (i = 0; i < deepSlateLootTable.length; i++) {
				pool.addItem(deepSlateLootTable[i],1).randomChance(deepSlateLootChance)
			}
		})
	})
})