diff --git a/src/main/java/com/seibel/lod/builders/LodChunkBuilder.java b/src/main/java/com/seibel/lod/builders/LodChunkBuilder.java index 42987b5ca..06d929d97 100644 --- a/src/main/java/com/seibel/lod/builders/LodChunkBuilder.java +++ b/src/main/java/com/seibel/lod/builders/LodChunkBuilder.java @@ -50,7 +50,7 @@ import net.minecraft.world.gen.Heightmap; * (specifically: Lod World, Dimension, Region, and Chunk objects) * * @author James Seibel - * @version 7-25-2021 + * @version 7-26-2021 */ public class LodChunkBuilder { @@ -64,6 +64,13 @@ public class LodChunkBuilder public static final int CHUNK_SECTION_HEIGHT = LodChunk.WIDTH; + + // reminder now how to access biome info +// String name = biome.getRegistryName().getPath(); +// String deepColdName = Biomes.DEEP_COLD_OCEAN.location().getPath(); +// Biome deepCold = WorldGenRegistries.BIOME.get(Biomes.DEEP_COLD_OCEAN); + + public LodChunkBuilder() { @@ -334,7 +341,7 @@ public class LodChunkBuilder * If true use biome foliage, water, and grass colors,
* otherwise only use the block's material color */ - private Color generateLodColorForArea(IChunk chunk, LodBuilderConfig config, int startX, int startZ, int endX, int endZ) + private Color generateLodColorForArea(IChunk chunk, LodBuilderConfig config, int startX, int startZ, int endX, int endZ) { ChunkSection[] chunkSections = chunk.getSections(); @@ -374,7 +381,8 @@ public class LodChunkBuilder if (config.useBiomeColors) { - Biome biome = chunk.getBiomes().getNoiseBiome(x, y + i * chunkSections.length, z); + // the bit shift is equivalent to dividing by 4 + Biome biome = chunk.getBiomes().getNoiseBiome(x >> 2, y + i * chunkSections.length >> 2, z >> 2); if (biome.getBiomeCategory() == Biome.Category.OCEAN || biome.getBiomeCategory() == Biome.Category.RIVER) @@ -414,7 +422,9 @@ public class LodChunkBuilder } else { - Biome biome = chunk.getBiomes().getNoiseBiome(x, y + i * chunkSections.length, z); + // I have no idea why I need to bit shift to the right, but + // if I don't the biomes don't show up correctly. + Biome biome = chunk.getBiomes().getNoiseBiome(x >> 2, y + i * chunkSections.length >> 2, z >> 2); colorInt = getColorForBlock(x,z, blockState, biome); } @@ -434,7 +444,6 @@ public class LodChunkBuilder } } } - } } diff --git a/src/main/java/com/seibel/lod/builders/worldGeneration/LodChunkGenWorker.java b/src/main/java/com/seibel/lod/builders/worldGeneration/LodChunkGenWorker.java index 7d849e3ea..a72e76c72 100644 --- a/src/main/java/com/seibel/lod/builders/worldGeneration/LodChunkGenWorker.java +++ b/src/main/java/com/seibel/lod/builders/worldGeneration/LodChunkGenWorker.java @@ -69,7 +69,7 @@ import net.minecraftforge.common.WorldWorkerManager.IWorker; * This is used to generate a LodChunk at a given ChunkPos. * * @author James Seibel - * @version 7-25-2021 + * @version 7-26-2021 */ public class LodChunkGenWorker implements IWorker { @@ -263,7 +263,7 @@ public class LodChunkGenWorker implements IWorker // these heights are of course aren't super accurate, // they are just to simulate height data where there isn't any - switch(chunk.getBiomes().getNoiseBiome(x, seaLevel, z).getBiomeCategory()) + switch(chunk.getBiomes().getNoiseBiome(x >> 2, seaLevel >> 2, z >> 2).getBiomeCategory()) { case NETHER: heightmap.setHeight(x, z, serverWorld.getHeight() / 2); @@ -400,7 +400,7 @@ public class LodChunkGenWorker implements IWorker { for (int z = 0; z < LodChunk.WIDTH; z++) { - Biome biome = chunk.getBiomes().getNoiseBiome(x, serverWorld.getSeaLevel(), z); + Biome biome = chunk.getBiomes().getNoiseBiome(x >> 2, serverWorld.getSeaLevel() >> 2, z >> 2); // Issue #35 // For some reason Jungle biomes cause incredible lag diff --git a/src/main/java/com/seibel/lod/builders/worldGeneration/LodServerWorld.java b/src/main/java/com/seibel/lod/builders/worldGeneration/LodServerWorld.java index 86270b44e..cdb55aed0 100644 --- a/src/main/java/com/seibel/lod/builders/worldGeneration/LodServerWorld.java +++ b/src/main/java/com/seibel/lod/builders/worldGeneration/LodServerWorld.java @@ -67,7 +67,7 @@ import net.minecraft.world.storage.IWorldInfo; * to multithread generation. * * @author James Seibel - * @version 7-4-2021 + * @version 7-26-2021 */ public class LodServerWorld implements ISeedReader { @@ -101,7 +101,7 @@ public class LodServerWorld implements ISeedReader { @Override public Biome getBiome(BlockPos pos) { - return chunk.getBiomes().getNoiseBiome(pos.getX(), pos.getY(), pos.getZ()); + return chunk.getBiomes().getNoiseBiome(pos.getX() >> 2, pos.getY() >> 2, pos.getZ() >> 2); } @Override diff --git a/src/main/java/com/seibel/lod/enums/LodDetail.java b/src/main/java/com/seibel/lod/enums/LodDetail.java index 86313c3b1..e94ad72a0 100644 --- a/src/main/java/com/seibel/lod/enums/LodDetail.java +++ b/src/main/java/com/seibel/lod/enums/LodDetail.java @@ -23,7 +23,7 @@ import com.seibel.lod.objects.LodDataPoint; * single, double, quad, half, full * * @author James Seibel - * @version 06-13-2021 + * @version 07-26-2021 */ public enum LodDetail { @@ -75,12 +75,6 @@ public enum LodDetail offset = newOffset; -// if(newLengthCount == LodChunk.WIDTH) -// { -// // this is to prevent overflow -// newLengthCount = LodChunk.WIDTH - 1; -// } - startX = new int[dataPointLengthCount * dataPointLengthCount]; endX = new int[dataPointLengthCount * dataPointLengthCount];