mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-07 03:00:29 +01:00
Lets not update chunks 458,752 times on island create and biome change.
This commit is contained in:
parent
e49b7da845
commit
0490425cde
@ -23,20 +23,21 @@ public class BiomeManager {
|
||||
}
|
||||
|
||||
public void setBiome(Island island, Biome biome) {
|
||||
Set<Chunk> chunks = new HashSet<>();
|
||||
Location location = island.getLocation(IslandWorld.Normal, IslandEnvironment.Island);
|
||||
int radius = (int) Math.ceil(island.getRadius());
|
||||
|
||||
for (int x = location.getBlockX() - radius; x < location.getBlockX() + radius; x++) {
|
||||
for (int z = location.getBlockZ() - radius; z < location.getBlockZ() + radius; z++) {
|
||||
location.getWorld().setBiome(x, z, biome);
|
||||
Chunk chunk = location.getWorld().getChunkAt(x >> 4, z >> 4);
|
||||
chunks.add(chunk);
|
||||
}
|
||||
}
|
||||
|
||||
for (Chunk chunk : chunks)
|
||||
updateBiome(island, chunk);
|
||||
for (int x = location.getBlockX() - radius; x < location.getBlockX() + radius; x += 16) {
|
||||
for (int z = location.getBlockZ() - radius; z < location.getBlockZ() + radius; z += 16) {
|
||||
Chunk chunk = location.getWorld().getChunkAt(x >> 4, z >> 4);
|
||||
updateBiome(island, chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBiome(Island island, Chunk chunk) {
|
||||
|
Loading…
Reference in New Issue
Block a user