fix 2 more migration issues

This commit is contained in:
Jake Potrebic 2022-06-09 18:40:07 -07:00
parent cfe3ad1b0f
commit 02b5ec4c78
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
2 changed files with 10 additions and 9 deletions

View File

@ -3067,7 +3067,7 @@ index 0000000000000000000000000000000000000000..75f612b04f872d0d014fdc40b07c1511
+} +}
diff --git a/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java b/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java diff --git a/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java b/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..749498b349a0504270e2ba84fd8f30bd749833a7 index 0000000000000000000000000000000000000000..4861470fee09c757874c02a2abbdf56e25404c2f
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java +++ b/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java
@@ -0,0 +1,321 @@ @@ -0,0 +1,321 @@
@ -3204,7 +3204,7 @@ index 0000000000000000000000000000000000000000..749498b349a0504270e2ba84fd8f30bd
+ 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) -> {

View File

@ -1713,10 +1713,10 @@ index 0000000000000000000000000000000000000000..058fb5a41565e6ce2acbd1f4d071a1b8
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..5b3ef259cf1bff7b23654c2a3e9fc96a7ebc9a03 index 0000000000000000000000000000000000000000..af40e473521f408aa0e112953c43bdbce164a48b
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java +++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java
@@ -0,0 +1,534 @@ @@ -0,0 +1,535 @@
+package com.destroystokyo.paper.io.chunk; +package com.destroystokyo.paper.io.chunk;
+ +
+import com.destroystokyo.paper.io.PaperFileIOThread; +import com.destroystokyo.paper.io.PaperFileIOThread;
@ -1851,12 +1851,13 @@ index 0000000000000000000000000000000000000000..5b3ef259cf1bff7b23654c2a3e9fc96a
+ } + }
+ +
+ 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..5b3ef259cf1bff7b23654c2a3e9fc96a
+ 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);
+ } + }
+ } + }
+ +