Start world gen refactoring
This commit is contained in:
@@ -54,7 +54,7 @@ public class BatchGenerator implements IDhApiWorldGenerator
|
||||
* if this is too high it may cause issues when moving,
|
||||
* but if it is too low the generator threads won't have enough tasks to work on
|
||||
*/
|
||||
private static final int MAX_QUEUED_TASKS = 3;
|
||||
private static final int MAX_QUEUED_TASKS_PER_THREAD = 3;
|
||||
|
||||
public AbstractBatchGenerationEnvironmentWrapper generationEnvironment;
|
||||
public IDhLevel targetDhLevel;
|
||||
@@ -150,7 +150,9 @@ public class BatchGenerator implements IDhApiWorldGenerator
|
||||
@Override
|
||||
public boolean isBusy()
|
||||
{
|
||||
return this.generationEnvironment.getEventCount() > Math.max(Config.Client.Advanced.MultiThreading.numberOfWorldGenerationThreads.get().intValue(), 1) * MAX_QUEUED_TASKS;
|
||||
int worldGenThreadCount = Math.max(Config.Client.Advanced.MultiThreading.numberOfWorldGenerationThreads.get(), 1);
|
||||
int maxWorldGenTaskCount = worldGenThreadCount * MAX_QUEUED_TASKS_PER_THREAD;
|
||||
return this.generationEnvironment.getEventCount() > maxWorldGenTaskCount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+25
-19
@@ -220,18 +220,6 @@ public class WorldGenerationQueue implements IWorldGenerationQueue, IDebugRender
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static class Mapper
|
||||
{
|
||||
public final WorldGenTask task;
|
||||
public final int dist;
|
||||
public Mapper(WorldGenTask task, int dist)
|
||||
{
|
||||
this.task = task;
|
||||
this.dist = dist;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param targetPos the position to center the generation around
|
||||
@@ -549,6 +537,19 @@ public class WorldGenerationQueue implements IWorldGenerationQueue, IDebugRender
|
||||
|
||||
|
||||
|
||||
//=======//
|
||||
// debug //
|
||||
//=======//
|
||||
|
||||
@Override
|
||||
public void debugRender(DebugRenderer renderer)
|
||||
{
|
||||
this.waitingTasks.keySet().forEach((pos) -> { renderer.renderBox(new DebugRenderer.Box(pos, -32f, 64f, 0.05f, Color.blue)); });
|
||||
this.inProgressGenTasksByLodPos.forEach((pos, t) -> { renderer.renderBox(new DebugRenderer.Box(pos, -32f, 64f, 0.05f, Color.red)); });
|
||||
}
|
||||
|
||||
|
||||
|
||||
//================//
|
||||
// helper methods //
|
||||
//================//
|
||||
@@ -586,15 +587,20 @@ public class WorldGenerationQueue implements IWorldGenerationQueue, IDebugRender
|
||||
|
||||
|
||||
|
||||
//=======//
|
||||
// debug //
|
||||
//=======//
|
||||
//================//
|
||||
// helper classes //
|
||||
//================//
|
||||
|
||||
@Override
|
||||
public void debugRender(DebugRenderer renderer)
|
||||
private static class Mapper
|
||||
{
|
||||
this.waitingTasks.keySet().forEach((pos) -> { renderer.renderBox(new DebugRenderer.Box(pos, -32f, 64f, 0.05f, Color.blue)); });
|
||||
this.inProgressGenTasksByLodPos.forEach((pos, t) -> { renderer.renderBox(new DebugRenderer.Box(pos, -32f, 64f, 0.05f, Color.red)); });
|
||||
public final WorldGenTask task;
|
||||
public final int dist;
|
||||
public Mapper(WorldGenTask task, int dist)
|
||||
{
|
||||
this.task = task;
|
||||
this.dist = dist;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user