Skip to content

Referencing Custom Biomes

In addition to being able to keep references to your CustomBiomes in your own code, BiomesAPI also provides a built-in RegisteredBiomes that allows you to get a reference to your custom biomes just from a ResourceKey.

RegisteredBiomes exposes the following methods. The *Lazily variants return a Lazy that defers the lookup until first accessed.

ExamplePlugin.java Java
import me.outspending.biomesapi.biome.RegisteredBiomes;
import me.outspending.biomesapi.biome.CustomBiome;
import me.outspending.biomesapi.registry.ResourceKey;
import me.outspending.biomesapi.wrapper.BiomeSettings;
import org.bukkit.plugin.java.JavaPlugin;

public class ExamplePlugin extends JavaPlugin {
  @Override
  public void onEnable() {
      CustomBiome.builder()
          .resourceKey(ResourceKey.of("test", "custombiome"))
          .settings(BiomeSettings.defaultSettings())
          .waterColor("#F5F2EB")
          .register();
  }

  private void example() {
      CustomBiome reference = RegisteredBiomes.getOrThrow(ResourceKey.of("test", "custombiome"));
      // Do something with the reference!
  }
}