How do I make my ore act like other ores

Started by RyleeStatler on

Topic category: Advanced modding

Last seen on 19:23, 7. Jan 2024
Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make my ore act like other ores

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. https://ibb.co/SPJhBMT

Last seen on 14:57, 22. Jun 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You don't need a procedure…
Mon, 12/11/2023 - 12:53

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.