• Hey! Register here to create your account, engage with the community, and talk about what is new!

ore veins in terrain generation

PenawQ

New member
Joined
Apr 3, 2022
Messages
10
Reaction score
0
i followed Elijah Kopperud's tutorial on how to make terrain generation but, i want to make it so ores spawn in veins. can someone help?
 

CoderElias

Well-known member
Overlord
Joined
Jun 15, 2022
Messages
79
Reaction score
10
Hi im hear to help out!
To start place a variable block that gets a random block loc in your mine/cave. After that place a if game event and select: if block equals, put the block in that the cave is made up of (for example stone) after that place a game event = spawn block. In that chest put your ore of choice and the variable of the random location. Then put down a variable block and select 'Change choordiantes' (or something like that) in that block place the random location variable and the ore of choice and a [num] 1. In the corner select which axis you want the second ore to spawn (x y z).

How it works:
A random location in the mine is chosen to place an ore. Then the code gets the coordinates of where the block was spawned and changes those coodinates by 1 block in your direction of choice. Then it places a block there.

If you want to spawn lots of ore veins in the mine just place that code in a [repeat multiple time] code block, and enter how many times you want it to repeat. To increase the length of the vein just place another variable that changes the coordinates again in another direction. You can also randomize which direction and how big of a vein it is but that is a bit more difficult.

I hope this helped! (If you have questions I am online in diamondfire alot, just /msg Eliaz12 [question] )
 
Top Bottom