Add a couple missing helper methods to the config

This commit is contained in:
James Seibel
2022-05-26 20:28:28 -05:00
parent 1182a0cac3
commit 8133620fcf
@@ -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<Integer> numberOfBufferBuilderThreads = new ConfigEntry.Builder<Integer>()
.setMinDefaultMax(1,
Math.min(Runtime.getRuntime().availableProcessors()/2, 2),