Jump to content

[1.7.2] Custom Biomes.


mrjoshiemoto

Recommended Posts

So I've looked in the forums and so far this has YET to be solved.

First before we get started here, I need to clear some things up. .addbiome no longer works.  Neither does

WorldType.DEFAULT.addNewBiome(biome);

This code DOES exist in the worldtype class however it is no longer functioning as it has been put in to comment form, thus being wiped from the code.

Obviously there is a way to do this, i mean I've seen plenty of people posting about dimensions, and no modder is complaining about not having this "key code".

I'm just wondering what is the new way to write, "Worldtype.DEFAULT.addNewBiome" is there one?

Thanks to anyone who can help solve this.

Link to comment
Share on other sites

I also just tried the biomeDictionary... which works, but it doesn't generate my biome probably because I don't know how to code it. Tomorrow I'll see if I can find a actual visual tutorial. It would actually make more sense for the the BiomeDictionary to have ousted the .addbiome. It's more complicated but looks like you can do more with it.

You can find it here: http://www.minecraftforge.net/wiki/Using_The_BiomeDictionary

Link to comment
Share on other sites

This is probably handled with events now.

For instance, there is the

getModdedBiomeGenerators(WorldType wtype, long seed, GenLayer[] original)

that fires

WorldTypeEvent.InitBiomeGens

event on TERRAIN_GEN_BUS, that allows new biomegenerators to be added/removed.

Link to comment
Share on other sites

This is probably handled with events now.

For instance, there is the

getModdedBiomeGenerators(WorldType wtype, long seed, GenLayer[] original)

that fires

WorldTypeEvent.InitBiomeGens

event on TERRAIN_GEN_BUS, that allows new biomegenerators to be added/removed.

 

So for those who may be less java savvy are you saying the code would look like this.

public static void mainRegistry()
{
	setModdedBiomeGenerator();
	getModdedBiomeGenerator(wtype, seed, original);
}
public static void setModdedBiomeGenerator(){
public static final BiomeGenBase diamondBiome = (new diamondBiome(50).setColor(0x000000).setBiomeName("Diamond"));
}
public void getModdedBiomeGenerators(WorldType wtype, long seed, GenLayer[] original){
diamondBiome(DEFAULT, seed, original);
}

 

This may be completely off what it should be, as far as what the line of code does, but shouldn't this work? In theory you make a biome and then you get the biome and access it, the question I have is this still doesn't answer one question. Do you need to register biomes still? Or can you just sort of make and bake?

Link to comment
Share on other sites

I personally use a custom WorldType where you can specify your own ChunkProvider etc.  You can then go in and make your own GenLayer files where the biome generation occurs.  It's pretty complicated for beginniners, took me almost a year of modding to get up to figuring out what everything does in terrain/biome generation, but I tell you it's well worth it.  Almost done updating my mod in progress to 1.7 and I have some really cool stuff going on, will share with you all eventually and maybe Ill do some tutorials.

Link to comment
Share on other sites

I personally use a custom WorldType where you can specify your own ChunkProvider etc.  You can then go in and make your own GenLayer files where the biome generation occurs.  It's pretty complicated for beginniners, took me almost a year of modding to get up to figuring out what everything does in terrain/biome generation, but I tell you it's well worth it.  Almost done updating my mod in progress to 1.7 and I have some really cool stuff going on, will share with you all eventually and maybe Ill do some tutorials.

I think most of the modders would love you if you did that! I think I might be able to muddle through the code. Hopefully it doesn't take me a year to get it though! haha.

Link to comment
Share on other sites

I did some digging and found a few things that might point us in the right direction.

 

So what I have so far is I know we are going to have to do a few things here. We will need to copy and rewrite the following files.

GenLayerBiome

 

BiomeGenBase

 

You'll need to create a new Biome obviously thats easy.

In GenLayerBiome this code exists pointing to the idea of not only registry but spawning the biome into the game.

 

public GenLayerBiome(long par1, GenLayer par3GenLayer, WorldType par4WorldType)
    {
        super(par1);
        this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.savanna, BiomeGenBase.savanna, BiomeGenBase.plains};
        this.field_151621_d = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.roofedForest, BiomeGenBase.extremeHills, BiomeGenBase.plains, BiomeGenBase.birchForest, BiomeGenBase.swampland};
        this.field_151622_e = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.taiga, BiomeGenBase.plains};
        this.field_151620_f = new BiomeGenBase[] {BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.coldTaiga};
        this.parent = par3GenLayer;

        if (par4WorldType == WorldType.DEFAULT_1_1)
        {
            this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.plains, BiomeGenBase.taiga};
        }
    }

 

So whats the problem with it? It's not a method so you can't call it in your registry, meaning you need some communication. IN THEORY you can just say,

GenLayerBiome genNewBiomes = new GenLayerBiome(par1, genNewBiome, worldType.DEFAULT);

 

 

We will encounter errors here, also what is long par1? According to eclipse genNewBiome isn't initialized yet. Which... makes no sense really.

 

So in theory you create your biomes in your new biomeGenBase class, then add them into your own array inside your genLayerBiome class, then call it by the code I gave above... right?

 

Am I on the right track here? Or am I way off. I really would love to know and I'd like to find out more if I am wrong on how this code can start to work!

Thanks for all the help! :)

Link to comment
Share on other sites

Ok this is how I do it.

 

1) Create a new world type.  In 1.6 I overwrote the default world type, but haven't tried/accomplished that in 1.7 so I just created my own world type

 

 

I put this in my post init config area

WorldType CUSTOM = new WorldTypeCustom(3, "custom");

 

Create a WorldTypeCustom class that extends WorldType and overwrite the class that specifies the GenLayer, so it would look like this

 

public class WorldTypeCustom extends WorldType {

public WorldTypeCustom(int par1, String name) {
	super(name);
	// TODO Auto-generated constructor stub
}

   /**
     * Creates the GenLayerBiome used for generating the world
     * 
     * @param worldSeed The world seed
     * @param parentLayer The parent layer to feed into any layer you return
     * @return A GenLayer that will return ints representing the Biomes to be generated, see GenLayerBiome
     */
@Override
  public GenLayer getBiomeLayer(long worldSeed, GenLayer parentLayer)
    {
        GenLayer ret = new CustomGenLayerBiome(200L, parentLayer, this);
        ret = GenLayerZoom.magnify(1000L, ret, 2);
        ret = new GenLayerBiomeEdge(1000L, ret);
        return ret;
    }
}

 

Copy the default GenLayerBiome file and rename it to your custom file that you override in your custom WorldType, and then add your biomes into the arrays at the top of the file.

 

You can get into even crazier customization with the other GenLayer files which I can probably help with if you need it, but this is the way I use to add my biomes.

 

 

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.