From 5d4d6345372e3ddc7f8beb4e8dc46c11f877e0cf Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 26 Aug 2021 19:31:33 -0500 Subject: [PATCH] Re-add the Number Of World Generation Threads config option --- .../lod/builders/worldGeneration/LodNodeGenWorker.java | 9 +++++---- .../lod/builders/worldGeneration/LodWorldGenerator.java | 8 +++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/seibel/lod/builders/worldGeneration/LodNodeGenWorker.java b/src/main/java/com/seibel/lod/builders/worldGeneration/LodNodeGenWorker.java index 9b90718f4..67745a963 100644 --- a/src/main/java/com/seibel/lod/builders/worldGeneration/LodNodeGenWorker.java +++ b/src/main/java/com/seibel/lod/builders/worldGeneration/LodNodeGenWorker.java @@ -70,15 +70,16 @@ import net.minecraftforge.common.WorldWorkerManager.IWorker; * This is used to generate a LodChunk at a given ChunkPos. * * @author James Seibel - * @version 8-24-2021 + * @version 8-26-2021 */ public class LodNodeGenWorker implements IWorker { - public static ExecutorService genThreads = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), new LodThreadFactory(LodNodeGenWorker.class.getSimpleName())); + public static ExecutorService genThreads = Executors.newFixedThreadPool(LodConfig.CLIENT.numberOfWorldGenerationThreads.get(), new LodThreadFactory(LodNodeGenWorker.class.getSimpleName())); private boolean threadStarted = false; private LodChunkGenThread thread; - + + /** If a configured feature fails for whatever reason, * add it to this list, this is to hopefully remove any * features that could cause issues down the line. */ @@ -635,7 +636,7 @@ public class LodNodeGenWorker implements IWorker { genThreads.shutdownNow(); } - genThreads = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), new LodThreadFactory(LodNodeGenWorker.class.getSimpleName())); + genThreads = Executors.newFixedThreadPool(LodConfig.CLIENT.numberOfWorldGenerationThreads.get(), new LodThreadFactory(LodNodeGenWorker.class.getSimpleName())); } diff --git a/src/main/java/com/seibel/lod/builders/worldGeneration/LodWorldGenerator.java b/src/main/java/com/seibel/lod/builders/worldGeneration/LodWorldGenerator.java index 0338e681a..fa006bbac 100644 --- a/src/main/java/com/seibel/lod/builders/worldGeneration/LodWorldGenerator.java +++ b/src/main/java/com/seibel/lod/builders/worldGeneration/LodWorldGenerator.java @@ -13,8 +13,8 @@ import com.seibel.lod.builders.GenerationRequest; import com.seibel.lod.builders.LodBuilder; import com.seibel.lod.enums.DistanceGenerationMode; import com.seibel.lod.handlers.LodConfig; -import com.seibel.lod.objects.LevelPos.LevelPos; import com.seibel.lod.objects.LodDimension; +import com.seibel.lod.objects.LevelPos.LevelPos; import com.seibel.lod.render.LodRenderer; import com.seibel.lod.util.DetailDistanceUtil; import com.seibel.lod.util.LodThreadFactory; @@ -83,10 +83,8 @@ public class LodWorldGenerator // the thread is now running, don't queue up another thread generatorThreadRunning = true; - // just in case the config is changed - - //maxChunkGenRequests = LodConfig.CLIENT.numberOfWorldGenerationThreads.get() * 8; - maxChunkGenRequests = Runtime.getRuntime().availableProcessors() * 8; + // just in case the config changed + maxChunkGenRequests = LodConfig.CLIENT.numberOfWorldGenerationThreads.get() * 8; Thread generatorThread = new Thread(() -> {