From 39d129e85f45affcce194cead53ac3c7992e9f40 Mon Sep 17 00:00:00 2001 From: Fabrizio La Rosa Date: Thu, 2 Jul 2020 14:44:18 +0200 Subject: [PATCH] Comments in biome updating --- .../com/songoda/skyblock/biome/BiomeManager.java | 13 +++++++------ .../skyblock/world/generator/VoidGenerator.java | 11 ++++++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/songoda/skyblock/biome/BiomeManager.java b/src/main/java/com/songoda/skyblock/biome/BiomeManager.java index c32e20d9..1ff62dc4 100644 --- a/src/main/java/com/songoda/skyblock/biome/BiomeManager.java +++ b/src/main/java/com/songoda/skyblock/biome/BiomeManager.java @@ -48,7 +48,7 @@ public class BiomeManager { ChunkLoader.startChunkLoadingPerChunk(island, IslandWorld.Normal, skyblock.isPaperAsync(), (asyncChunk, syncChunk) -> { Chunk chunk = asyncChunk.join(); if(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)){ // TODO Should be 1.15 but it works fine there - setChunkBiome3D(island, biome, chunk); + setChunkBiome2D(island, biome, chunk); // 2D for the moment } else { setChunkBiome2D(island, biome, chunk); } @@ -63,7 +63,7 @@ public class BiomeManager { Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> { for(Chunk chunk : syncChunks){ if(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)){ // TODO Should be 1.15 but it works fine there - setChunkBiome3D(island, biome, chunk); + setChunkBiome2D(island, biome, chunk); // 2D for the moment } else { setChunkBiome2D(island, biome, chunk); } @@ -89,14 +89,15 @@ public class BiomeManager { updateBiomePacket(island, chunk); } + // Do not use - Too laggy private void setChunkBiome3D(Island island, Biome biome, Chunk chunk) { for(int x = 0; x < 16; x++){ for(int z = 0; z < 16; z++){ - //for(int y = 0; y<256; y++){ - if(!chunk.getWorld().getBiome(x, 0, z).equals(biome)){ - chunk.getWorld().setBiome(x, 0, z, biome); + for(int y = 0; y<256; y++){ + if(!chunk.getWorld().getBiome(x, y, z).equals(biome)){ + chunk.getWorld().setBiome(x, y, z, biome); } - //} + } } } updateBiomePacket(island, chunk); diff --git a/src/main/java/com/songoda/skyblock/world/generator/VoidGenerator.java b/src/main/java/com/songoda/skyblock/world/generator/VoidGenerator.java index 934d1556..d02ce517 100644 --- a/src/main/java/com/songoda/skyblock/world/generator/VoidGenerator.java +++ b/src/main/java/com/songoda/skyblock/world/generator/VoidGenerator.java @@ -30,7 +30,7 @@ public class VoidGenerator extends ChunkGenerator { final ConfigurationSection worldSection = configLoad.getConfigurationSection("Island.World"); if(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { // TODO Should be 1.15 but it works fine there - setChunkBiome3D(CompatibleBiome.valueOf(configLoad + setChunkBiome2D(CompatibleBiome.valueOf(configLoad // 2D for the moment .getString("Island.Biome.Default.Type").toUpperCase()).getBiome(), biomeGrid); } else { setChunkBiome2D(CompatibleBiome.valueOf(configLoad @@ -84,14 +84,15 @@ public class VoidGenerator extends ChunkGenerator { } } + // Do not use - Too laggy private void setChunkBiome3D(Biome biome, BiomeGrid grid) { for(int x = 0; x < 16; x++){ for(int z = 0; z < 16; z++){ - //for(int y = 0; y<256; y++){ - if(!grid.getBiome(x, 0, z).equals(biome)){ - grid.setBiome(x, 0, z, biome); + for(int y = 0; y<256; y++){ + if(!grid.getBiome(x, y, z).equals(biome)){ + grid.setBiome(x, y, z, biome); } - //} + } } } }