Jump to content

[SOLVED][1.6.4]How To Make Trees Generate Biome Specific?


RetsuWolf

Recommended Posts

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?

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.