Started by
RyleeStatler
on
Topic category: Advanced modding
I got silk touch and efficiency to work, but only 1 item drops (the 1 block actually mined by the player) when its mined by a mining hammer. This runs when a player breaks the block btw.
You don't need a procedure for this, you can just assign the block to a loot table, and then give that loot table two different loot pools depending on whether or not the player has silk touch. You can enable bonus rolls for fortune, if you like. Loot tables are generally the preferred method, as they can be modified by datapacks, have built in random functionality, and used more easily by other parts of the game. Just make your block, check the 'use loot table for drops' box in properties, and then make a loot table under the blocks category with the same registry name as your block.
That being said, if you're adding a lot of ores, (say, fifty different blocks), it may be easier to make a procedure for it as opposed to fifty different loot tables, which can't be easily duplicated. You could use the 'has enchantment' function on the main hand item of the target entity to get the same effect as a loot table.