Loot Table Modification (WIP)
onEvent('block.loot_tables', event => {
event.addSimpleBlock('minecraft:dirt', 'minecraft:red_sand')
})
onEvent('block.loot_tables', event => {
event.addSimpleBlock('minecraft:dirt') // To drop itself (fix broken blocks)
event.addSimpleBlock(/minecraft:.*_ore/, 'minecraft:red_sand') // To drop a different item
})
onEvent('block.loot_tables', event => {
event.build('minecraft:dirt', table => { // Build loot table manually
table.pool(pool => {
pool.rolls = 1 // Use one of these 3 - fixed, uniform, binominal
// pool.setUniformRolls(4, 6)
// pool.setBinomialRolls(4, 0.3)
pool.survivesExplosion()
pool.addItem('minecraft:dirt')
// pool.addCondition({json condition, see vanilla wiki})
// pool.addEntry({json entry, see vanilla wiki for non-items})
})
})
})
Example from FTB Stranded: (adds 1-3 leaves dropped from all Leaves blocks, 4-8 logs from all log and wood blocks and 4-8 stone from Stone, Cobblestone, Andesite, Diorite and Granite)
onEvent('block.loot_tables', event => {
event.addBlock(/minecraft:.*_leaves/, table => {
table.pool(pool => {
pool.setUniformRolls(1, 3)
pool.survivesExplosion()
pool.addEntry({type: 'minecraft:item', name: 'ftbstranded:leaf'})
})
})
event.addBlock(/minecraft:.*_(log|wood)/, table => {
table.pool(pool => {
pool.setUniformRolls(4, 8)
pool.survivesExplosion()
pool.addEntry({type: 'minecraft:item', name: 'ftbstranded:wood'})
})
})
event.addBlock([
'minecraft:stone',
'minecraft:cobblestone',
'minecraft:andesite',
'minecraft:diorite',
'minecraft:granite'
], table => {
table.pool(pool => {
pool.setUniformRolls(4, 8)
pool.survivesExplosion()
pool.addEntry({type: 'minecraft:item', name: 'ftbstranded:stone'})
})
})
})