Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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?

  • Author

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!

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.