Resize worlds
This commit is contained in:
@@ -57,7 +57,7 @@ public abstract class Akari {
|
||||
/**
|
||||
* A common tick pool
|
||||
*/
|
||||
public static final ExecutorCompletionService<?> STAGE_TICK = new ExecutorCompletionService<>(Executors.newFixedThreadPool(4, new AssignableFactory()));
|
||||
public static ExecutorCompletionService<?> STAGE_TICK;
|
||||
|
||||
public static boolean isPrimaryThread() {
|
||||
return isPrimaryThread(true);
|
||||
|
||||
@@ -41,6 +41,7 @@ import net.minecraft.server.WorldServer;
|
||||
@Mixin(value = MinecraftServer.class, remap = false)
|
||||
public abstract class MixinMinecraftServer {
|
||||
@Shadow @Final public Thread primaryThread;
|
||||
private int cachedWorlds;
|
||||
|
||||
@Overwrite
|
||||
public String getServerModName() {
|
||||
@@ -53,6 +54,8 @@ public abstract class MixinMinecraftServer {
|
||||
shift = At.Shift.BEFORE
|
||||
))
|
||||
private void prerun(CallbackInfo info) {
|
||||
Akari.STAGE_TICK = new ExecutorCompletionService<>(Executors.newFixedThreadPool((cachedWorlds = worlds.size()), new AssignableFactory()));
|
||||
|
||||
primaryThread.setPriority(AkarinGlobalConfig.primaryThreadPriority < Thread.NORM_PRIORITY ? Thread.NORM_PRIORITY :
|
||||
(AkarinGlobalConfig.primaryThreadPriority > Thread.MAX_PRIORITY ? 10 : AkarinGlobalConfig.primaryThreadPriority));
|
||||
|
||||
@@ -178,6 +181,8 @@ public abstract class MixinMinecraftServer {
|
||||
|
||||
@Overwrite
|
||||
public void D() throws InterruptedException {
|
||||
if (worlds.size() != cachedWorlds) Akari.STAGE_TICK = new ExecutorCompletionService<>(Executors.newFixedThreadPool(cachedWorlds, new AssignableFactory())); // Resize
|
||||
|
||||
Runnable runnable;
|
||||
MinecraftTimings.bukkitSchedulerTimer.startTiming();
|
||||
this.server.getScheduler().mainThreadHeartbeat(this.ticks);
|
||||
|
||||
Reference in New Issue
Block a user