cleanup rock loot tables

This commit is contained in:
Pyritie 2026-01-31 14:27:52 +00:00
parent e90cccbcc8
commit b1fddab3e9
36 changed files with 300 additions and 1321 deletions

View file

@ -2,85 +2,7 @@
"use strict";
const registerTFGOreLoots = (event) => {
// Rock to cobble, cobble to gravel
for (let [rockId, rock] of Object.entries(global.BIG_ROCK_TABLE)) {
if (rock.raw != null && rock.cobble != null) {
event.addBlockLootModifier(rock.raw.block)
.matchMainHand('#forge:tools/hammers')
.removeLoot(ItemFilter.ALWAYS_TRUE)
.addLoot(rock.cobble.block)
}
if (rock.hardened != null && rock.cobble != null) {
event.addBlockLootModifier(rock.hardened)
.matchMainHand('#forge:tools/hammers')
.removeLoot(ItemFilter.ALWAYS_TRUE)
.addLoot(rock.cobble.block)
}
if (rock.cobble != null && rock.gravel != null) {
event.addBlockLootModifier(rock.cobble.block)
.matchMainHand('#forge:tools/hammers')
.removeLoot(ItemFilter.ALWAYS_TRUE)
.addLoot(rock.gravel)
if (rock.cobble.mossy != null) {
event.addBlockLootModifier(rock.cobble.mossy.block)
.matchMainHand('#forge:tools/hammers')
.removeLoot(ItemFilter.ALWAYS_TRUE)
.addLoot(rock.gravel)
}
}
}
// Sand
global.SAND_COLORS.forEach(sandColor => {
let tag_array = Ingredient.of(`#tfc:${sandColor}_gravel`).itemIds.toArray().map(String);
tag_array.forEach(item => {
event.addBlockLootModifier(item)
.matchMainHand('#forge:tools/hammers')
.removeLoot(ItemFilter.ALWAYS_TRUE)
.addLoot(`tfc:sand/${sandColor}`)
})
})
global.HAMMERING.forEach(x => {
if (x.raw.startsWith('#')) {
let tag_array = Ingredient.of(x.raw).itemIds.toArray().map(String);
tag_array.forEach(item => {
event.addBlockLootModifier(item)
.matchMainHand('#forge:tools/hammers')
.removeLoot(ItemFilter.ALWAYS_TRUE)
.addLoot(x.hammered)
})
}
else {
event.addBlockLootModifier(x.raw)
.matchMainHand('#forge:tools/hammers')
.removeLoot(ItemFilter.ALWAYS_TRUE)
.addLoot(x.hammered)
}
})
// Other rocks
event.addBlockLootModifier('minecraft:gilded_blackstone')
.matchMainHand('#forge:tools/hammers')
.removeLoot(ItemFilter.ALWAYS_TRUE)
.addSequenceLoot(
LootEntry.of('tfg:rock/cobble_blackstone'),
LootEntry.of('tfc:powder/native_gold')
)
event.addBlockLootModifier('beneath:ore/blackstone_sylvite')
.removeLoot(ItemFilter.ALWAYS_TRUE)
.addWeightedLoot([
Item.of('gtceu:rich_raw_rock_salt').withChance(0.2),
Item.of('gtceu:raw_rock_salt').withChance(0.6),
Item.of('gtceu:poor_raw_rock_salt').withChance(0.2)
])
.addLoot(LootEntry.of('tfg:igneous_ultramafic_dust').when((c) => c.randomChance(0.2)))
.addLoot(LootEntry.of('gtceu:tiny_rock_salt_dust').when(c => c.randomChance(0.05)));
// Go through all materials
const $GreateMaterials = Java.loadClass("electrolyte.greate.registry.GreateMaterials")
@ -125,18 +47,19 @@ const registerTFGOreLoots = (event) => {
// break with pickaxe/mining hammer/drill/mining machine
event.addBlockLootModifier(`${namespace}:${stoneType}_${material.getName()}_ore`)
.removeLoot(ItemFilter.ALWAYS_TRUE)
.removeLoot(Ingredient.all)
.addWeightedLoot([
richRawOre.withChance(0.2),
normalRawOre.withChance(0.6),
poorRawOre.withChance(0.2)
])
.addLoot(LootEntry.of(stoneTypeDust).when((c) => c.randomChance(0.2)))
.addLoot(LootEntry.of(stoneTypeDust).when(c => c.randomChance(0.2)))
.addLoot(LootEntry.of(dustOre).when(c => c.randomChance(0.05)));
// break with hammer
event.addBlockLootModifier(`${namespace}:${stoneType}_${material.getName()}_ore`)
.matchMainHand('#forge:tools/hammers')
.removeLoot(Ingredient.all)
.addLoot(LootEntry.of(GTBlocks.COBBLE_BLOCKS.get(TagPrefix.get(stoneType)).get().getBlock().id));
})
}