Jump to content

Best way to generate massive amounts of ore?


Recommended Posts

Hey everyone, I'm working on a mod and I'm on the world generation part. The issue I'm having is the way the mod will work is that I need to replace a majority of generic stone with some of my custom stone. The problem is that the only way i know how to generate it is like normal ores, but in such huge amounts that most of it replaces the stone. This is making world gen take a very long time so I'm wondering of there's a simpler way to do this because I can't find anything anywhere else. Thanks!

Link to comment
Share on other sites

First off, the link elantzb provided is very helpful for getting the basic world gen working, so this is kind of assuming you understand that.


How I'm going about world gen is through these two files:



and adding

GameRegistry.registerWorldGenerator(new WorldgeneratorCarbonization());

to your main mod file.


WorldgeneratorCarbonization is what Minecraft uses to generate things after Forge tells it that it exists with the register function, with CarbonizationGenMinable being a modified copy of WorldGenMinable.  You don't need your own gen class, I have one because I had to change the gen rules a little bit for my fuels.


The important part of the code for your question is

for(int i = 0; i<diff;i++)
int Xcoord = blockX + random.nextInt(16);
int Ycoord = yMin + random.nextInt(yDiff);
int Zcoord = blockZ + random.nextInt(16);

(new CarbonizationGenMinable(carbonization.instance.fuelBlock.blockID, meta, genSize, diff)).generateStone(world, random, Xcoord, Ycoord, Zcoord);

The WorldGenMinable version of the last line is parametrized exactly the same as mine. 


To increase the amount of the block that spawns in one vein, just increase genSize.  To increase the number of veins in a chunk, diff is what you increase.  Keep in mind that how the gen works is nested for loops, so you want to avoid going too crazy with those values or there will be lag everytime a new chunk is generated.  From my own tweaking, using a genSize of 50 and a diff of 5 or 6 should give you a large amount of generation, although I would probably favour smaller veins with a higher diff value.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.