From 8133620fcf463acad44776b7a260c032fa7770d0 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 26 May 2022 20:28:28 -0500 Subject: [PATCH] Add a couple missing helper methods to the config --- .../java/com/seibel/lod/core/config/Config.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/seibel/lod/core/config/Config.java b/src/main/java/com/seibel/lod/core/config/Config.java index 6a028f4e7..e70329875 100644 --- a/src/main/java/com/seibel/lod/core/config/Config.java +++ b/src/main/java/com/seibel/lod/core/config/Config.java @@ -699,7 +699,21 @@ public class Config + " so if they add up to more threads than your CPU has cores, \n" + " that shouldn't cause an issue.") .build(); - + + /** Returns the number of threads that can be used to generate terrain */ + public static int getWorldGenerationThreadPoolSize() + { + return numberOfWorldGenerationThreads.get() < 1 ? + 1 : (int) Math.ceil(numberOfWorldGenerationThreads.get()); + } + /** Returns how often world generator threads should run as a number between 0.0 and 1.0 */ + public static double getWorldGenerationPartialRunTime() + { + return numberOfWorldGenerationThreads.get() > 1 ? + 1.0 : numberOfWorldGenerationThreads.get(); + } + + public static ConfigEntry numberOfBufferBuilderThreads = new ConfigEntry.Builder() .setMinDefaultMax(1, Math.min(Runtime.getRuntime().availableProcessors()/2, 2),