Jump to content

Recommended Posts

Posted

The Structure Itself: http://pastie.org/8306221

The Generation Class: http://pastie.org/8306224

 

Yes, the generator is registered.

 

The blocks generate and all, my problem here is with the Y value. I have been testing generation in a super flat world (as it is pure grass / dirt) and find that the blocks are generating anywhere between levels 1-4, whereas I would like them to be above ground at all times. How do I get this to happen? I assume some changes need to be done with the Y value, I've tinkered with it here and there, and am still not getting the product I'd like.

 

Thanks in advance.

Posted

world.getTopSolidOrLiquidBlock(x pos, z pos);  Gives you the height (y value) of the top block at the x/z position.

 

If you guys dont get it.. then well ya.. try harder...

Posted

world.getTopSolidOrLiquidBlock(x pos, z pos);  Gives you the height (y value) of the top block at the x/z position.

 

That works, but now they are spawning a little too often for my taste ( every few blocks or so). How could I limit the amount per chunk?

 

Code now looks like:

 

private void generateSurface(World world, Random random, int i, int j) {
	int firstBlockXCoord = i + random.nextInt(16);
	//		int firstBlockYCoord = random.nextInt(256);
	int firstBlockZCoord = j + random.nextInt(16);
	new AirTempleStructure().generate(world, random, firstBlockXCoord, world.getTopSolidOrLiquidBlock(firstBlockXCoord, firstBlockZCoord) - 1, firstBlockZCoord);
}

Posted

private void generateSurface(World world, Random random, int i, int j) {
    if(random.nextInt(4) == 0){
	int firstBlockXCoord = i + random.nextInt(16);
	//		int firstBlockYCoord = random.nextInt(256);
	int firstBlockZCoord = j + random.nextInt(16);
	new AirTempleStructure().generate(world, random, firstBlockXCoord, world.getTopSolidOrLiquidBlock(firstBlockXCoord, firstBlockZCoord) - 1, firstBlockZCoord);
    }
}

In this case this means that every chunk has a 1/4 chance to spawn your structure. This ratio easily can be changed to your taste of course.

Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.

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.