I have a little problem with one of my blocks

Started by AzerKo on Sat, 11/19/2022 - 16:14

Topic category: Mod showcase and discussion

Last seen on 11:47, 26. Nov 2022
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I have a little problem with one of my blocks
Sat, 11/19/2022 - 16:14

first I am French excuse me if my English is approximate I’ve been fighting with this software for several hours

 

then my goal is to create an ore call random ores the purpose of this ore is that when it is broken it drops one ore among 5 

the problem is that when I break my ore it gives me a good random ore but it also drops the block which makes it possible to duplicate the question is how can I prevent my drop block when I break it if you can help me please you can download the procedure I did here 

https://www.mediafire.com/file/byoiajhoo1r0lw4/ede.ptpl/file

Last seen on 22:18, 30. Jan 2023
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
You don't need a procedure…
Mon, 11/21/2022 - 00:11

You don't need a procedure for this, instead, you can just use a loot table.

Go into the 'advanced properties' tab of your block, and check the 'use loot table' box. Then, create a custom loot table, and name it whatever you like.

In your loot table, first rename the registry name to 'blocks/your block name,' being sure to spell the name of the block correctly, with underscores. Then, make sure the loot table namespace is set to 'mod.'

In the loot table, you can add loot table pools and entries, which determine the odds of various drops, if you need Silk Touch to get a certain drop, and the rarities of each drop. Increasing the number of rolls for an entry will make that item more common, whereas decreasing the number of rolls will make that item more rare. You can also change the number of rolls, which will determine how many items the loot table selects.

If, for example, you want the block to drop copper ore, iron ore, gold ore, emeralds, and diamonds, with each one being rarer than the last, you would add a loot table pool, then add five pool entries, one for each ore. The number of rolls will determine how many it drops, (If you set it from 2 to 4, the block will drop 2, 3 or 4 randomly selected ores), and the frequency of each item will determine how likely it is to drop. (If you set copper to 50, iron to 20, gold to 15, emeralds to 10, and diamonds to 5, you'll get 50% copper ore, 15% emeralds, 5% diamonds, etc.)