Skip to content

Biome API

The Biome API is a feature introduced in Bestium v3.0.0 and lives in the cz.jeme.bestium.api.inject.biome package.
It allows you to define in which biomes, how often and in what quantities should your creature naturally spawn.

To control in which biomes your entity may naturally spawn, you can define a SpawnRule. When the server starts, all registered biomes are passed into this function and the SpawnData, definining how often and in what quantities should the mob spawned, is injected to the biome.

You can implement your own custom rule (using a lambda), but there are already some builtin useful static methods:

  • never()
    Doesn’t spawn your entity in any biomes. This is the default behavior when no rule is set.

  • ifBiome(BiomeFilter, SpawnData)
    Returns the provided SpawnData for biomes where the biome filter tests positive.

  • firstMatch(SpawnRule...)
    Tries multiple spawn rules in order and returns the first one that successfully returns SpawnData. This is useful for combining logic.

You can set the spawn rule of an EntityInjection.Builder using setSpawnRule(SpawnRule).

A BiomeFilter is a predicate that checks whether a given biome matches a certain condition. It returns true if the condition is met, and false otherwise.

You can implement your own custom rule (using a lambda), but there are already some builtin static methods:

All filters must pass.

At least one filter must pass.

Inverts the filter result.

Filters biomes based on their base temperature. Unlike normal temperature, base temperature is a static value defined in biome’s definition.

You can use BiomeTemperature to access predefined ranges: COLD, TEMPERATE, WARM.

Filters biomes by tag (for example minecraft:is_savanna). Tags group related biomes, for a full list, see Minecraft Wiki - Biome tag.

Filters by exact biome key (for example minecraft:savanna_plateau). For a full list of vanilla biome keys, see Minecraft Wiki - Biome IDs.

Matches biomes tagged with minecraft:is_overworld.

Matches biomes tagged with minecraft:is_nether.

Matches biomes tagged with minecraft:is_end.

Example EntityInjection.Builder spawn configuration for our capybara may look like this:

EntityInjection.builder(...)
...
.setSpawnRule(
SpawnRule.ifBiome(
BiomeFilter.tag(Key.key("minecraft:is_river")),
SpawnData(3, 1, 4)
)
)