From 3241691aeab3e11191dae7a16f99e6eae1795071 Mon Sep 17 00:00:00 2001 From: Cryptite Date: Tue, 25 Apr 2023 08:01:34 -0500 Subject: [PATCH] Grr --- .../0022-Shared-DataFolder-for-maps.patch | 125 ------------------ 1 file changed, 125 deletions(-) delete mode 100644 patches/server/0022-Shared-DataFolder-for-maps.patch diff --git a/patches/server/0022-Shared-DataFolder-for-maps.patch b/patches/server/0022-Shared-DataFolder-for-maps.patch deleted file mode 100644 index 023592a6e..000000000 --- a/patches/server/0022-Shared-DataFolder-for-maps.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Cryptite -Date: Tue, 18 Apr 2023 08:16:32 -0500 -Subject: [PATCH] Shared DataFolder for maps - - -diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index 8d442c5a498ecf288a0cc0c54889c6e2fda849ce..8fc13d7b004da228fc58554ea5058ef8e58833a4 100644 ---- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -@@ -286,5 +286,6 @@ public class GlobalConfiguration extends ConfigurationPart { - public boolean lagCompensateBlockBreaking = true; - public boolean useDimensionTypeForCustomSpawners = false; - public boolean strictAdvancementDimensionCheck = false; -+ public String sharedDataFolder; // Slice - } - } -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index fa14ab3d8117e9d357380d21d3c6a2cd1df7c04c..bf79373dd6a0cf1e8252555d43012371390a51c7 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -313,6 +313,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function serverFactory) { - AtomicReference atomicreference = new AtomicReference(); -@@ -413,6 +414,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { -+ return (MapItemSavedData) this.getServer().getMapDataStorage().get((nbttagcompound) -> { // Slice - // We only get here when the data file exists, but is not a valid map - MapItemSavedData newMap = MapItemSavedData.load(nbttagcompound); - newMap.id = id; -@@ -1940,12 +1940,22 @@ public class ServerLevel extends Level implements WorldGenLevel { - @Override - public void setMapData(String id, MapItemSavedData state) { - state.id = id; // CraftBukkit -- this.getServer().overworld().getDataStorage().set(id, state); -+ this.getServer().getMapDataStorage().set(id, state); // Slice - } - - @Override - public int getFreeMapId() { -- return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex::load, MapIndex::new, "idcounts")).getFreeAuxValueForMap(); -+ // Slice start -+ DimensionDataStorage storage = this.getServer().getMapDataStorage(); -+ MapIndex mapIndex = storage.readSavedData(MapIndex::load, "idcounts"); -+ if (mapIndex == null) { -+ mapIndex = new MapIndex(); -+ } -+ int newId = mapIndex.getFreeAuxValueForMap(); -+ storage.set("idcounts", mapIndex); -+ storage.save(); -+ return newId; -+ // Slice end - } - - // Paper start - helper function for configurable spawn radius -diff --git a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java -index defe31a5d3aa89a3d18b94f2ff005594e38754b3..637a86e74d633901fdd2f2f1ba6aa4ed49780ead 100644 ---- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java -+++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java -@@ -58,7 +58,7 @@ public class DimensionDataStorage { - } - - @Nullable -- private T readSavedData(Function readFunction, String id) { -+ public T readSavedData(Function readFunction, String id) { // Slice private -> public - try { - File file = this.getDataFile(id); - if (file.exists()) {