AnvilLoader biome cleanup

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-11-18 00:11:18 +01:00
parent 1c523e1554
commit 923c2d9987

View File

@ -22,7 +22,6 @@ import java.io.RandomAccessFile;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import java.util.Arrays;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -89,17 +88,13 @@ public class AnvilLoader implements IChunkLoader {
Chunk chunk = new DynamicChunk(instance, chunkX, chunkZ); Chunk chunk = new DynamicChunk(instance, chunkX, chunkZ);
// TODO Biomes // TODO Biomes
Biome[] biomes;
if (fileChunk.getGenerationStatus().compareTo(ChunkColumn.GenerationStatus.Biomes) > 0) { if (fileChunk.getGenerationStatus().compareTo(ChunkColumn.GenerationStatus.Biomes) > 0) {
int[] fileChunkBiomes = fileChunk.getBiomes(); final int[] fileChunkBiomes = fileChunk.getBiomes();
biomes = new Biome[fileChunkBiomes.length]; for (int id : fileChunkBiomes) {
for (int i = 0; i < fileChunkBiomes.length; i++) { // ((y >> 2) & 63) << 4 | ((z >> 2) & 3) << 2 | ((x >> 2) & 3)
final int id = fileChunkBiomes[i]; final Biome biome = Objects.requireNonNullElse(BIOME_MANAGER.getById(id), BIOME);
biomes[i] = Objects.requireNonNullElse(BIOME_MANAGER.getById(id), BIOME); chunk.setBiome(0, 0, 0, biome);
} }
} else {
biomes = new Biome[1024]; // TODO don't hardcode
Arrays.fill(biomes, BIOME);
} }
// Blocks // Blocks
loadBlocks(chunk, fileChunk); loadBlocks(chunk, fileChunk);