RetsuWolf Posted May 24, 2014 Share Posted May 24, 2014 Greetings! I've been wondering how to make custom trees generate biome specifically? I have like 10 new trees but they all generate in every biome. The only way I could think of making them spawn in the biome I want is by changing that biomes top block to a custom block and making the tree only generate on that custom block. I feel like there's an easier way around this. Anyone have any ideas? Quote Link to comment Share on other sites More sharing options...
RetsuWolf Posted May 26, 2014 Author Share Posted May 26, 2014 Thank you this really helped out! For anyone who doesn't know how to fix this in the tree manager class for your custom tree I just added an if/else statement. This is what it looked like. package fantasy_biomes.trees.managers; import java.util.Random; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import cpw.mods.fml.common.IWorldGenerator; import fantasy_biomes.Main; import fantasy_biomes.trees.WorldGenYourTree; public class YourTreeManager implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.dimensionId){ case -1: generateNether(world, random, chunkX * 16, chunkZ * 16); case 0: generateSurface(world, random, chunkX * 16, chunkZ * 16); case 1: generateEnd(world, random, chunkX * 16, chunkZ * 16); } } private void generateEnd(World world, Random random, int x, int z) { } private void generateSurface(World world, Random random, int x, int z) { if(world.getBiomeGenForCoords(x, z) == Main.biomeYourBiome){ for (int i = 0; i < 20; i++){ int Xcoord1 = x + random.nextInt(16); //where in chuck it generates int Ycoord1 = random.nextInt(100); //how high it generates int Zcoord1 = z + random.nextInt(16); //where in chunk it generates new WorldGenYourTree(true).generate(world, random, Xcoord1, Ycoord1, Zcoord1); } } if(world.getBiomeGenForCoords(x, z) != Main.biomeYourBiome){ return; } } private void generateNether(World world, Random random, int x, int z) { } } Also I discovered that just by deleting the tree manager class and not registering the tree as a new world gen in the main class of the mod and simply call the world gen class in your custom biomes class than that will also fix the problem. Thanks again for the help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.