Creating Custom Biomes
CustomBiomes
are the core of BiomesAPI and are used to create biomes that can be rendered to players using the various biome renderers in BiomesAPI.
We provide many different options for customizing your biome visuals and gameplay elements through our builder, but you may also omit any of these attributes if you want to use the default underlying biome’s values.
Example Usage
Section titled “Example Usage”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 customBiome = CustomBiome.builder()
.resourceKey(ResourceKey.of("test", "custombiome"))
.settings(BiomeSettings.defaultSettings())
.fogColor("#FFFFFF")
.foliageColor("#F5F2EB")
.skyColor("#B99DFC")
.waterColor("#F5F2EB")
.waterFogColor("#000000")
//.grassColor("#DBE9EC") // Want to use the default underlying color? Omit it!
.build();
// All done? Register it!
customBiome.register();
}
} import me.outspending.biomesapi.biome.CustomBiome;
import me.outspending.biomesapi.registry.ResourceKey;
import me.outspending.biomesapi.wrapper.BiomeSettings;
import me.outspending.biomesapi.wrapper.environment.attribute.WrappedEnvironmentAttributes;
import me.outspending.biomesapi.wrapper.environment.particle.WrappedParticleTypes;
import me.outspending.biomesapi.wrapper.environment.particle.options.DustParticle;
import org.bukkit.Material;
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())
.fogColor("#FFFFFF")
.foliageColor("#F5F2EB")
.dryFoliageColor("#F5F2EB")
.skyColor("#B99DFC")
.waterColor("#F5F2EB")
.waterFogColor("#000000")
.grassColor("#DBE9EC")
.ambientParticle(WrappedParticleTypes.SMOKE, 0.001f)
.ambientParticle(WrappedParticleTypes.DUST, 0.002f, DustParticle.of("#FF0000"))
.setAttribute(WrappedEnvironmentAttributes.BLOCK_LIGHT_TINT, "#FF10F0")
.setAttribute(WrappedEnvironmentAttributes.SKY_LIGHT_FACTOR, 0.9f)
.setAttribute(WrappedEnvironmentAttributes.FOG_COLOR, "#FFFFFF")
.setAttribute(WrappedEnvironmentAttributes.SKY_LIGHT_COLOR, "#FFBEBE")
// Block replacements can only be used with PacketHandlers!
.replace(Material.GRASS_BLOCK, Material.STONE)
.register();
}
} Modifying Biomes
Section titled “Modifying Biomes”BiomesAPI supports modifying existing biomes after they’ve been registered.
This means that you can change the visuals and gameplay elements of your biome on the fly.
To apply your changes, you must call the modify() method on your biome, which will update the registry.
For players to see your changes they will either need to relog or you can use the RegistryReconfigurer to resend the biome data to players without them needing to relog.
Example Usage
Section titled “Example Usage”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 customBiome = CustomBiome.builder()
.resourceKey(ResourceKey.of("test", "custombiome"))
.settings(BiomeSettings.defaultSettings())
.fogColor("#FFFFFF")
.foliageColor("#F5F2EB")
.skyColor("#B99DFC")
.waterColor("#F5F2EB")
.waterFogColor("#000000")
.register();
// Don't like it later? Change it!
customBiome.setFoliageColor("#00FF00");
customBiome.modify();
}
}