Biome Sources
A BiomeSource
dictates how biomes occupy regions in a world. These work in tandem with ChunkGenerators
to produce a dimension’s terrain.
A fixed source places the same biome across the entire world. It’s the simplest source to build and a fine fit for flat worlds, void worlds, or any dimension where biome variety does not matter.
import dev.wyck.model.biome.CustomBiome;
import dev.wyck.keys.ResourceKey;
import dev.wyck.wrapper.level.BiomeSource;
import org.bukkit.block.Biome;
// a registered custom biome
CustomBiome biome = CustomBiome.builder()
.resourceKey(ResourceKey.of("test", "biome"))
.fogColor("#DB00FD")
.skyColor("#2F46FF")
.register();
// fixed over a custom biome
BiomeSource custom = BiomeSource.fixed(biome);
// or a vanilla biome
BiomeSource vanilla = BiomeSource.fixed(Biome.PLAINS);
// or by key
BiomeSource byKey = BiomeSource.fixed(ResourceKey.of("minecraft", "desert")); Multi-Noise
Section titled “Multi-Noise”A multi-noise source distributes biomes the way the vanilla overworld does: each biome is placed at a point in a six-axis climate space (temperature, humidity, continentalness, erosion, depth, weirdness) plus a fitness offset, and the generator picks whichever biome’s point is closest for a given location.
import dev.wyck.model.biome.CustomBiome;
import dev.wyck.keys.ResourceKey;
import dev.wyck.wrapper.level.BiomeSource;
import dev.wyck.wrapper.worldgen.climate.ClimatePoint;
import dev.wyck.wrapper.worldgen.climate.ClimateParameter;
import org.bukkit.block.Biome;
import org.bukkit.plugin.java.JavaPlugin;
public class ExamplePlugin extends JavaPlugin {
@Override
public void onEnable() {
CustomBiome biome = CustomBiome.builder()
.resourceKey(ResourceKey.of("test", "biome"))
.fogColor("#DB00FD")
.skyColor("#2F46FF")
.register();
ClimatePoint withArgsClimate = ClimatePoint.of(1.8f, 1.2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
ClimatePoint zeroBuilderClimate = ClimatePoint.builder()
.temperature(ClimateParameter.point(-0.8f))
.humidity(ClimateParameter.point(-0.5f))
.build();
ClimatePoint builderClimate = ClimatePoint.builder()
.temperature(ClimateParameter.point(0.0f))
.humidity(ClimateParameter.point(0.0f))
.build();
BiomeSource source = BiomeSource.multiNoise()
.add(ResourceKey.of("minecraft", "plains"), withArgsClimate) // wins in hot, wet regions
.add(biome, zeroBuilderClimate) // wins in cold, dry regions
.add(Biome.JUNGLE, builderClimate) // fills everywhere else
.build(); // Done!
}
} Once built, you can pass the biome source to a generator and the generator to a LevelCreator.
ChunkGenerator generator = ChunkGenerator.of(source, Noise.overworld());
World world = LevelCreator.builder()
.levelKey(ResourceKey.of("test", "example"))
.generator(generator)
.create();