Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

This may sound like a really basic question, but I can't seem to find anything with google searches, multiple different keywords going several pages deeper then I care to admit.

 

In short, how do I change the games base terrain generation? I would like to change the ore spawn frequency and vein size. My first issue is I can not seem to find how to interact with that code via forge. I feel what I want to do is straight forward and shouldn't be too hard once I know how to interact with the ore generation code; or am I just being extremely naive?

 

Thanks!

3 hours ago, splatterdodge said:

...how to interact with the ore generation

Did you Google minecraft forge ore generation?

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

One question: Is this for your own ores, or for vanilla/other modded ores?

 

If the latter:

If you want to influence other's ores, look at the GenerateMinable event. It passes the WorldGenerator, which you can cast to WorldGenMinable, and get the state, number and predicate from.

 

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

  • Author
5 hours ago, jeffryfisher said:

I might just be stupid 

 

3 hours ago, Matryoshika said:

If you want to influence other's ores, look at the GenerateMinable event. It passes the WorldGenerator, which you can cast to WorldGenMinable, and get the state, number and predicate from.

I am trying to hastily ask this question before class, but from a few quick google searches these functions will allow me to change vein size, if they appear in a chunk, and how many veins appear in a chunk, correct?

  • Author

OK, so I managed to do everything I wanted to do, for the most part. I am generating Iron in large single veins. Now I would like to be able to tell the terrain generator to skip certain chunks and to not generate a resource type in every chunk, maybe more like one in every sixty-four chunks

public class oreWorldGen implements IWorldGenerator {

	private WorldGenerator gen_iron;
	@Override
	public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkprovider){
		switch (world.provider.getDimension()){
		case 0: //Overworld
			this.runGenerator(this.gen_iron, world, random, chunkX, chunkZ, 1, 10, 50);
			break;
		case -1: //nether
			
			break;
		case 1: //end
			
			break;
		}
	}
	
	public oreWorldGen(){
		this.gen_iron = new WorldGenMinable(Blocks.IRON_ORE.getDefaultState(), 64);
	}
	
	private void runGenerator(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight){
		if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight)
			throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");
		
		int heightdiff = maxHeight - minHeight +1;
		for (int i=0; i<chancesToSpawn; i++){
			int x =chunk_X * 16 +rand.nextInt(16);
			int y = minHeight + rand.nextInt(heightdiff);
			int z = chunk_Z * 16 + rand.nextInt(16);
			generator.generate(world, rand, new BlockPos(x, y, z));
		}
	}

}

 This is the code I have so far. Thoughts? 

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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.