Jump to content

Recommended Posts

Posted

Yes :)

 

BiomeGenBase biomegenbase = world.getWorldChunkManager().getBiomeGenAt(i, j);
if(biomeGenBase instanceof BiomeGenForest)
{
   //generate structure
}

Sorry for mistakes, English is not my mother tongue

Posted

Thanks, that seemed to work. But is there a way to make it spawn in like a hillside as well? I tried this:

	protected int[] GetValidSpawnBlocks() {
	return new int[] { Block.dirt.blockID };
}

public boolean LocationIsValidSpawn(World world, int x, int y, int z) {
	int checkID = world.getBlockId(x, y, z + 2);
	int checkID2 = world.getBlockId(x, y + 5, z + 1);

	if (checkID != Block.grass.blockID || (checkID2 != Block.dirt.blockID && checkID2 != Block.stone.blockID)) {
		return false;
	} else {
		return true;
	}
}

public WorldGenDungeon() {
}

public boolean generate(World world, Random rand, int i, int j, int k) {
	// check that each corner is one of the valid spawn blocks
	if (!LocationIsValidSpawn(world, i, j, k + 2) || !LocationIsValidSpawn(world, i, j + 5, k + 1)) {
		return false;
	}

And then the generation underneath that. This is in a custom class called WorldGenDungeon.

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.