Re-add the Number Of World Generation Threads config option

This commit is contained in:
James Seibel
2021-08-26 19:31:33 -05:00
parent e1149be7c1
commit 5d4d634537
2 changed files with 8 additions and 9 deletions
@@ -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()));
}
@@ -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(() ->
{