PaperMC/nms-patches/WorldUpgrader.patch
2020-06-25 17:58:10 +10:00

94 lines
5.5 KiB
Diff

--- a/net/minecraft/server/WorldUpgrader.java
+++ b/net/minecraft/server/WorldUpgrader.java
@@ -25,7 +25,7 @@
private static final Logger LOGGER = LogManager.getLogger();
private static final ThreadFactory b = (new ThreadFactoryBuilder()).setDaemon(true).build();
- private final ImmutableSet<ResourceKey<World>> c;
+ private final ImmutableSet<ResourceKey<DimensionManager>> c; // CraftBukkit
private final boolean d;
private final Convertable.ConversionSession e;
private final Thread f;
@@ -36,12 +36,12 @@
private volatile int k;
private volatile int l;
private volatile int m;
- private final Object2FloatMap<ResourceKey<World>> n = Object2FloatMaps.synchronize(new Object2FloatOpenCustomHashMap(SystemUtils.k()));
+ private final Object2FloatMap<ResourceKey<DimensionManager>> n = Object2FloatMaps.synchronize(new Object2FloatOpenCustomHashMap(SystemUtils.k())); // CraftBukkit
private volatile IChatBaseComponent o = new ChatMessage("optimizeWorld.stage.counting");
private static final Pattern p = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.mca$");
private final WorldPersistentData q;
- public WorldUpgrader(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, ImmutableSet<ResourceKey<World>> immutableset, boolean flag) {
+ public WorldUpgrader(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, ImmutableSet<ResourceKey<DimensionManager>> immutableset, boolean flag) { // CraftBukkit
this.c = immutableset;
this.d = flag;
this.g = datafixer;
@@ -69,12 +69,12 @@
private void i() {
this.k = 0;
- Builder<ResourceKey<World>, ListIterator<ChunkCoordIntPair>> builder = ImmutableMap.builder();
+ Builder<ResourceKey<DimensionManager>, ListIterator<ChunkCoordIntPair>> builder = ImmutableMap.builder(); // CraftBukkit
List list;
for (UnmodifiableIterator unmodifiableiterator = this.c.iterator(); unmodifiableiterator.hasNext(); this.k += list.size()) {
- ResourceKey<World> resourcekey = (ResourceKey) unmodifiableiterator.next();
+ ResourceKey<DimensionManager> resourcekey = (ResourceKey) unmodifiableiterator.next(); // CraftBukkit
list = this.b(resourcekey);
builder.put(resourcekey, list.listIterator());
@@ -84,18 +84,18 @@
this.i = true;
} else {
float f = (float) this.k;
- ImmutableMap<ResourceKey<World>, ListIterator<ChunkCoordIntPair>> immutablemap = builder.build();
- Builder<ResourceKey<World>, IChunkLoader> builder1 = ImmutableMap.builder();
+ ImmutableMap<ResourceKey<DimensionManager>, ListIterator<ChunkCoordIntPair>> immutablemap = builder.build(); // CraftBukkit
+ Builder<ResourceKey<DimensionManager>, IChunkLoader> builder1 = ImmutableMap.builder(); // CraftBukkit
UnmodifiableIterator unmodifiableiterator1 = this.c.iterator();
while (unmodifiableiterator1.hasNext()) {
- ResourceKey<World> resourcekey1 = (ResourceKey) unmodifiableiterator1.next();
- File file = this.e.a(resourcekey1);
+ ResourceKey<DimensionManager> resourcekey1 = (ResourceKey) unmodifiableiterator1.next(); // CraftBukkit
+ File file = this.e.a(null); // CraftBukkit
builder1.put(resourcekey1, new IChunkLoader(new File(file, "region"), this.g, true));
}
- ImmutableMap<ResourceKey<World>, IChunkLoader> immutablemap1 = builder1.build();
+ ImmutableMap<ResourceKey<DimensionManager>, IChunkLoader> immutablemap1 = builder1.build(); // CraftBukkit
long i = SystemUtils.getMonotonicMillis();
this.o = new ChatMessage("optimizeWorld.stage.upgrading");
@@ -107,7 +107,7 @@
float f2;
for (UnmodifiableIterator unmodifiableiterator2 = this.c.iterator(); unmodifiableiterator2.hasNext(); f1 += f2) {
- ResourceKey<World> resourcekey2 = (ResourceKey) unmodifiableiterator2.next();
+ ResourceKey<DimensionManager> resourcekey2 = (ResourceKey) unmodifiableiterator2.next(); // CraftBukkit
ListIterator<ChunkCoordIntPair> listiterator = (ListIterator) immutablemap.get(resourcekey2);
IChunkLoader ichunkloader = (IChunkLoader) immutablemap1.get(resourcekey2);
@@ -122,7 +122,7 @@
int j = IChunkLoader.a(nbttagcompound);
NBTTagCompound nbttagcompound1 = ichunkloader.getChunkData(resourcekey2, () -> {
return this.q;
- }, nbttagcompound);
+ }, nbttagcompound, chunkcoordintpair, null); // CraftBukkit
NBTTagCompound nbttagcompound2 = nbttagcompound1.getCompound("Level");
ChunkCoordIntPair chunkcoordintpair1 = new ChunkCoordIntPair(nbttagcompound2.getInt("xPos"), nbttagcompound2.getInt("zPos"));
@@ -195,8 +195,8 @@
}
}
- private List<ChunkCoordIntPair> b(ResourceKey<World> resourcekey) {
- File file = this.e.a(resourcekey);
+ private List<ChunkCoordIntPair> b(ResourceKey<DimensionManager> resourcekey) { // CraftBukkit
+ File file = this.e.a(null); // CraftBukkit
File file1 = new File(file, "region");
File[] afile = file1.listFiles((file2, s) -> {
return s.endsWith(".mca");