Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was watching a tutorial from last year that was discussing how to create blocks that would be generated with the world. I have lost the link to the video, but the basic issue I'm having here is simple. In the video the presenter showed the file in which there were multiple lines of code such as this for each of the available types of block (dirt, sand, various ores, etc):

for(int i=0; i < 30; i++){
        int randPosX = chunkX + random.nextInt(16);
        int randPosY = random.nextInt(128);
        int randPosZ = chunkZ = random.nextInt(16);
        (new WorldGenMinable(oreUranium.blockID, 16)).generate(world, random, randPosX, randPosY, randPosZ);

Unfortunately, the code appears to be updated and I don't know where it is. If it was I'd be able to answer a rather basic question. Exactly what is the approximate ratio of each block being generated in relation to each other? Or better yet, where can I find the code that determines this?

share|improve this question

closed as off topic by Roy T., Byte56, doppelgreener, Josh Petrie, Tetrad May 5 '12 at 22:29

Questions on Game Development Stack Exchange are expected to relate to game development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

This isnt related to game development, better ask this question in – Roy T. May 4 '12 at 18:09
@RoyT. I think it's related to game development as I am looking for information about the specific code which determines the rarity of the blocks. – BrotherJack May 4 '12 at 18:39
@BrotherJack Which has nothing to do with game development and everything to do with learning about a game. – doppelgreener May 5 '12 at 1:19
if the OP is implementing this system then it is on-topic, but maybe the OP should disjoint the question from the game, and instead talk about procedural seeding of items based on depth. – gardian06 May 5 '12 at 2:02

The Minecraft Wiki article on Ore includes a chart of Ore density by Y-height. Looking at the noise in the graph I'd say the source is from empirical measurement rather than reverse engineering the code. This only covers ore; it doesn't cover relative density of gravel vs rock, etc.

If you want to look at the actual Minecraft code, you may find the Minecraft Coder Pack useful. It contains tools to decompile and deobfuscate the live Minecraft code. Their javadoc includes a ChunkProviderGenerate class still, so you could start with the code they generate for that class. MCP also includes tools to help you build your mod in a way that's compatible with current Minecraft releases. I have no idea what the license issues are around decompiling Minecraft code in this way.

share|improve this answer
Interesting. It would be better to have the code, but this still has some use. Thanks. – BrotherJack May 4 '12 at 18:06
actually noise is sometimes used in procedural seeding, and would make sense for "random" distribution. – gardian06 May 5 '12 at 16:55
I updated my answer to include a link to MCP, which could get you access to the code you are looking for. – Nelson May 5 '12 at 19:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.