mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-23 01:17:44 +01:00
Fix compile issues
This commit is contained in:
parent
7e9da43b33
commit
813cfbf2b0
@ -18392,7 +18392,7 @@ index 2d9d4d06b75873f888ef4d8f5779a52706f821a8..f74efe41cd0da2f9749fc96fb9e0f7cf
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 7dfbb3dd6100180abd2ebab4d1e9e34928666f9e..877f9d7a83fa817586f9f2dd2b10e06e9962b7c8 100644
|
index 7dfbb3dd6100180abd2ebab4d1e9e34928666f9e..7f8793fa8260cb8a1f55d0ba405e6df0ae6f7321 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -199,7 +199,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -199,7 +199,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
@ -18733,7 +18733,7 @@ index 7dfbb3dd6100180abd2ebab4d1e9e34928666f9e..877f9d7a83fa817586f9f2dd2b10e06e
|
|||||||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||||
- EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver);
|
- EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver);
|
||||||
+ this.entityStorage = new EntityRegionFileStorage(convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), flag2); // Paper - rewrite chunk system // EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver);
|
+ this.entityStorage = new EntityRegionFileStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), flag2); // Paper - rewrite chunk system
|
||||||
|
|
||||||
- this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage);
|
- this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage);
|
||||||
+ // this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage, this.entitySliceManager); // Paper // Paper - rewrite chunk system
|
+ // this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage, this.entitySliceManager); // Paper // Paper - rewrite chunk system
|
||||||
@ -19475,6 +19475,24 @@ index ea72dcb064a35bc6245bc5c94d592efedd8faf41..0793dfe47e68a2b48b010aad5b12dcfa
|
|||||||
@Override
|
@Override
|
||||||
public boolean remove(Object object) {
|
public boolean remove(Object object) {
|
||||||
int i = this.findIndex((T)object);
|
int i = this.findIndex((T)object);
|
||||||
|
diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||||
|
index 7984f17cd9c4cef8100909b6c33b3144c8096fcf..639f72618a7c22fa94effa9d0406b97fffc64cb5 100644
|
||||||
|
--- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||||
|
+++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||||
|
@@ -227,7 +227,13 @@ public class WorldUpgrader {
|
||||||
|
this.previousWriteFuture.join();
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Paper start - async chunk io
|
||||||
|
+ try {
|
||||||
|
this.previousWriteFuture = storage.write(chunkPos, nbttagcompound1);
|
||||||
|
+ } catch (final IOException e) {
|
||||||
|
+ com.destroystokyo.paper.util.SneakyThrow.sneaky(e);
|
||||||
|
+ }
|
||||||
|
+ // Paper end - async chunk io
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index 3c1bcf8d1a07b35a8688160c9f05f792451338a3..03840f520624662d4ce3ac9f3065a01c71b5f299 100644
|
index 3c1bcf8d1a07b35a8688160c9f05f792451338a3..03840f520624662d4ce3ac9f3065a01c71b5f299 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
@ -76,7 +76,7 @@ index f74efe41cd0da2f9749fc96fb9e0f7cf237ad1c6..d1728e13a7b649f308bde90ab633c79d
|
|||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 877f9d7a83fa817586f9f2dd2b10e06e9962b7c8..412e167f6e29cbe905161c7e00736961f2c56c21 100644
|
index 7f8793fa8260cb8a1f55d0ba405e6df0ae6f7321..db6a54c752ac39012537ec85ad31d5c8b886be1a 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -1302,6 +1302,37 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -1302,6 +1302,37 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@ -13,7 +13,7 @@ custom renderers are in use, defaulting to the much simpler Vanilla system.
|
|||||||
Additionally, numerous issues to player position tracking on maps has been fixed.
|
Additionally, numerous issues to player position tracking on maps has been fixed.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 412e167f6e29cbe905161c7e00736961f2c56c21..3203f95b8a877efb752fe2e6c58da6df9c8eede7 100644
|
index db6a54c752ac39012537ec85ad31d5c8b886be1a..5285cc76b001a8b5fd5e11764a3aa11e45c9d999 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -2588,6 +2588,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -2588,6 +2588,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@ -17,7 +17,7 @@ Adds villagers as separate config
|
|||||||
public net.minecraft.world.entity.Entity isInsidePortal
|
public net.minecraft.world.entity.Entity isInsidePortal
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 3203f95b8a877efb752fe2e6c58da6df9c8eede7..246c5d3e04044f5c5802ec5134dc69b8d8403a1a 100644
|
index 5285cc76b001a8b5fd5e11764a3aa11e45c9d999..b7ca39623348090c5b85e2d80f67a1747553d7d7 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -2,7 +2,6 @@ package net.minecraft.server.level;
|
@@ -2,7 +2,6 @@ package net.minecraft.server.level;
|
@ -1104,7 +1104,7 @@ index 183b2191fa1c1b27adedf39593e1b5a223fb1279..8ead66c134688b11dca15f6509147e72
|
|||||||
|
|
||||||
private ClientboundLevelChunkWithLightPacket(RegistryFriendlyByteBuf buf) {
|
private ClientboundLevelChunkWithLightPacket(RegistryFriendlyByteBuf buf) {
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 246c5d3e04044f5c5802ec5134dc69b8d8403a1a..885c64bd58de40b8fd03725f23cdbd0714a8cc69 100644
|
index b7ca39623348090c5b85e2d80f67a1747553d7d7..bc609da7105293dfa4ed339f553be66b0a632698 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -575,7 +575,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -575,7 +575,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@ -24,7 +24,7 @@ index c7b7f153895a4b95b2071a31db00c9c4b69fa094..0b7a38b9e92b19345a34c6226413a9b1
|
|||||||
|
|
||||||
// CraftBukkit start - modelled on below
|
// CraftBukkit start - modelled on below
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 885c64bd58de40b8fd03725f23cdbd0714a8cc69..75dc2f98cc2c723db01135a3a42f346a70c78208 100644
|
index bc609da7105293dfa4ed339f553be66b0a632698..4b7cad5f551d620dbd091111df94fb39efcb79ac 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -1330,7 +1330,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -1330,7 +1330,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
@ -61,7 +61,7 @@ index 885c64bd58de40b8fd03725f23cdbd0714a8cc69..75dc2f98cc2c723db01135a3a42f346a
|
|||||||
|
|
||||||
public <T extends Entity> List<? extends T> getEntities(EntityTypeTest<Entity, T> filter, Predicate<? super T> predicate) {
|
public <T extends Entity> List<? extends T> getEntities(EntityTypeTest<Entity, T> filter, Predicate<? super T> predicate) {
|
||||||
diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||||
index 7984f17cd9c4cef8100909b6c33b3144c8096fcf..868c9bbb12c8cfe76abb62774cf08102b727063b 100644
|
index 639f72618a7c22fa94effa9d0406b97fffc64cb5..3e582c49069f2a820ba3baac03917493877d9875 100644
|
||||||
--- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
--- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||||
+++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
+++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||||
@@ -116,7 +116,13 @@ public class WorldUpgrader {
|
@@ -116,7 +116,13 @@ public class WorldUpgrader {
|
@ -123,7 +123,7 @@ index 0b7a38b9e92b19345a34c6226413a9b133264077..18640c8681f6a3b2276123d19e3e8f0a
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 75dc2f98cc2c723db01135a3a42f346a70c78208..54dcd9025b284dddc71b6821723be64d6e339613 100644
|
index 4b7cad5f551d620dbd091111df94fb39efcb79ac..9cd54bc390f0629bf6b4494bd9c3a6e0927d1b7b 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -221,6 +221,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -221,6 +221,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@ -90,7 +90,7 @@ index 0000000000000000000000000000000000000000..7d93652c1abbb6aee6eb7c26cf35d4d0
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 54dcd9025b284dddc71b6821723be64d6e339613..3aeaf62226ba0a4df3445b966fccdb4e2abb9c8a 100644
|
index 9cd54bc390f0629bf6b4494bd9c3a6e0927d1b7b..215f03dfe0e6441588679efaedbcf04c352b404c 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -867,6 +867,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -867,6 +867,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@ -76,7 +76,7 @@ index e161ad0f53a21a68e8c78575ba5d3cdbdb11fca0..57e76b53e5e314c3e6b8856010f7a841
|
|||||||
});
|
});
|
||||||
throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD;
|
throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD;
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 3aeaf62226ba0a4df3445b966fccdb4e2abb9c8a..8fcc14a2e7ebc5261948c9ad71965bdd9cfe6dc1 100644
|
index 215f03dfe0e6441588679efaedbcf04c352b404c..aabaaf89f5e344791604a7e05122d9865bb0224e 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -1251,7 +1251,26 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -1251,7 +1251,26 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@ -2009,7 +2009,7 @@ index 0000000000000000000000000000000000000000..33cd90c30c22200a4e1ae64f40a0bf78
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 8fcc14a2e7ebc5261948c9ad71965bdd9cfe6dc1..285580485b60ca4cd95a5d8ff807cb05dbe38d39 100644
|
index aabaaf89f5e344791604a7e05122d9865bb0224e..2bfebbe0bc5a7f72c9ebe60fded260b3f94ac749 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -228,6 +228,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -228,6 +228,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@ -28,7 +28,7 @@ index 1adcbfb16ea1fe3378cde7c53e8868840eade963..5f3b35f0dbd9e78ad18ef5cf7be1a807
|
|||||||
this.profiler.push(() -> {
|
this.profiler.push(() -> {
|
||||||
String s = String.valueOf(worldserver);
|
String s = String.valueOf(worldserver);
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 285580485b60ca4cd95a5d8ff807cb05dbe38d39..5d79cabecc29b15ec4e71589fdbb7dc5d658d327 100644
|
index 2bfebbe0bc5a7f72c9ebe60fded260b3f94ac749..89ecaaa774e59ad01eec0ce2fe546026a8b47ae8 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -570,6 +570,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -570,6 +570,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@ -8,7 +8,7 @@ we can instead use the nearby player tracking system to reduce
|
|||||||
the number of tests per search.
|
the number of tests per search.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 5d79cabecc29b15ec4e71589fdbb7dc5d658d327..901a764a8c3ae5259fdc4729d22c9986361d39a8 100644
|
index 89ecaaa774e59ad01eec0ce2fe546026a8b47ae8..12a9342634ffa7d6aaa9a7fdd65a45bccec8dd13 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -581,6 +581,115 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -581,6 +581,115 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@ -33,15 +33,17 @@ public net.minecraft.util.worldupdate.WorldUpgrader REGEX
|
|||||||
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
|
diff --git a/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..90498d9a4f5aee0f6c8a202b5580b4260a28b378
|
index 0000000000000000000000000000000000000000..e049fbe4038aaea896f45b11ce9ce8f05922c898
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
|
+++ b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
|
||||||
@@ -0,0 +1,212 @@
|
@@ -0,0 +1,222 @@
|
||||||
+package io.papermc.paper.world;
|
+package io.papermc.paper.world;
|
||||||
+
|
+
|
||||||
+import com.mojang.datafixers.DataFixer;
|
+import com.mojang.datafixers.DataFixer;
|
||||||
+import com.mojang.serialization.Codec;
|
+import com.mojang.serialization.MapCodec;
|
||||||
+import net.minecraft.SharedConstants;
|
+import net.minecraft.SharedConstants;
|
||||||
|
+import net.minecraft.core.RegistryAccess;
|
||||||
|
+import net.minecraft.core.registries.Registries;
|
||||||
+import net.minecraft.nbt.CompoundTag;
|
+import net.minecraft.nbt.CompoundTag;
|
||||||
+import net.minecraft.resources.ResourceKey;
|
+import net.minecraft.resources.ResourceKey;
|
||||||
+import net.minecraft.util.worldupdate.WorldUpgrader;
|
+import net.minecraft.util.worldupdate.WorldUpgrader;
|
||||||
@ -50,9 +52,8 @@ index 0000000000000000000000000000000000000000..90498d9a4f5aee0f6c8a202b5580b426
|
|||||||
+import net.minecraft.world.level.chunk.ChunkGenerator;
|
+import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||||
+import net.minecraft.world.level.chunk.storage.ChunkStorage;
|
+import net.minecraft.world.level.chunk.storage.ChunkStorage;
|
||||||
+import net.minecraft.world.level.chunk.storage.RegionFileStorage;
|
+import net.minecraft.world.level.chunk.storage.RegionFileStorage;
|
||||||
+import net.minecraft.world.level.dimension.DimensionType;
|
+import net.minecraft.world.level.chunk.storage.RegionStorageInfo;
|
||||||
+import net.minecraft.world.level.dimension.LevelStem;
|
+import net.minecraft.world.level.dimension.LevelStem;
|
||||||
+import net.minecraft.world.level.levelgen.WorldGenSettings;
|
|
||||||
+import net.minecraft.world.level.storage.DimensionDataStorage;
|
+import net.minecraft.world.level.storage.DimensionDataStorage;
|
||||||
+import net.minecraft.world.level.storage.LevelStorageSource;
|
+import net.minecraft.world.level.storage.LevelStorageSource;
|
||||||
+import org.apache.logging.log4j.LogManager;
|
+import org.apache.logging.log4j.LogManager;
|
||||||
@ -77,12 +78,13 @@ index 0000000000000000000000000000000000000000..90498d9a4f5aee0f6c8a202b5580b426
|
|||||||
+ private final File worldDir;
|
+ private final File worldDir;
|
||||||
+ private final ExecutorService threadPool;
|
+ private final ExecutorService threadPool;
|
||||||
+ private final DataFixer dataFixer;
|
+ private final DataFixer dataFixer;
|
||||||
+ private final Optional<ResourceKey<Codec<? extends ChunkGenerator>>> generatorKey;
|
+ private final RegistryAccess registryLookup;
|
||||||
|
+ private final Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> generatorKey;
|
||||||
+ private final boolean removeCaches;
|
+ private final boolean removeCaches;
|
||||||
+ private final boolean recreateRegionFiles; // TODO
|
+ private final boolean recreateRegionFiles; // TODO
|
||||||
+
|
+
|
||||||
+ public ThreadedWorldUpgrader(final ResourceKey<LevelStem> dimensionType, final String worldName, final File worldDir, final int threads,
|
+ public ThreadedWorldUpgrader(final ResourceKey<LevelStem> dimensionType, final String worldName, final File worldDir, final int threads,
|
||||||
+ final DataFixer dataFixer, final Optional<ResourceKey<Codec<? extends ChunkGenerator>>> generatorKey,
|
+ final DataFixer dataFixer, final RegistryAccess registryLookup, final Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> generatorKey,
|
||||||
+ final boolean removeCaches, final boolean recreateRegionFiles) {
|
+ final boolean removeCaches, final boolean recreateRegionFiles) {
|
||||||
+ this.dimensionType = dimensionType;
|
+ this.dimensionType = dimensionType;
|
||||||
+ this.worldName = worldName;
|
+ this.worldName = worldName;
|
||||||
@ -103,6 +105,7 @@ index 0000000000000000000000000000000000000000..90498d9a4f5aee0f6c8a202b5580b426
|
|||||||
+ }
|
+ }
|
||||||
+ });
|
+ });
|
||||||
+ this.dataFixer = dataFixer;
|
+ this.dataFixer = dataFixer;
|
||||||
|
+ this.registryLookup = registryLookup;
|
||||||
+ this.generatorKey = generatorKey;
|
+ this.generatorKey = generatorKey;
|
||||||
+ this.removeCaches = removeCaches;
|
+ this.removeCaches = removeCaches;
|
||||||
+ this.recreateRegionFiles = recreateRegionFiles;
|
+ this.recreateRegionFiles = recreateRegionFiles;
|
||||||
@ -110,24 +113,31 @@ index 0000000000000000000000000000000000000000..90498d9a4f5aee0f6c8a202b5580b426
|
|||||||
+
|
+
|
||||||
+ public void convert() {
|
+ public void convert() {
|
||||||
+ final File worldFolder = LevelStorageSource.getStorageFolder(this.worldDir.toPath(), this.dimensionType).toFile();
|
+ final File worldFolder = LevelStorageSource.getStorageFolder(this.worldDir.toPath(), this.dimensionType).toFile();
|
||||||
+ final DimensionDataStorage worldPersistentData = new DimensionDataStorage(new File(worldFolder, "data"), this.dataFixer);
|
+ final DimensionDataStorage worldPersistentData = new DimensionDataStorage(new File(worldFolder, "data"), this.dataFixer, this.registryLookup);
|
||||||
+
|
+
|
||||||
+ final File regionFolder = new File(worldFolder, "region");
|
+ final File regionFolder = new File(worldFolder, "region");
|
||||||
+
|
+
|
||||||
+ LOGGER.info("Force upgrading " + this.worldName);
|
+ LOGGER.info("Force upgrading {}", this.worldName);
|
||||||
+ LOGGER.info("Counting regionfiles for " + this.worldName);
|
+ LOGGER.info("Counting regionfiles for {}", this.worldName);
|
||||||
+ final File[] regionFiles = regionFolder.listFiles((final File dir, final String name) -> {
|
+ final File[] regionFiles = regionFolder.listFiles((final File dir, final String name) -> {
|
||||||
+ return WorldUpgrader.REGEX.matcher(name).matches();
|
+ return WorldUpgrader.REGEX.matcher(name).matches();
|
||||||
+ });
|
+ });
|
||||||
+ if (regionFiles == null) {
|
+ if (regionFiles == null) {
|
||||||
+ LOGGER.info("Found no regionfiles to convert for world " + this.worldName);
|
+ LOGGER.info("Found no regionfiles to convert for world {}", this.worldName);
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ LOGGER.info("Found " + regionFiles.length + " regionfiles to convert");
|
+ LOGGER.info("Found {} regionfiles to convert", regionFiles.length);
|
||||||
+ LOGGER.info("Starting conversion now for world " + this.worldName);
|
+ LOGGER.info("Starting conversion now for world {}", this.worldName);
|
||||||
|
+
|
||||||
|
+ // Only used for profiling, let's fill it anyways just in case
|
||||||
|
+ final RegionStorageInfo storageInfo = new RegionStorageInfo(
|
||||||
|
+ this.worldName,
|
||||||
|
+ ResourceKey.create(Registries.DIMENSION, this.dimensionType.location()),
|
||||||
|
+ "region"
|
||||||
|
+ );
|
||||||
+
|
+
|
||||||
+ final WorldInfo info = new WorldInfo(() -> worldPersistentData,
|
+ final WorldInfo info = new WorldInfo(() -> worldPersistentData,
|
||||||
+ new ChunkStorage(regionFolder.toPath(), this.dataFixer, false), this.removeCaches, this.dimensionType, this.generatorKey);
|
+ new ChunkStorage(storageInfo, regionFolder.toPath(), this.dataFixer, false), this.removeCaches, this.dimensionType, this.generatorKey);
|
||||||
+
|
+
|
||||||
+ long expectedChunks = (long)regionFiles.length * (32L * 32L);
|
+ long expectedChunks = (long)regionFiles.length * (32L * 32L);
|
||||||
+
|
+
|
||||||
@ -173,12 +183,12 @@ index 0000000000000000000000000000000000000000..90498d9a4f5aee0f6c8a202b5580b426
|
|||||||
+ public final ChunkStorage loader;
|
+ public final ChunkStorage loader;
|
||||||
+ public final boolean removeCaches;
|
+ public final boolean removeCaches;
|
||||||
+ public final ResourceKey<LevelStem> worldKey;
|
+ public final ResourceKey<LevelStem> worldKey;
|
||||||
+ public final Optional<ResourceKey<Codec<? extends ChunkGenerator>>> generatorKey;
|
+ public final Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> generatorKey;
|
||||||
+ public final AtomicLong convertedChunks = new AtomicLong();
|
+ public final AtomicLong convertedChunks = new AtomicLong();
|
||||||
+ public final AtomicLong modifiedChunks = new AtomicLong();
|
+ public final AtomicLong modifiedChunks = new AtomicLong();
|
||||||
+
|
+
|
||||||
+ private WorldInfo(final Supplier<DimensionDataStorage> persistentDataSupplier, final ChunkStorage loader, final boolean removeCaches,
|
+ private WorldInfo(final Supplier<DimensionDataStorage> persistentDataSupplier, final ChunkStorage loader, final boolean removeCaches,
|
||||||
+ final ResourceKey<LevelStem> worldKey, Optional<ResourceKey<Codec<? extends ChunkGenerator>>> generatorKey) {
|
+ final ResourceKey<LevelStem> worldKey, Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> generatorKey) {
|
||||||
+ this.persistentDataSupplier = persistentDataSupplier;
|
+ this.persistentDataSupplier = persistentDataSupplier;
|
||||||
+ this.loader = loader;
|
+ this.loader = loader;
|
||||||
+ this.removeCaches = removeCaches;
|
+ this.removeCaches = removeCaches;
|
||||||
@ -250,7 +260,7 @@ index 0000000000000000000000000000000000000000..90498d9a4f5aee0f6c8a202b5580b426
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||||
index 244a19ecd0234fa1d7a6ecfea20751595688605d..8893aa1fe4b033fdc25ebe6f3a3606af1f9b5ea7 100644
|
index 244a19ecd0234fa1d7a6ecfea20751595688605d..5443013060b62e3bfcc51cddca96d1c0bc59fe72 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Main.java
|
--- a/src/main/java/net/minecraft/server/Main.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||||
@@ -392,6 +392,15 @@ public class Main {
|
@@ -392,6 +392,15 @@ public class Main {
|
||||||
@ -259,9 +269,9 @@ index 244a19ecd0234fa1d7a6ecfea20751595688605d..8893aa1fe4b033fdc25ebe6f3a3606af
|
|||||||
|
|
||||||
+ // Paper start - fix and optimise world upgrading
|
+ // Paper start - fix and optimise world upgrading
|
||||||
+ public static void convertWorldButItWorks(net.minecraft.resources.ResourceKey<net.minecraft.world.level.dimension.LevelStem> dimensionType, net.minecraft.world.level.storage.LevelStorageSource.LevelStorageAccess worldSession,
|
+ public static void convertWorldButItWorks(net.minecraft.resources.ResourceKey<net.minecraft.world.level.dimension.LevelStem> dimensionType, net.minecraft.world.level.storage.LevelStorageSource.LevelStorageAccess worldSession,
|
||||||
+ DataFixer dataFixer, Optional<net.minecraft.resources.ResourceKey<com.mojang.serialization.Codec<? extends net.minecraft.world.level.chunk.ChunkGenerator>>> generatorKey, boolean removeCaches, boolean recreateRegionFiles) {
|
+ DataFixer dataFixer, RegistryAccess registryLookup, Optional<net.minecraft.resources.ResourceKey<com.mojang.serialization.MapCodec<? extends net.minecraft.world.level.chunk.ChunkGenerator>>> generatorKey, boolean removeCaches, boolean recreateRegionFiles) {
|
||||||
+ int threads = Runtime.getRuntime().availableProcessors() * 3 / 8;
|
+ int threads = Runtime.getRuntime().availableProcessors() * 3 / 8;
|
||||||
+ final io.papermc.paper.world.ThreadedWorldUpgrader worldUpgrader = new io.papermc.paper.world.ThreadedWorldUpgrader(dimensionType, worldSession.getLevelId(), worldSession.levelDirectory.path().toFile(), threads, dataFixer, generatorKey, removeCaches, recreateRegionFiles);
|
+ final io.papermc.paper.world.ThreadedWorldUpgrader worldUpgrader = new io.papermc.paper.world.ThreadedWorldUpgrader(dimensionType, worldSession.getLevelId(), worldSession.levelDirectory.path().toFile(), threads, dataFixer, registryLookup, generatorKey, removeCaches, recreateRegionFiles);
|
||||||
+ worldUpgrader.convert();
|
+ worldUpgrader.convert();
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - fix and optimise world upgrading
|
+ // Paper end - fix and optimise world upgrading
|
||||||
@ -270,7 +280,7 @@ index 244a19ecd0234fa1d7a6ecfea20751595688605d..8893aa1fe4b033fdc25ebe6f3a3606af
|
|||||||
Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit
|
Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit
|
||||||
WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, dynamicRegistryManager, eraseCache, recreateRegionFiles);
|
WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, dynamicRegistryManager, eraseCache, recreateRegionFiles);
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index 5f3b35f0dbd9e78ad18ef5cf7be1a807beffeaf1..a43f597d1148e00a6533f74c25ce272cd4e26dc4 100644
|
index 5f3b35f0dbd9e78ad18ef5cf7be1a807beffeaf1..b2d558d21ec22577c31543b79527bde3daa1b871 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -599,11 +599,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -599,11 +599,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
@ -293,7 +303,7 @@ index 5f3b35f0dbd9e78ad18ef5cf7be1a807beffeaf1..a43f597d1148e00a6533f74c25ce272c
|
|||||||
+ // Paper start - fix and optimise world upgrading
|
+ // Paper start - fix and optimise world upgrading
|
||||||
+ if (options.has("forceUpgrade")) {
|
+ if (options.has("forceUpgrade")) {
|
||||||
+ net.minecraft.server.Main.convertWorldButItWorks(
|
+ net.minecraft.server.Main.convertWorldButItWorks(
|
||||||
+ dimensionKey, worldSession, DataFixers.getDataFixer(), worlddimension.generator().getTypeNameForDataFixer(), options.has("eraseCache"), console.has("recreateRegionFiles")
|
+ dimensionKey, worldSession, DataFixers.getDataFixer(), iregistrycustom_dimension, worlddimension.generator().getTypeNameForDataFixer(), options.has("eraseCache"), options.has("recreateRegionFiles")
|
||||||
+ );
|
+ );
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - fix and optimise world upgrading
|
+ // Paper end - fix and optimise world upgrading
|
||||||
@ -355,7 +365,7 @@ index 249705ec1b8b692ef1d7fec34a04918afe6486bc..f6e3b745fc417354380d4a969f83aee4
|
|||||||
return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ()));
|
return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ()));
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index ac9873c430a3ece5c4b5f5305496639a54ce35f5..3e29496ef9a551f692e4e9149d0e6ffc31fe66e9 100644
|
index ac9873c430a3ece5c4b5f5305496639a54ce35f5..0a27ee956a623f6af3cd0f7d9dc1393fb2526412 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -1366,9 +1366,7 @@ public final class CraftServer implements Server {
|
@@ -1366,9 +1366,7 @@ public final class CraftServer implements Server {
|
||||||
@ -376,7 +386,7 @@ index ac9873c430a3ece5c4b5f5305496639a54ce35f5..3e29496ef9a551f692e4e9149d0e6ffc
|
|||||||
+ // Paper start - fix and optimise world upgrading
|
+ // Paper start - fix and optimise world upgrading
|
||||||
+ if (this.console.options.has("forceUpgrade")) {
|
+ if (this.console.options.has("forceUpgrade")) {
|
||||||
+ net.minecraft.server.Main.convertWorldButItWorks(
|
+ net.minecraft.server.Main.convertWorldButItWorks(
|
||||||
+ actualDimension, worldSession, DataFixers.getDataFixer(), worlddimension.generator().getTypeNameForDataFixer(), this.console.options.has("eraseCache"), this.console.options.has("recreateRegionFiles")
|
+ actualDimension, worldSession, DataFixers.getDataFixer(), iregistrycustom_dimension, worlddimension.generator().getTypeNameForDataFixer(), this.console.options.has("eraseCache"), this.console.options.has("recreateRegionFiles")
|
||||||
+ );
|
+ );
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - fix and optimise world upgrading
|
+ // Paper end - fix and optimise world upgrading
|
Loading…
Reference in New Issue
Block a user