The BiomeSetter
The BiomeSetter is an interface of BiomesAPI which allows a developer to physically change the biome of a specific chunk or chunk region.
The BiomeSetter is an alternative to the PacketHandler and is one of the two ways for players to see your CustomBiomes.
When to use the BiomeSetter:
- When you want to change the biome of an area and ‘forget’ about it.
- When you want to change gameplay elements using
CustomBiomes. - When you want chunks to persist your biome to the disk as NBT.
Examples
Section titled “Examples”Using the BiomeSetter is incredibly straightforward.
public class ExampleClass {
// Calling of() creates a new instance of the BiomeSetter. private static final BiomeSetter BIOME_SETTER = BiomeSetter.of();
public void setBiomeInChunk(@NotNull CustomBiome customBiome, @NotNull Chunk chunk)) { // Sets the biome of a chunk to a CustomBiome and forcefully updates the chunks for nearby players. BIOME_SETTER.setChunkBiome(chunk, customBiome, true); }
public void setBiomeInChunkRegion(@NotNull CustomBiome customBiome, @NotNull Block block) { // Sets the biome of a chunk region or block to a CustomBiome. Players will need to reload their chunks to see changes. BIOME_SETTER.setBlockBiome(block, customBiome); }}class ExampleClass {
companion object { // Calling of() creates a new instance of the BiomeSetter. private val BIOME_SETTER: BiomeSetter = BiomeSetter.of() }
fun setBiomeInChunk(customBiome: CustomBiome, chunk: Chunk) { // Sets the biome of a chunk to a CustomBiome and forcefully updates the chunks for nearby players. BIOME_SETTER.setChunkBiome(chunk, customBiome, true) }
fun setBiomeInChunkRegion(customBiome: CustomBiome, block: Block) { // Sets the biome of a chunk region or block to a CustomBiome. Players will need to reload their chunks to see changes. BIOME_SETTER.setBlockBiome(block, customBiome) }}