mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 14:35:11 +01:00
hunk system fixes
This commit is contained in:
parent
62b96c520f
commit
c5c2a5fe13
15 changed files with 31 additions and 32 deletions
|
@ -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
|
||||
index 7dfbb3dd6100180abd2ebab4d1e9e34928666f9e..4dc5802d203d202081ae034bbf8efd5e7983f360 100644
|
||||
index 7dfbb3dd6100180abd2ebab4d1e9e34928666f9e..877f9d7a83fa817586f9f2dd2b10e06e9962b7c8 100644
|
||||
--- a/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 {
|
||||
|
@ -18587,8 +18587,8 @@ index 7dfbb3dd6100180abd2ebab4d1e9e34928666f9e..4dc5802d203d202081ae034bbf8efd5e
|
|||
+
|
||||
+ private static final class EntityRegionFileStorage extends net.minecraft.world.level.chunk.storage.RegionFileStorage {
|
||||
+
|
||||
+ public EntityRegionFileStorage(Path directory, boolean dsync) {
|
||||
+ super(directory, dsync);
|
||||
+ public EntityRegionFileStorage(RegionStorageInfo storageKey, Path directory, boolean dsync) {
|
||||
+ super(storageKey, directory, dsync);
|
||||
+ }
|
||||
+
|
||||
+ protected void write(ChunkPos pos, net.minecraft.nbt.CompoundTag nbt) throws IOException {
|
||||
|
@ -20275,14 +20275,15 @@ index bac191f92ea3735df19c68d5568c2c7962c8680f..5d94aee1303d9eca5f1fa9a2e033ad0d
|
|||
|
||||
public void setFullStatus(Supplier<FullChunkStatus> levelTypeProvider) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatus.java b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatus.java
|
||||
index 95318092f8281d98132d1d3ceb4a5c36cf32eb05..1b059afaa433212e5b17d35ba221cdf0ad60235c 100644
|
||||
index 95318092f8281d98132d1d3ceb4a5c36cf32eb05..b81c548c0e1ac53784e9c94b34b65db5f123309c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatus.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatus.java
|
||||
@@ -21,13 +21,14 @@ import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
@@ -21,13 +21,15 @@ import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
|
||||
public class ChunkStatus {
|
||||
+ static final ChunkStatus.LoadingTask PASSTHROUGH_LOAD_TASK = (WorldGenContext context, ChunkStatus status, ToFullChunk fullChunkConverter, ChunkAccess chunk) -> CompletableFuture.completedFuture(chunk); // Paper - rewrite chunk system
|
||||
+ protected static final java.util.List<ChunkStatus> statuses = new java.util.ArrayList<>(); // Paper - rewrite chunk system
|
||||
public static final int MAX_STRUCTURE_DISTANCE = 8;
|
||||
private static final EnumSet<Heightmap.Types> PRE_FEATURES = EnumSet.of(Heightmap.Types.OCEAN_FLOOR_WG, Heightmap.Types.WORLD_SURFACE_WG);
|
||||
public static final EnumSet<Heightmap.Types> POST_FEATURES = EnumSet.of(
|
||||
|
@ -20294,7 +20295,7 @@ index 95318092f8281d98132d1d3ceb4a5c36cf32eb05..1b059afaa433212e5b17d35ba221cdf0
|
|||
);
|
||||
public static final ChunkStatus STRUCTURE_STARTS = register(
|
||||
"structure_starts",
|
||||
@@ -47,22 +48,22 @@ public class ChunkStatus {
|
||||
@@ -47,22 +49,22 @@ public class ChunkStatus {
|
||||
PRE_FEATURES,
|
||||
ChunkType.PROTOCHUNK,
|
||||
ChunkStatusTasks::generateStructureReferences,
|
||||
|
@ -20323,7 +20324,7 @@ index 95318092f8281d98132d1d3ceb4a5c36cf32eb05..1b059afaa433212e5b17d35ba221cdf0
|
|||
);
|
||||
public static final ChunkStatus INITIALIZE_LIGHT = register(
|
||||
"initialize_light",
|
||||
@@ -78,7 +79,7 @@ public class ChunkStatus {
|
||||
@@ -78,7 +80,7 @@ public class ChunkStatus {
|
||||
"light", INITIALIZE_LIGHT, 1, true, POST_FEATURES, ChunkType.PROTOCHUNK, ChunkStatusTasks::generateLight, ChunkStatusTasks::loadLight
|
||||
);
|
||||
public static final ChunkStatus SPAWN = register(
|
||||
|
@ -20332,7 +20333,7 @@ index 95318092f8281d98132d1d3ceb4a5c36cf32eb05..1b059afaa433212e5b17d35ba221cdf0
|
|||
);
|
||||
public static final ChunkStatus FULL = register(
|
||||
"full", SPAWN, 0, false, POST_FEATURES, ChunkType.LEVELCHUNK, ChunkStatusTasks::generateFull, ChunkStatusTasks::loadFull
|
||||
@@ -128,6 +129,29 @@ public class ChunkStatus {
|
||||
@@ -128,6 +130,27 @@ public class ChunkStatus {
|
||||
}
|
||||
}
|
||||
// Paper end - starlight
|
||||
|
@ -20341,8 +20342,6 @@ index 95318092f8281d98132d1d3ceb4a5c36cf32eb05..1b059afaa433212e5b17d35ba221cdf0
|
|||
+ public int writeRadius = -1;
|
||||
+ public int loadRange = 0;
|
||||
+
|
||||
+ protected static final java.util.List<ChunkStatus> statuses = new java.util.ArrayList<>();
|
||||
+
|
||||
+ private ChunkStatus nextStatus;
|
||||
+
|
||||
+ public final ChunkStatus getNextStatus() {
|
||||
|
@ -20362,7 +20361,7 @@ index 95318092f8281d98132d1d3ceb4a5c36cf32eb05..1b059afaa433212e5b17d35ba221cdf0
|
|||
|
||||
private static ChunkStatus register(
|
||||
String id,
|
||||
@@ -190,6 +214,13 @@ public class ChunkStatus {
|
||||
@@ -190,6 +213,13 @@ public class ChunkStatus {
|
||||
this.chunkType = chunkType;
|
||||
this.heightmapsAfter = heightMapTypes;
|
||||
this.index = previous == null ? 0 : previous.getIndex() + 1;
|
||||
|
|
|
@ -76,7 +76,7 @@ index f74efe41cd0da2f9749fc96fb9e0f7cf237ad1c6..d1728e13a7b649f308bde90ab633c79d
|
|||
public void close() throws IOException {
|
||||
// CraftBukkit start
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 4dc5802d203d202081ae034bbf8efd5e7983f360..c0bff735a4ff85ca84d55cd1448aa5d423cab60f 100644
|
||||
index 877f9d7a83fa817586f9f2dd2b10e06e9962b7c8..412e167f6e29cbe905161c7e00736961f2c56c21 100644
|
||||
--- a/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 {
|
||||
|
@ -106,7 +106,7 @@ index 4dc5802d203d202081ae034bbf8efd5e7983f360..c0bff735a4ff85ca84d55cd1448aa5d4
|
|||
+ ServerLevel worldserver1 = this;
|
||||
+
|
||||
+ this.serverLevelData.setWorldBorder(worldserver1.getWorldBorder().createSettings());
|
||||
+ this.serverLevelData.setCustomBossEvents(this.server.getCustomBossEvents().save());
|
||||
+ this.serverLevelData.setCustomBossEvents(this.server.getCustomBossEvents().save(this.registryAccess()));
|
||||
+ this.convertable.saveDataTag(this.server.registryAccess(), this.serverLevelData, this.server.getPlayerList().getSingleplayerData());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
|
|
@ -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.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index c0bff735a4ff85ca84d55cd1448aa5d423cab60f..95bee1356fe3e149da3db091a3286762c6a15ed1 100644
|
||||
index 412e167f6e29cbe905161c7e00736961f2c56c21..3203f95b8a877efb752fe2e6c58da6df9c8eede7 100644
|
||||
--- a/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 {
|
||||
|
|
|
@ -33,7 +33,7 @@ this fix, as the data will remain in the oversized file. Once the server returns
|
|||
to a jar with this fix, the data will be restored.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
index 307196b2a58d4f8db3e6e3c3517a8004d4908b13..c9fd589b1354ac788b63d163d427e8cc5fbba3c5 100644
|
||||
index 307196b2a58d4f8db3e6e3c3517a8004d4908b13..f994f91dd4b4a0a6d540a5605af0b6623e229f84 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
@@ -18,10 +18,13 @@ import java.nio.file.LinkOption;
|
||||
|
@ -50,14 +50,14 @@ index 307196b2a58d4f8db3e6e3c3517a8004d4908b13..c9fd589b1354ac788b63d163d427e8cc
|
|||
import net.minecraft.world.level.ChunkPos;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -56,6 +59,7 @@ public class RegionFile implements AutoCloseable {
|
||||
|
||||
public RegionFile(RegionStorageInfo storageKey, Path path, Path directory, RegionFileVersion compressionFormat, boolean dsync) throws IOException {
|
||||
this.header = ByteBuffer.allocateDirect(8192);
|
||||
+ initOversizedState(); // Paper
|
||||
@@ -59,6 +62,7 @@ public class RegionFile implements AutoCloseable {
|
||||
this.usedSectors = new RegionBitmap();
|
||||
this.info = storageKey;
|
||||
this.path = path;
|
||||
+ initOversizedState(); // Paper
|
||||
this.version = compressionFormat;
|
||||
if (!Files.isDirectory(directory, new LinkOption[0])) {
|
||||
throw new IllegalArgumentException("Expected directory, got " + String.valueOf(directory.toAbsolutePath()));
|
||||
@@ -453,6 +457,74 @@ public class RegionFile implements AutoCloseable {
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ index 721b63f7471ace33ae22f4205f554ee3be0e033d..c22b40790a28c9a670538a8cc97821b3
|
|||
// Spigot start
|
||||
return this.anyPlayerCloseEnoughForSpawning(pos, false);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
index c9fd589b1354ac788b63d163d427e8cc5fbba3c5..27d3209275d621a211a82436667ba1a8eae605c7 100644
|
||||
index f994f91dd4b4a0a6d540a5605af0b6623e229f84..cf43daa019b239464401784938d01af83f9da47c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
@@ -52,6 +52,29 @@ public class RegionFile implements AutoCloseable {
|
||||
|
|
|
@ -17,7 +17,7 @@ Adds villagers as separate config
|
|||
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
|
||||
index 95bee1356fe3e149da3db091a3286762c6a15ed1..01053e93cf21e3d8939a09e6bdf4ea996174ca95 100644
|
||||
index 3203f95b8a877efb752fe2e6c58da6df9c8eede7..246c5d3e04044f5c5802ec5134dc69b8d8403a1a 100644
|
||||
--- a/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;
|
||||
|
|
|
@ -1104,7 +1104,7 @@ index 183b2191fa1c1b27adedf39593e1b5a223fb1279..8ead66c134688b11dca15f6509147e72
|
|||
|
||||
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
|
||||
index 01053e93cf21e3d8939a09e6bdf4ea996174ca95..47c9b375b907945510d0b403e88cca17fca0fd3d 100644
|
||||
index 246c5d3e04044f5c5802ec5134dc69b8d8403a1a..885c64bd58de40b8fd03725f23cdbd0714a8cc69 100644
|
||||
--- a/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 {
|
||||
|
|
|
@ -24,7 +24,7 @@ index c7b7f153895a4b95b2071a31db00c9c4b69fa094..0b7a38b9e92b19345a34c6226413a9b1
|
|||
|
||||
// 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
|
||||
index 47c9b375b907945510d0b403e88cca17fca0fd3d..cdf02d7365a14d32dbb63771d8f834c1b28ec03e 100644
|
||||
index 885c64bd58de40b8fd03725f23cdbd0714a8cc69..75dc2f98cc2c723db01135a3a42f346a70c78208 100644
|
||||
--- a/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 {
|
||||
|
|
|
@ -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
|
||||
index cdf02d7365a14d32dbb63771d8f834c1b28ec03e..9b1641ab38a11c577ae70908c52907c34f061c7f 100644
|
||||
index 75dc2f98cc2c723db01135a3a42f346a70c78208..54dcd9025b284dddc71b6821723be64d6e339613 100644
|
||||
--- a/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 {
|
||||
|
|
|
@ -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
|
||||
index 9b1641ab38a11c577ae70908c52907c34f061c7f..1f6f49023bdb914a0112d632cbba5eeb96c4b7e9 100644
|
||||
index 54dcd9025b284dddc71b6821723be64d6e339613..3aeaf62226ba0a4df3445b966fccdb4e2abb9c8a 100644
|
||||
--- a/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 {
|
||||
|
|
|
@ -87,7 +87,7 @@ index a23dc2f8f4475de1ee35bf18a7a8a53233ccac12..226af44fd469053451a0403a95ffb446
|
|||
this.used.set(start, start + size);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
index 27d3209275d621a211a82436667ba1a8eae605c7..9fdbea51d96e54b52b63de04f2845c62bfd0117a 100644
|
||||
index cf43daa019b239464401784938d01af83f9da47c..1362a47943cf1a51a185a15094b1f74c94bf40ef 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
@@ -52,6 +52,354 @@ public class RegionFile implements AutoCloseable {
|
||||
|
@ -462,8 +462,8 @@ index 27d3209275d621a211a82436667ba1a8eae605c7..9fdbea51d96e54b52b63de04f2845c62
|
|||
+ this.canRecalcHeader = canRecalcHeader;
|
||||
+ // Paper end - add can recalc flag
|
||||
this.header = ByteBuffer.allocateDirect(8192);
|
||||
initOversizedState(); // Paper
|
||||
this.usedSectors = new RegionBitmap();
|
||||
this.info = storageKey;
|
||||
@@ -110,14 +468,16 @@ public class RegionFile implements AutoCloseable {
|
||||
RegionFile.LOGGER.warn("Region file {} has truncated header: {}", path, i);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ index e161ad0f53a21a68e8c78575ba5d3cdbdb11fca0..57e76b53e5e314c3e6b8856010f7a841
|
|||
});
|
||||
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
|
||||
index 1f6f49023bdb914a0112d632cbba5eeb96c4b7e9..031d78c1635f2a77605e58ff27683dee09dc2ed6 100644
|
||||
index 3aeaf62226ba0a4df3445b966fccdb4e2abb9c8a..8fcc14a2e7ebc5261948c9ad71965bdd9cfe6dc1 100644
|
||||
--- a/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 {
|
||||
|
|
|
@ -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
|
||||
index 031d78c1635f2a77605e58ff27683dee09dc2ed6..6de44cc46f37ba70ebf02aeb68fd88a5e358d7c8 100644
|
||||
index 8fcc14a2e7ebc5261948c9ad71965bdd9cfe6dc1..285580485b60ca4cd95a5d8ff807cb05dbe38d39 100644
|
||||
--- a/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 {
|
||||
|
|
|
@ -28,7 +28,7 @@ index 1adcbfb16ea1fe3378cde7c53e8868840eade963..5f3b35f0dbd9e78ad18ef5cf7be1a807
|
|||
this.profiler.push(() -> {
|
||||
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
|
||||
index 6de44cc46f37ba70ebf02aeb68fd88a5e358d7c8..c9aef37fed619f57135113f013b98eb7c53aad7c 100644
|
||||
index 285580485b60ca4cd95a5d8ff807cb05dbe38d39..5d79cabecc29b15ec4e71589fdbb7dc5d658d327 100644
|
||||
--- a/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 {
|
||||
|
|
|
@ -8,7 +8,7 @@ we can instead use the nearby player tracking system to reduce
|
|||
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
|
||||
index c9aef37fed619f57135113f013b98eb7c53aad7c..7089868f75f0045c7583d224cd97688d0f215ee3 100644
|
||||
index 5d79cabecc29b15ec4e71589fdbb7dc5d658d327..901a764a8c3ae5259fdc4729d22c9986361d39a8 100644
|
||||
--- a/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 {
|
||||
|
|
Loading…
Reference in a new issue