mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
8c5b837e05
Firstly, the old methods all routed to the CompletableFuture method. However, the CF method could not guarantee that if the caller was off-main that the future would be "completed" on-main. Since the callback methods used the CF one, this meant that the callback methods did not guarantee that the callbacks were to be called on the main thread. Now, all methods route to getChunkAtAsync(x, z, gen, urgent, cb) so that the methods with the callback are guaranteed to invoke the callback on the main thread. The CF behavior remains unchanged; it may still appear to complete on main if invoked off-main. Secondly, remove the scheduleOnMain invocation in the async chunk completion. This unnecessarily delays the callback by 1 tick. Thirdly, add getChunksAtAsync(minX, minZ, maxX, maxZ, ...) which will load chunks within an area. This method is provided as a helper as keeping all chunks loaded within an area can be complicated to implement for plugins (due to the lacking ticket API), and is already implemented internally anyways. Fourthly, remove the ticket addition that occured with getChunkAt and getChunkAtAsync. The ticket addition may delay the unloading of the chunk unnecessarily. It also fixes a very rare timing bug where the future/callback would be completed after the chunk unloads.
22 lines
1.2 KiB
Diff
22 lines
1.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Newwind <support@newwindserver.com>
|
|
Date: Fri, 20 Sep 2024 14:17:37 +0200
|
|
Subject: [PATCH] Disable pretty printing for advancement saving
|
|
|
|
Reduces json size by about 25%
|
|
Not sure why advancements even had pretty printing enabled.
|
|
My best guess was by accident on mojang's part, especially since stats json files don't have pretty printing.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
|
index 1dcb8a287be7df2a59b5b4c1345be80637a7f679..8e2eb7b61421ceb063654826941f1a81f6f50bdf 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
|
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
|
|
public class PlayerAdvancements {
|
|
|
|
private static final Logger LOGGER = LogUtils.getLogger();
|
|
- private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().create();
|
|
+ private static final Gson GSON = (new GsonBuilder()).create(); // Paper - Remove pretty printing from advancements
|
|
private final PlayerList playerList;
|
|
private final Path playerSavePath;
|
|
private AdvancementTree tree;
|