Skip to content

Biome Providers

BiomesAPI provides a few built-in implementations of Bukkit’s BiomeProvider. These can be used in conjunction with Bukkit’s WorldCreator to create worlds with custom biomes from the ground-up rather than replacing biomes in existing worlds with the BiomeSetter.

  • of(CustomBiome): New instance of a BasicBiomeProvider with a single biome.
ExamplePlugin.java Java
import me.outspending.biomesapi.biome.CustomBiome;
import me.outspending.biomesapi.providers.BasicBiomeProvider;
import me.outspending.biomesapi.registry.ResourceKey;
import org.bukkit.WorldCreator;
import org.bukkit.plugin.java.JavaPlugin;

public class ExamplePlugin extends JavaPlugin {
  @Override
  public void onEnable() {
      CustomBiome customBiome = CustomBiome.builder()
          .resourceKey(ResourceKey.of("test", "biome"))
          .waterColor("#DB00FD")
          .foliageColor("#2F46FF")
          .skyColor("#D13A71")
          .register();

      BasicBiomeProvider provider = BasicBiomeProvider.of(customBiome)

      new WorldCreator("example")
          // Other worldgen settings...
          .biomeProvider(provider)
          .createWorld();
  }
}

Replaces vanilla biomes with custom biomes on a one-to-one basis. At each position it asks the world’s vanilla provider what biome would normally generate, and swaps in your custom biome if a mapping exists; unmapped biomes pass through unchanged.

ExamplePlugin.java Java
import me.outspending.biomesapi.biome.CustomBiome;
import me.outspending.biomesapi.providers.ReplacementBiomeProvider;
import me.outspending.biomesapi.registry.ResourceKey;
import org.bukkit.WorldCreator;
import org.bukkit.block.Biome;
import org.bukkit.plugin.java.JavaPlugin;

public class ExamplePlugin extends JavaPlugin {
  @Override
  public void onEnable() {
      CustomBiome customBiome = CustomBiome.builder()
          .resourceKey(ResourceKey.of("test", "biome"))
          .waterColor("#DB00FD")
          .foliageColor("#2F46FF")
          .skyColor("#D13A71")
          .register();

      ReplacementBiomeProvider provider = ReplacementBiomeProvider.builder()
          .replace(Biome.PLAINS, customBiome)
          .build();

      new WorldCreator("example")
          // Other worldgen settings...
          .biomeProvider(provider)
          .createWorld();
  }
}

Determines the biome at each position by running an ordered series of steps. Each step inspects the position and either produces a biome or returns null to defer to the next step. The first step to produce a biome wins; if no step matches, the fallback is used, and if no fallback is set, generation defers to the world’s vanilla provider.

Steps are called concurrently during chunk generation, so each BiomeStep must be pure and free of side effects.

ExamplePlugin.java Java
import me.outspending.biomesapi.biome.CustomBiome;
import me.outspending.biomesapi.providers.StepsBiomeProvider;
import me.outspending.biomesapi.registry.ResourceKey;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.plugin.java.JavaPlugin;

public class ExamplePlugin extends JavaPlugin {
  @Override
  public void onEnable() {
      CustomBiome volcanoBiome = CustomBiome.builder()
          .resourceKey(ResourceKey.of("test", "volcano"))
          .skyColor("#D13A71")
          .register();

      CustomBiome ashBiome = CustomBiome.builder()
          .resourceKey(ResourceKey.of("test", "ash"))
          .fogColor("#3A3A3A")
          .ambientParticle(WrappedParticleTypes.ASH, 0.0001f)
          .register();

      CustomBiome oceanBiome = CustomBiome.builder()
          .resourceKey(ResourceKey.of("test", "ocean"))
          .waterColor("#1E90FF")
          .waterFogColor("#00BFFF")
          .register();

      CustomBiome plainsBiome = CustomBiome.builder()
          .resourceKey(ResourceKey.of("test", "plains"))
          .foliageColor("#2F46FF")
          .grassColor("#2F46FF")
          .register();

      StepsBiomeProvider provider = StepsBiomeProvider.builder()
          .step((worldInfo, x, y, z) -> {
              if (y > 200) return volcanoBiome;
              if (worldInfo.getEnvironment() == World.Environment.NETHER) return ashBiome;
              return null; // defer to next step
          }, volcanoBiome, ashBiome)
          .step(oceanBiome, (worldInfo, x, y, z) -> y < 40) // convenience form, auto-registered
          .fallback(plainsBiome)
          .build();

      new WorldCreator("example")
          // Other worldgen settings...
          .biomeProvider(provider)
          .createWorld();
  }
}