Fix chunk data version check not running in chunk system

The old read() method should just redirect to the new
chunk system method, however due to an error in moving
the chunk system patch around the data version check was
left in the old (UNUSED) read() method.
This commit is contained in:
Spottedleaf 2024-05-09 23:47:13 -07:00
parent b407e24c84
commit 79fcb6baf4

View file

@ -20453,21 +20453,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
public static ProtoChunk read(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt) {
// Paper start - Do not let the server load chunks from newer versions
if (nbt.contains("DataVersion", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) {
@@ -0,0 +0,0 @@ public class ChunkSerializer {
}
}
// Paper end - Do not let the server load chunks from newer versions
+ // Paper start - rewrite chunk system
+ InProgressChunkHolder holder = readInProgressChunkHolder(world, poiStorage, chunkPos, nbt);
+ return holder.protoChunk;
+ }
+
+ public static InProgressChunkHolder readInProgressChunkHolder(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt) {
+ // Paper end - rewrite chunk system
ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - guard against serializing mismatching coordinates; diff on change, see ChunkSerializer#getChunkCoordinate
if (!Objects.equals(chunkPos, chunkcoordintpair1)) {
// Paper start - Do not let the server load chunks from newer versions
if (nbt.contains("DataVersion", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) {
final int dataVersion = nbt.getInt("DataVersion");
@@ -0,0 +0,0 @@ public class ChunkSerializer {
achunksection[k] = chunksection;
SectionPos sectionposition = SectionPos.of(chunkPos, b0);