Ore feature with random blocks

Started by PotassiumCat on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ore feature with random blocks

Is there a way of making an ore feature that generates multiple ores? For example, an ore that generates lead ore and silver ore.

Joined Feb 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I think so. If you want to…
Wed, 04/16/2025 - 23:54

I think so. If you want to make the ore block spawn random ores, I would recommend you call it a "geode" and texture it so it is noticeably distinct, but the ores are not visible, something like adding a crack to a stone block texture. You could make this with loot tables, but I haven't look up how those work. 

My method would be to set the block so it doesn't drop anything in the property tab. Then, in the triggers tab, make a procedure in the "when block is destroyed". In that procedure, put a random process selection. To do that, go to the math an select either the option that says Random [0,1] or Random number between 1 and 10.  I think they should work similarly, but I have only used the first. The second I THINK might be more useful if you want to add a lot of ores and be very specific with the probability of them spawning, as you can change the numbers and make the poll bigger.

But if you are only doing around 5 or less, I think the first option works fine. First, you have to think what probability you want it to drop, say coal with a 90%, iron with 50%, diamond with 10%. You set it this way:

IF [Random 0,1] > 0.9

DO Add (1) of (coal) to the event/target entity. 

Repeat this for all the ores. If this doesn't work, it might be because it doesn't recognize the event/target entity. Change that part for "get nearest entity..." selecting player as the type.  

 

If you want the number of ores to be variable, make a new number local variable in the right corner, then do another random process like before, but in the do part put something like "Set number (local variable)" to, say, 1, 2 and 3 depending on the probability. Remember to put the one with a higher probability first.  Then go back to the random process that determines the type of ore, and change the number of the ore given for "Get number (local variable)". 

 

It is also possible to make it so that it gives more than one type of ore each time, just set another number variable and another random process like the second one, but with the new variable. In the Do part, put a "Repeat () times" and put a "Get number local variable" in the blank space. Then put both previous processes inside the repeat block. 

 

There might need to do some adjustments, but I think that should work. I might even try to include in my own mod now. Hope that helps you.