Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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 ChunkProviderGeneate.java 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
3  
This isnt related to game development, better ask this question in gaming.stackexchange.com –  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. –  Jonathan Hobbs May 5 '12 at 1:19
2  
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
add comment

closed as off topic by Roy T., Byte56, Jonathan Hobbs, 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.

1 Answer

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
add comment

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