Add DataConverter patch

This commit is contained in:
Spottedleaf
2025-06-03 13:15:20 -07:00
parent 4fa21c21fc
commit cb705c41ff
16 changed files with 32561 additions and 23 deletions

File diff suppressed because one or more lines are too long

View File

@@ -297,7 +297,7 @@ index 0000000000000000000000000000000000000000..1b8193587814225c2ef2c5d9e667436e
+ }
+}
diff --git a/ca/spottedleaf/moonrise/paper/PaperHooks.java b/ca/spottedleaf/moonrise/paper/PaperHooks.java
index 0ced5a8990b9fa2bdda90eac0a1c7ab27effe0e9..8506fc08bc2a2933e8f4f3a3e636913fa96c3d84 100644
index 3b97e8d90327d6fcb4c4149a1107f79ee8d33918..be3589070915e3c493e67c40834c887afe53810a 100644
--- a/ca/spottedleaf/moonrise/paper/PaperHooks.java
+++ b/ca/spottedleaf/moonrise/paper/PaperHooks.java
@@ -13,6 +13,7 @@ import net.minecraft.server.level.ChunkHolder;
@@ -317,7 +317,7 @@ index 0ced5a8990b9fa2bdda90eac0a1c7ab27effe0e9..8506fc08bc2a2933e8f4f3a3e636913f
}
@Override
@@ -239,7 +240,7 @@ public final class PaperHooks extends BaseChunkSystemHooks implements PlatformHo
@@ -276,7 +277,7 @@ public final class PaperHooks extends BaseChunkSystemHooks implements PlatformHo
@Override
public void postLoadProtoChunk(final ServerLevel world, final ProtoChunk chunk) {
try (final net.minecraft.util.ProblemReporter.ScopedCollector scopedCollector = new net.minecraft.util.ProblemReporter.ScopedCollector(chunk.problemPath(), LOGGER)) {
@@ -23777,7 +23777,7 @@ index 46de98a6bbbae48c4837e1e588ba198a363d2dde..fd3553bdc1c3cdbf6aa3dc00e0a4987f
thread1 -> {
DedicatedServer dedicatedServer1 = new DedicatedServer(
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 794a01ee70a2a30d91550f5265f774ba73828cf9..28e07984e22514d135a27fe13087e8d185813aad 100644
index c716521fb1497dc8a22d827ddb50fc1cc21a05f4..80442494db670fec34df310390ea787fb963eef4 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -173,7 +173,7 @@ import net.minecraft.world.phys.Vec2;
@@ -23789,7 +23789,7 @@ index 794a01ee70a2a30d91550f5265f774ba73828cf9..28e07984e22514d135a27fe13087e8d1
private static MinecraftServer SERVER; // Paper
public static final Logger LOGGER = LogUtils.getLogger();
public static final net.kyori.adventure.text.logger.slf4j.ComponentLogger COMPONENT_LOGGER = net.kyori.adventure.text.logger.slf4j.ComponentLogger.logger(LOGGER.getName()); // Paper
@@ -319,6 +319,77 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -320,6 +320,77 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return minecraftServer;
}
@@ -23867,7 +23867,7 @@ index 794a01ee70a2a30d91550f5265f774ba73828cf9..28e07984e22514d135a27fe13087e8d1
public MinecraftServer(
// CraftBukkit start
joptsimple.OptionSet options,
@@ -650,7 +721,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -651,7 +722,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.forceDifficulty();
for (ServerLevel serverLevel : this.getAllLevels()) {
this.prepareLevels(serverLevel.getChunkSource().chunkMap.progressListener, serverLevel);
@@ -23876,7 +23876,7 @@ index 794a01ee70a2a30d91550f5265f774ba73828cf9..28e07984e22514d135a27fe13087e8d1
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(serverLevel.getWorld()));
}
@@ -843,6 +914,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -844,6 +915,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public abstract boolean shouldRconBroadcast();
public boolean saveAllChunks(boolean suppressLog, boolean flush, boolean forced) {
@@ -23888,7 +23888,7 @@ index 794a01ee70a2a30d91550f5265f774ba73828cf9..28e07984e22514d135a27fe13087e8d1
boolean flag = false;
for (ServerLevel serverLevel : this.getAllLevels()) {
@@ -850,7 +926,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -851,7 +927,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
LOGGER.info("Saving chunks for level '{}'/{}", serverLevel, serverLevel.dimension().location());
}
@@ -23897,7 +23897,7 @@ index 794a01ee70a2a30d91550f5265f774ba73828cf9..28e07984e22514d135a27fe13087e8d1
flag = true;
}
@@ -943,7 +1019,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -944,7 +1020,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
@@ -23906,7 +23906,7 @@ index 794a01ee70a2a30d91550f5265f774ba73828cf9..28e07984e22514d135a27fe13087e8d1
this.nextTickTimeNanos = Util.getNanos() + TimeUtil.NANOSECONDS_PER_MILLISECOND;
for (ServerLevel serverLevelx : this.getAllLevels()) {
@@ -953,18 +1029,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -954,18 +1030,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.waitUntilNextTick();
}
@@ -23932,7 +23932,7 @@ index 794a01ee70a2a30d91550f5265f774ba73828cf9..28e07984e22514d135a27fe13087e8d1
this.isSaving = false;
this.resources.close();
@@ -984,6 +1056,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -985,6 +1057,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getProfileCache().save(false); // Paper - Perf: Async GameProfileCache saving
}
// Spigot end
@@ -23947,7 +23947,7 @@ index 794a01ee70a2a30d91550f5265f774ba73828cf9..28e07984e22514d135a27fe13087e8d1
// Paper start - Improved watchdog support - move final shutdown items here
Util.shutdownExecutors();
try {
@@ -1168,6 +1248,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1169,6 +1249,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
profilerFiller.push("tick");
this.tickFrame.start();
this.tickServer(flag ? () -> false : this::haveTime);
@@ -23961,7 +23961,7 @@ index 794a01ee70a2a30d91550f5265f774ba73828cf9..28e07984e22514d135a27fe13087e8d1
this.tickFrame.end();
profilerFiller.popPush("nextTickWait");
this.mayHaveDelayedTasks = true;
@@ -1338,6 +1425,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1339,6 +1426,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private boolean pollTaskInternal() {
if (super.pollTask()) {
@@ -23969,7 +23969,7 @@ index 794a01ee70a2a30d91550f5265f774ba73828cf9..28e07984e22514d135a27fe13087e8d1
return true;
} else {
boolean ret = false; // Paper - force execution of all worlds, do not just bias the first
@@ -2467,6 +2555,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2468,6 +2556,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
@@ -33246,7 +33246,7 @@ index 7a4d299d2ce36982204e30de9278ddfd5b37c3df..b8348976e80578d9eff64eea68c04c60
private final ChunkStatus status;
@Nullable
diff --git a/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/net/minecraft/world/level/chunk/storage/ChunkStorage.java
index 8c1417c659ea0e079e99b9bfa79e1cf6ba9b712b..8847fc3b164bb011cea24217623c59f5b78f787b 100644
index a8a32edea080f32fd25c9e009d4efa416a51a4cf..f6de972541fb2ed6d65aab06d61f5dcd0bfa1616 100644
--- a/net/minecraft/world/level/chunk/storage/ChunkStorage.java
+++ b/net/minecraft/world/level/chunk/storage/ChunkStorage.java
@@ -22,20 +22,30 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
@@ -33285,7 +33285,7 @@ index 8c1417c659ea0e079e99b9bfa79e1cf6ba9b712b..8847fc3b164bb011cea24217623c59f5
// CraftBukkit start
@@ -66,7 +76,9 @@ public class ChunkStorage implements AutoCloseable {
chunkData = DataFixTypes.CHUNK.update(this.fixerUpper, chunkData, version, 1493);
chunkData = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.CHUNK, chunkData, version, 1493); // Paper - replace chunk converter
if (chunkData.getCompound("Level").flatMap(compoundTag -> compoundTag.getBoolean("hasLegacyStructureData")).orElse(false)) {
LegacyStructureDataHandler legacyStructureHandler = this.getLegacyStructureHandler(levelKey, storage);
+ synchronized (legacyStructureHandler) { // Paper - rewrite chunk system
@@ -34224,7 +34224,7 @@ index 15417fab103feec3c1f7d5bd5b332e89d3ace3f5..2e6263d8b466e0f61bc72eb818044734
}
}
diff --git a/net/minecraft/world/level/chunk/storage/SimpleRegionStorage.java b/net/minecraft/world/level/chunk/storage/SimpleRegionStorage.java
index 6be673172548c1382c7402ec4e1ec6ef51f702d3..1d8c151c00ef1192792584b50fe15e102ef46d60 100644
index 18750f1ea3101b6c0ab0b8e33c304eb7fa1ed04d..bf708ff89ea1f2c7279e48c41c4f44abc77ceebb 100644
--- a/net/minecraft/world/level/chunk/storage/SimpleRegionStorage.java
+++ b/net/minecraft/world/level/chunk/storage/SimpleRegionStorage.java
@@ -14,7 +14,7 @@ import net.minecraft.util.datafix.DataFixTypes;
@@ -34350,7 +34350,7 @@ index 6d61739574155f89511b9adcaf1174841bdc7da7..65728ef17e63d71833677fdcbd5bb907
private ChunkAccess doFill(Blender blender, StructureManager structureManager, RandomState random, ChunkAccess chunk, int minCellY, int cellCountY) {
diff --git a/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/net/minecraft/world/level/levelgen/structure/StructureCheck.java
index 6a5451440751ad017324e3fec8cfd8efb118511b..48fce0845fb023d6286dac144c285b048d778564 100644
index 4a3a05335e21008eb349e9ab221b54234d9ac200..7779a2f83f51465bde476776470bd77712f6be0d 100644
--- a/net/minecraft/world/level/levelgen/structure/StructureCheck.java
+++ b/net/minecraft/world/level/levelgen/structure/StructureCheck.java
@@ -48,8 +48,13 @@ public class StructureCheck {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Incremental chunk and player saving
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 28e07984e22514d135a27fe13087e8d185813aad..f405195d206cfb2ad9598c1861a884e5b1f1fd50 100644
index 80442494db670fec34df310390ea787fb963eef4..2dd512565ab901bf853f34b384155902b0fe8120 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -953,7 +953,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -954,7 +954,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
boolean var4;
try {
this.isSaving = true;
@@ -17,7 +17,7 @@ index 28e07984e22514d135a27fe13087e8d185813aad..f405195d206cfb2ad9598c1861a884e5
var4 = this.saveAllChunks(suppressLog, flush, forced);
} finally {
this.isSaving = false;
@@ -1532,9 +1532,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1533,9 +1533,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
this.ticksUntilAutosave--;
@@ -50,7 +50,7 @@ index 28e07984e22514d135a27fe13087e8d185813aad..f405195d206cfb2ad9598c1861a884e5
ProfilerFiller profilerFiller = Profiler.get();
this.runAllTasks(); // Paper - move runAllTasks() into full server tick (previously for timings)
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index cb8f47ec146d45ed223094e5ee9237cdc5a183be..25046b7822910b9b38820f572b924eb84247974f 100644
index 34b7769663e235b93c6388ab0c92c00f0297e42f..dda8d38ef61672cc714d9e5a475f9b0412ed5ff9 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -1339,6 +1339,28 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe

View File

@@ -48,10 +48,10 @@ index 0000000000000000000000000000000000000000..24a2090e068ad3c0d08705050944abdf
+ }
+}
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index f405195d206cfb2ad9598c1861a884e5b1f1fd50..9c4d690d1e4295ab4e73c9d5f34b5972969deda2 100644
index 2dd512565ab901bf853f34b384155902b0fe8120..d6dcb6d146d89a8fb96e7c669e5deb802223abd6 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1707,6 +1707,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1708,6 +1708,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
serverLevel.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
serverLevel.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
serverLevel.updateLagCompensationTick(); // Paper - lag compensation