This repository was archived by the owner on May 27, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Setting Biomes
Outspending edited this page Dec 22, 2023
·
2 revisions
Here you will learn about how to set / update the biomes inside your world. These are Saved on Server Restart.
Firstly let's learn the main biome setter. As shown below here are all the methods you can use for setting biomes:
-
setBlockBiome(@NotNull Block block, @NotNull CustomBiome customBiome)(V0.0.1) -
setBlockBiome(@NotNull Block block, @NotNull CustomBiome customBiome, boolean updateBiome)(V0.0.1) -
setChunkBiome(@NotNull Chunk chunk, @NotNull CustomBiome customBiome)(V0.0.1) -
setChunkBiome(@NotNull Chunk chunk, @NotNull CustomBiome customBiome, boolean updateBiome)(V0.0.1) -
setChunkBiome(@NotNull Chunk chunk, int minHeight, int maxHeight, @NotNull CustomBiome customBiome)(V0.0.1) -
setChunkBiome(@NotNull Chunk chunk, int minHeight, int maxHeight, @NotNull CustomBiome customBiome, boolean updateBiome)(V0.0.1) -
setBoundingBoxBiome(@NotNull World world, @NotNull BoundingBox boundingBox, @NotNull CustomBiome customBiome)(V0.0.1) -
setRegionBiome(@NotNull Location from, @NotNull Location to, @NotNull CustomBiome customBiome)(V0.0.1) -
setRegionBiome(@NotNull Location from, @NotNull Location to, @NotNull CustomBiome customBiome, boolean updateBiome)(V0.0.1) -
setRegionBiome(@NotNull World world, @NotNull Vector from, @NotNull Vector to, @NotNull CustomBiome customBiome)(V0.0.1) -
setRegionBiome(@NotNull World world, @NotNull Vector from, @NotNull Vector to, @NotNull CustomBiome customBiome, boolean updateBiome)(V0.0.1)
These are all the methods inside the BiomeSetter class.
If you are looking to update the biomes for all players that have the chunk loaded without having to relog, use the methods that have the boolean updateBiome and set it to true. This will send the packet to update the chunk to the player. The chunks updated are calculated to the chunks that were calculated to improve client / server performance.
Now let's make our own CustomBiome and set a chunk to that newly created biome.
public class Main extends JavaPlugin implements Listener {
@Override
public void onLoad() {
NMSHandler.init(); // Initialize NMS
CustomBiome biome = CustomBiome.builder()
.resourceKey(BiomeResourceKey.of("test", "custombiome"))
.particleRenderer(ParticleRenderer.defaultSettings())
.settings(BiomeSettings.defaultSettings())
.fogColor("#db4929")
.foliageColor("#22c1c8")
.skyColor("#c8227d")
.waterColor("#c82222")
.waterFogColor("#b9de2e")
.grassColor("#40df8b")
.build();
// Register the newly created biome
BiomeRegistry.newRegistry().register(biome);
}
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onBreak(BlockBreakEvent e) {
CustomBiome biome = BiomeHandler.getBiome(new BiomeResourceKey("test", "custombiome"));
if (biome == null) return;
Chunk chunk = e.getBlock().getChunk();
BiomeSetter.setChunkBiome(chunk, biome, true);
}
}