Jump to content

Recommended Posts

Posted (edited)

1.11.2

 

I lack in understanding how minecraft generates the world block information. I had been assuming that everything is generated on the fly when the system asks for a chunk of blocks and then minecraft data only stores things that the players have changed. So it 'overlays' the changes onto the procedural generation.--This may not be correct.

My issue is that I created some ores and set them to generate (using one of many examples) and they all did (or so I thought).  One ore was meant to be very rare, much rarer than diamonds. I am using this modding to teach my kids java, so for fun, I sent them looking for the rare or ('mithril'). They couldn't find it. So I created a custom command "/find [object] [radius]" that searches a given radius of blocks for a specific object(block).  Anyway, my rare ore wasn't generating at all. Testing it out, the minimum parameters I found actually generated any ore were (size=3, chances=1),so calling WorldGenMinable(ore, [size<3]) never produced any ore, ever.

 

genSurface(...){
	....
	generateOre(ModBlocks.oreMithril.getDefaultState(),world,random,chunkX*16,chunkZ*16,2,30,3,1);//min to spawn any
}

private void generateOre(IBlockState ore, World world, Random random, int x, int z, int minY, int maxY, int size, int chances) {
		int deltaY = maxY - minY;
	
		for (int i = 0; i < chances; i++) {
			BlockPos pos = new BlockPos(x + random.nextInt(16), minY + random.nextInt(deltaY), z + random.nextInt(16));
	
			WorldGenMinable generator = new WorldGenMinable(ore, size);
			generator.generate(world, random, pos);
		}
	}

I'm sure there is some reason in the WorldGenMinable code why...but, while doing all this, my kids were building their little world. After fixing the mithril ore, I tested in newly created world and it worked, generating at a rate of about 1/10 of diamond ore. Updating the mod in the game my kids were enjoying, and reloading the game. I once again checked with my /find command and the mithril was still not being generated. This I'm not sure why. my find searches over 8,000,000 blocks. I did not think that the blocks were created and stored at game creation, only a table or registered blocks and a procedural generation was done...if so, the new updated mod should have created some mithril.

 

Obviously, I don't know what is going on. If anyone can state how the minecraft world gen, data, overlay works, I'd appreciate it.  Also, if there is anything I can do to update a previous world with new worldgen (no new ores, just changing the chances of creating), I'd more than appreciate it (kids too).

 

Thanks,

Tony

Edited by aw_wolfe
solved
Posted
35 minutes ago, aw_wolfe said:

So it 'overlays' the changes onto the procedural generation.--This may not be correct.

It is not.

When a chunk is generated fresh, it gets saved, regardless of if anything changed or not.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)
4 hours ago, aw_wolfe said:

minecraft data only stores things that the players have changed.

 
 
 
 
 
 

Minecraft has no concept of what you've changed unless you explicitly code it to. When a chunk generates, it looks at what biome it is supposed to be, generates the height map (placing the biome-specific surface blocks as well), and then decorates it with ores, trees, structures, etc. Then that's it; it will not be generated/populated again. Once a chunk has been generated, it stays in that state forever (unless a mod regens the chunk manually, like Rejuvenation Missiles from ICBM). In your case, if a chunk generates before your ore is set to spawn, it will not spawn in that chunk. Any new world decorating you do (like fixing the spawn rate of your ore ) will only occur in freshly generated chunks.

 

Edit:

4 hours ago, aw_wolfe said:

8,000,000

 

 The fact that you were iterating over such a huge number of blocks also probably led you to think nothing was happening, when in fact it either crashed internally, was just taking a ridiculously long time, both, or something in between.

Edited by TheMasterGabriel
Posted

Thanks.

 

I do get a return on /find command, even for the large searches...even if to say '0 found'. I figured the large search area would be well outside anything generated when my player is first created. I am testing against searching for diamonds and can search a radius of 300 in about 6 seconds.

 

I loaded new ore mod in a new world (generated with old ore mod and no mithril) and it did not find any. Then spend a few minutes flying off in one direction and re-searched,  and found some. So Draco is correct.  I did not expect minecraft to create that many chunks at start of game.

 

I think I'll write a custom command to turn some stone into mithril and use it once to 'patch' a world and then rely on the worldgen to take care of new areas.

Thanks.

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...

×   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.

Announcements



×
×
  • Create New...

Important Information

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