Skip to content

The BiomeRegistry

The BiomeRegistry is abstraction of Minecraft’s worldgen/biome registry. When using BiomesAPI, the BiomeRegistry is available to use, but is not generally needed since BiomeRegistry actions can be performed directly from CustomBiomes. (e.g. CustomBiome#register or CustomBiome#modify.)

Adding biomes to the registry can be done at any point during your plugin’s lifecycle, but players must relog because of registry de-sync! If you try to send a newly created CustomBiome either through the BiomeSetter or BiomeHandler to a player, their client will disconnect itself or crash! Minecraft’s worldgen/biome registry is synced between the server and the client during the configuration phase and that phase MUST be repeated before a player can see a new biome!

If you are using the PacketHandler to send biomes to players, you may include additional logic in your conditional to ensure players which have not yet re-logged do not see your newly created biome. If you are using the BiomeSetter, you will need to forcefully disconnect the client or intercept the biome packets yourself, less the client will disconnect or crash itself when rendering your biome.

CustomBiomes, and by extension Minecraft biomes in general can not be unregistered (at least not easily). There is no limit to how many biomes you can register, but you cannot unregister them without fully restarting the server.

public class ExampleClass {
private static final BiomeRegistry BIOME_REGISTRY = BiomeRegistry.newRegistry();
public void exampleUsage(@NotNull CustomBiome customBiome) {
BIOME_REGISTRY.register(customBiome); // Registered!
// Let's change the color of our biome's foliage and modify it:
int red = 0xFF0000;
customBiome.setFoliageColor(red);
BIOME_REGISTRY.modify(customBiome);
}
}