Fixed: Включена многопоточность Updatable

This commit is contained in:
Reider745
2024-07-22 07:20:40 +03:00
parent 4438da8c02
commit 99cbbc4974
5 changed files with 18 additions and 6 deletions
@@ -341,10 +341,12 @@ public class InnerCoreServer {
}
public void start() {
for(File file : Objects.requireNonNull(new File(InnerCoreServer.dataPath, "behavior_packs").listFiles())) {
BehaviorPack pack = new BehaviorPack(file.getAbsolutePath());
pack.load();
}
try{
for(File file : Objects.requireNonNull(new File(InnerCoreServer.dataPath, "behavior_packs").listFiles())) {
BehaviorPack pack = new BehaviorPack(file.getAbsolutePath());
pack.load();
}
}catch (Exception e){}
}
public static Object getProperty(String variable) {
@@ -472,6 +474,10 @@ public class InnerCoreServer {
return getPropertyInt("max-packet-sending", 200);
}
public static int getAdditionalThreadCount() {
return getPropertyInt("threading_additional_thread_count", 16);
}
public static boolean isUnsupportedOptionsAllowed() {
return getPropertyBoolean("allow-unsupported-options", false);
}
@@ -187,7 +187,7 @@ public class NativeCallback {
// read config and setup thread priorities
private static void setupThreadPriorityFromConfig() {
TickExecutor.getInstance()
.setAdditionalThreadCount(InnerCoreConfig.getInt("threading.additional_thread_count", 0));
.setAdditionalThreadCount(InnerCoreServer.getAdditionalThreadCount());
// we divide by 4 to fit into standard 1-40 priority range
TickExecutor.getInstance()
.setAdditionalThreadPriority(InnerCoreConfig.getInt("threading.additional_thread_priority", 12) / 4);
@@ -22,7 +22,7 @@ public class TickExecutor {
}
public void setAdditionalThreadCount(int count) {
count = Math.max(0, Math.min(7, count));
count = Math.max(0, Math.min(16, count));
if (threadCount != count) {
threadCount = count;
if (executor != null) {