fix 2 more migration issues

This commit is contained in:
Jake Potrebic
2022-06-09 18:40:07 -07:00
parent d8a7b12368
commit b347f25afc
2 changed files with 7 additions and 6 deletions

View File

@@ -1851,12 +1851,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ public static void processConfiguration(GlobalConfiguration.AsyncChunks config) { + public static void processConfiguration(GlobalConfiguration.AsyncChunks config) {
+ int threads = config.threads; // don't write back to config
+ int cpus = Runtime.getRuntime().availableProcessors() / 2; + int cpus = Runtime.getRuntime().availableProcessors() / 2;
+ if (config.threads <= 0) { + if (threads <= 0) {
+ if (cpus <= 4) { + if (cpus <= 4) {
+ config.threads = cpus <= 2 ? 1 : 2; + threads = cpus <= 2 ? 1 : 2;
+ } else { + } else {
+ config.threads = (int) Math.min(Integer.getInteger("paper.maxChunkThreads", 4), cpus / 2); + threads = (int) Math.min(Integer.getInteger("paper.maxChunkThreads", 4), cpus / 2);
+ } + }
+ } + }
+ if (cpus == 1 && !Boolean.getBoolean("Paper.allowAsyncChunksSingleCore")) { + if (cpus == 1 && !Boolean.getBoolean("Paper.allowAsyncChunksSingleCore")) {
@@ -1869,12 +1870,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ String sharedHostThreads = System.getenv("PAPER_ASYNC_CHUNKS_SHARED_HOST_THREADS"); + String sharedHostThreads = System.getenv("PAPER_ASYNC_CHUNKS_SHARED_HOST_THREADS");
+ if (sharedHostThreads != null) { + if (sharedHostThreads != null) {
+ try { + try {
+ config.threads = Math.max(1, Math.min(config.threads, Integer.parseInt(sharedHostThreads))); + threads = Math.max(1, Math.min(threads, Integer.parseInt(sharedHostThreads)));
+ } catch (NumberFormatException ignored) {} + } catch (NumberFormatException ignored) {}
+ } + }
+ +
+ if (config.asyncChunks) { + if (config.asyncChunks) {
+ ChunkTaskManager.initGlobalLoadThreads(config.threads); + ChunkTaskManager.initGlobalLoadThreads(threads);
+ } + }
+ } + }
+ +

View File

@@ -3204,7 +3204,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ value.node("loot-tables").set(prevValue); + value.node("loot-tables").set(prevValue);
+ return path.with(path.size() - 1, "treasure-maps-find-already-discovered").array(); + return path.with(path.size() - 1, "treasure-maps-find-already-discovered").array();
+ }) + })
+ .addAction(path("alt-item-despawn-rate"), (path, value) -> { + .addAction(path("alt-item-despawn-rate", "items"), (path, value) -> {
+ if (value.isMap()) { + if (value.isMap()) {
+ Map<String, Integer> rebuild = new HashMap<>(); + Map<String, Integer> rebuild = new HashMap<>();
+ value.childrenMap().forEach((key, node) -> { + value.childrenMap().forEach((key, node) -> {