So i what want to do is... apply fortune or silktouch to ore drops if the player has a certain effect. the effect part o manage to do one time but i deleted that code.
The problem is that i don't now how to just apply the fortune. i tried this code
LootJS.modifiers((event) => {
//First loot entry with a condition. Will drop if the player has fortune.
const stickWhenFortune = LootEntry.of("minecraft:stick")
.applyOreBonus("minecraft:fortune")
.when((c) => c.matchMainHand(ItemFilter.hasEnchantment("minecraft:fortune")));
//Second loot entry with a condition. Will drop if the player has silk touch and the first entry doesn't match.
const appleWhenSilkTouch = LootEntry.of("minecraft:apple").when((c) =>
c.matchMainHand(ItemFilter.hasEnchantment("minecraft:silk_touch"))
);
//No conditions just an item, so this will always drop if the other two don't.
const ironIngot = "minecraft:iron_ingot";
event
.addBlockLootModifier("minecraft:redstone_ore")
.removeLoot(Ingredient.all)
.addAlternativesLoot(stickWhenFortune, appleWhenSilkTouch, ironIngot);
});```
But the amount of stick dropped aren't consistent with a vanilla redstone ore + fortune.
I thought about removing the ingredients and re-add them with my fortune condition, but... i know i can get the block loottable using
```js
Block.getBlock().getLootTable()```
But the loottable is a resourceLocation and i don't know how to use this in LootEntry.
So how to apply fortune? can i copy the block drops, remove than re-add them?