Skip to content

On the Topic of Biome Generation

Chris edited this page Jan 9, 2017 · 10 revisions

TL;DR

There are four types of biomes you can have in the manager. If you remove all the biomes of one type, Vanilla generation will crash. If you remove a lot of biomes, make sure BiomeTweaker doesn't warn you that it will crash. If it does, you need to add at least one biome to each empty type. E.g.

desert.addToGeneration("WARM", 2000)
desert.addToGeneration("COOL", 2000)
desert.addToGeneration("DESERT", 2000)
desert.addToGeneration("ICY", 2000)

Or you could just use the registerGenBiomeRep command in the latest development builds.

For this whole document, assume that

allBiomes = forAllBiomes()

The Basics

Replacement Lifecycle

Chunk Creation -> Biome Maps created (from BiomeManager) -> Stone Maps placed (Stone and Water)-> BT Biome Replacement

How do I Remove Biome X from Generation?

Say you want to remove the biome with ID 9 from generation. Simply do

biome9 = forBiomes(9)
biome9.remove()

See the the official documentation for more info on the command.

Uh... I Removed a Biome but it's Still Generating...

Yeah, I know. It's caused me a lot of headaches. But guess what? Someone decided some biomes should be hardcoded. Yep, HARDCODED INTO GENERATION. But, I found a semi-solution, so stop writing that bug report and read the next section.

How do I Replace Biome X with Biome Y? (Only for v1.2.129+)

Got a hardcoded biome you want to remove? Or do you simply just want a biome to generate like a different biome? Well I have just the command for you. Say you want to replace biome 2 with biome 10. Simply do

biome2 = forBiomes(2)
biome2.registerGenBiomeRep(10)

See the the official documentation for more information on this command.

Let's Get Technical

Why Does Removing too Many Biomes Cause a Crash? Can I Fix it?

If you try doing something similar to this

allBiomes.remove()

Minecraft will crash with a stacktrace similar to this

java.lang.ArithmeticException: / by zero
at net.minecraft.world.gen.layer.GenLayer.func_75902_a(GenLayer.java:134)
at net.minecraft.world.gen.layer.GenLayerBiome.getWeightedBiomeEntry(GenLayerBiome.java:132)
at net.minecraft.world.gen.layer.GenLayerBiome.func_75904_a(GenLayerBiome.java:116)
at net.minecraft.world.gen.layer.GenLayerZoom.func_75904_a(SourceFile:20)
at net.minecraft.world.gen.layer.GenLayerZoom.func_75904_a(SourceFile:20)
at net.minecraft.world.gen.layer.GenLayerBiomeEdge.func_75904_a(SourceFile:14)
at net.minecraft.world.gen.layer.GenLayerHills.func_75904_a(SourceFile:19)
...

Here's what's happening. Forge has something named the BiomeManager. This is the central registry for adding biomes to generation. When Minecraft generates a chunk, it decides the biome by asking the BiomeManager for all biomes registered to a certain type. It then adds up the weights of all these, does some math, and picks one. However, if there are no biomes for that type, the weights add up to zero, and when you try to divide by zero, bad things happen. But, we can't just throw our arms up and walk out of the room. We need a solution! All you need to do is add at least one biome to the empty types! E.g.

desert.addToGeneration("WARM", 2000)
desert.addToGeneration("COOL", 2000)
desert.addToGeneration("DESERT", 2000)
desert.addToGeneration("ICY", 2000)

If you aren't sure if a type is empty, just search your logs for "BiomeTweaker". It will let you know with a warning. See the the official documentation for more info on the command.

Hardcoded Biomes

Unfortunately, there are hardcoded biomes. Here's a few snippets to highlight them.

int desertIdx = BiomeManager.BiomeType.DESERT.ordinal();
  
if (p_i2122_4_ == WorldType.DEFAULT_1_1)
{
    biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.desert, 10));
    biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.forest, 10));
    biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.extremeHills, 10));
    biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.swampland, 10));
    biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.plains, 10));
    biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.taiga, 10));
}
else
{
    biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.desert, 30));
    biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.savanna, 20));
    biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.plains, 10));
}
if (this.nextInt(3) == 0)
{
    aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.mesaPlateau.biomeID;
}
else
{
    aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.mesaPlateau_F.biomeID;
}
if (l1 > 0)
{
    aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.jungle.biomeID;
}
if (l1 > 0)
{
    aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.megaTaiga.biomeID;
}
else
{
    aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.mushroomIsland.biomeID;
}

You don't understand how frustrated I am with this.

BiomeTweaker has been updated to 1.18. Please see the links below. Pages for previous versions can be found above.


BiomeTweaker 1.18

Features and Carvers

Custom Mob Effects

Example Scripts

Clone this wiki locally