|
95 | 95 | import java.lang.reflect.InvocationTargetException; |
96 | 96 | import java.time.Duration; |
97 | 97 | import java.util.*; |
| 98 | +import java.util.concurrent.CompletableFuture; |
98 | 99 | import java.util.stream.Stream; |
99 | 100 |
|
100 | 101 | public record SkyBlockGenericLoader(HypixelTypeLoader typeLoader) { |
@@ -303,7 +304,6 @@ public void initialize(MinecraftServer server) { |
303 | 304 | .build()); |
304 | 305 | SkyBlockIsland.runVacantLoop(MinecraftServer.getSchedulerManager()); |
305 | 306 |
|
306 | | - // Set region biomes |
307 | 307 | SkyBlockRegion.getRegions().forEach(region -> { |
308 | 308 | if (region.getServerType() != HypixelConst.getTypeLoader().getType()) return; |
309 | 309 | SkyBlockBiomeConfiguration biomeConfig = region.getType().getBiomeHandler(); |
@@ -579,14 +579,23 @@ public static <T> Stream<T> loopThroughPackage(String packageName, Class<T> claz |
579 | 579 | } |
580 | 580 |
|
581 | 581 | private void setBiome(int x, int y, int z, RegistryKey<Biome> biome) { |
582 | | - Chunk chunk = HypixelConst.getInstanceContainer().getChunk(CoordConversion.globalToChunk(x), CoordConversion.globalToChunk(z)); |
583 | | - chunk.setBiome(x, y, z, biome); |
| 582 | + CompletableFuture<Chunk> chunk = HypixelConst.getInstanceContainer().loadChunk(CoordConversion.globalToChunk(x), CoordConversion.globalToChunk(z)); |
| 583 | + chunk.thenAccept((c) -> c.setBiome(x, y, z, biome)); |
584 | 584 | } |
585 | 585 |
|
586 | 586 | private void setBiome(Pos start, Pos end, RegistryKey<Biome> biome) { |
587 | | - for (int x = start.blockX(); x <= end.blockX(); x++) { |
588 | | - for (int y = start.blockY(); y <= end.blockY(); y++) { |
589 | | - for (int z = start.blockZ(); z <= end.blockZ(); z++) { |
| 587 | + int minX = Math.min(start.blockX(), end.blockX()); |
| 588 | + int maxX = Math.max(start.blockX(), end.blockX()); |
| 589 | + |
| 590 | + int minY = Math.min(start.blockY(), end.blockY()); |
| 591 | + int maxY = Math.max(start.blockY(), end.blockY()); |
| 592 | + |
| 593 | + int minZ = Math.min(start.blockZ(), end.blockZ()); |
| 594 | + int maxZ = Math.max(start.blockZ(), end.blockZ()); |
| 595 | + |
| 596 | + for (int x = minX; x <= maxX; x++) { |
| 597 | + for (int y = minY; y <= maxY; y++) { |
| 598 | + for (int z = minZ; z <= maxZ; z++) { |
590 | 599 | setBiome(x, y, z, biome); |
591 | 600 | } |
592 | 601 | } |
|
0 commit comments