Jump to content

Recommended Posts

Posted

I've tried several different things to get this to work, but I must be missing something incredibly simple because it just plain doesn't work.

 

Basically, I want to control whether or not an ore spawns in a specific biome. I've gotten the ore to spawn how I like it in every other way (height max, height min, vein size, etc) but whenever I try and base my spawning off of a biome it seems to just.. crap itself. Here's what I have so far.

 

 

BiomeGenBase b = world.getBiomeGenForCoords(chunkX, chunkZ);
...
	if(b.biomeName=="Plains")
	{
		System.out.println(b.biomeName);
		(new WorldGenMinable(Drore.oreCopper.blockID, 100)).generate(world, random, Xcoord, Ycoord, Zcoord);
	}

 

It seems to partially work. If I change the if to 'true', it works fine. If I remove the if and System.out entirely, it works fine. If I remove the if statement but leave the System.out it will print a lot of different biome names as it loads different chunks from different biomes. If I run it with that code above, it appears to work. It will print out "Plains" a shitload (and no other biomes) whenever I encounter a Plains biome, but the ores will not generate. It seems like it enters the if statement, but fails to execute the generation regardless.

 

I have also tried b.biomeName.equals("Plains") as well, to no avail.

 

tl;dr Someone explain how to generate ores differently based on biome because I clearly don't get it.

Posted

BiomeGenBase b = world.getBiomeGenForCoords(chunkX, chunkZ);

 

You have to use instead of chunkX and chunkZ, the Xcoord and Zcoord.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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