From cf8e44347a435fd7cfd12873c051e701e47f5bfb Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> Date: Wed, 22 May 2024 20:02:57 +0300 Subject: [PATCH] Updated Upstream (Purpur) Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@248ba17 Updated Upstream (Paper) --- gradle.properties | 2 +- patches/server/0001-Divine-Branding.patch | 4 +- .../server/0002-Divine-Configuration.patch | 8 +- .../0015-Remove-Spigot-tick-limiter.patch | 4 +- ...1-Optimize-CraftServer.getWorld-UUID.patch | 8 +- patches/server/0035-Delete-Timings.patch | 18 ++--- .../0038-Implement-Linear-region-format.patch | 78 +++++-------------- 7 files changed, 43 insertions(+), 79 deletions(-) diff --git a/gradle.properties b/gradle.properties index d8a1b96..24964df 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ group = space.bxteam.divinemc mcVersion = 1.20.6 version = 1.20.6-R0.1-SNAPSHOT -purpurRef = 3d2569397afa45a8988762081cdff594e96a2c6c +purpurRef = 248ba175af2e1e472aff4eb6bcaa7ea0f7741dd5 org.gradle.caching = true org.gradle.parallel = true diff --git a/patches/server/0001-Divine-Branding.patch b/patches/server/0001-Divine-Branding.patch index fc7f72f..f23caca 100644 --- a/patches/server/0001-Divine-Branding.patch +++ b/patches/server/0001-Divine-Branding.patch @@ -196,10 +196,10 @@ index c366d84518979e842a6f10f969a5951539ecac93..b44daf19e76e9729980a4c871edd31dc stringbuilder.append("// "); stringbuilder.append(CrashReport.getErrorComment()); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 71705ccbc0cce88382b1fb536271773a332ad3a2..acb0e7d4cb383a37b18d5981ee55e78e08a66922 100644 +index 330bae815c0a332e3dc9fa7b224c9f92098199b9..a57ea225fb9951421d2026928c26f351d1b58cca 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -962,7 +962,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Faster redstone torch rapid clock removal; Move from Map in BlockRedstoneTorch to here -@@ -342,8 +340,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -333,8 +331,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { }); // CraftBukkit end this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings diff --git a/patches/server/0021-Optimize-CraftServer.getWorld-UUID.patch b/patches/server/0021-Optimize-CraftServer.getWorld-UUID.patch index 46dfbde..1759f77 100644 --- a/patches/server/0021-Optimize-CraftServer.getWorld-UUID.patch +++ b/patches/server/0021-Optimize-CraftServer.getWorld-UUID.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Optimize CraftServer.getWorld(UUID) Original code by MultiPaper - https://github.com/MultiPaper/MultiPaper diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index dd0f1013f3de00d67e6b3d69ed09176176bc6a0b..9d3d7118bae9315b08291e3f5a2052e2100c0037 100644 +index ab9065c2d21f713b366e5cfd1534538fd2617782..318cc15ec0a1a70d32e2637b08c48677d38d14a3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -264,6 +264,7 @@ import javax.annotation.Nullable; // Paper @@ -25,7 +25,7 @@ index dd0f1013f3de00d67e6b3d69ed09176176bc6a0b..9d3d7118bae9315b08291e3f5a2052e2 private YamlConfiguration configuration; private YamlConfiguration commandsConfiguration; private final Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions())); -@@ -1469,6 +1471,7 @@ public final class CraftServer implements Server { +@@ -1464,6 +1466,7 @@ public final class CraftServer implements Server { this.getLogger().log(Level.SEVERE, null, ex); } @@ -33,7 +33,7 @@ index dd0f1013f3de00d67e6b3d69ed09176176bc6a0b..9d3d7118bae9315b08291e3f5a2052e2 this.worlds.remove(world.getName().toLowerCase(java.util.Locale.ENGLISH)); this.console.removeLevel(handle); return true; -@@ -1487,6 +1490,7 @@ public final class CraftServer implements Server { +@@ -1482,6 +1485,7 @@ public final class CraftServer implements Server { @Override public World getWorld(UUID uid) { @@ -41,7 +41,7 @@ index dd0f1013f3de00d67e6b3d69ed09176176bc6a0b..9d3d7118bae9315b08291e3f5a2052e2 for (World world : this.worlds.values()) { if (world.getUID().equals(uid)) { return world; -@@ -1510,6 +1514,7 @@ public final class CraftServer implements Server { +@@ -1505,6 +1509,7 @@ public final class CraftServer implements Server { System.out.println("World " + world.getName() + " is a duplicate of another world and has been prevented from loading. Please delete the uid.dat file from " + world.getName() + "'s world directory if you want to be able to load the duplicate world."); return; } diff --git a/patches/server/0035-Delete-Timings.patch b/patches/server/0035-Delete-Timings.patch index 9a8f58d..e87105d 100644 --- a/patches/server/0035-Delete-Timings.patch +++ b/patches/server/0035-Delete-Timings.patch @@ -863,7 +863,7 @@ index 8c134a642ccaf3530022f2e675a858d726e1dda4..d6daa27a8d7aca00b181e90d789f4249 } catch (Exception exception) { if (exception instanceof ReportedException) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index acb0e7d4cb383a37b18d5981ee55e78e08a66922..08ec1a1c9b4a044c2ae6da145f09645d89da96cb 100644 +index a57ea225fb9951421d2026928c26f351d1b58cca..9fa1c5d6a8f313cd3d0f99131da60b640fff5587 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -3,7 +3,6 @@ package net.minecraft.server; @@ -883,7 +883,7 @@ index acb0e7d4cb383a37b18d5981ee55e78e08a66922..08ec1a1c9b4a044c2ae6da145f09645d public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements ServerInfo, CommandSource, AutoCloseable { private static MinecraftServer SERVER; // Paper -@@ -978,7 +975,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions -@@ -339,7 +338,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -330,7 +329,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public void onBorderSetDamageSafeZOne(WorldBorder border, double safeZoneRadius) {} }); // CraftBukkit end @@ -1187,7 +1187,7 @@ index 02899e5bdb23d8e032c721beaac3f280201394b2..0011a17fa517c7540099829623db3609 this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray // Paper start - optimise collisions this.minSection = io.papermc.paper.util.WorldUtil.getMinSection(this); -@@ -1342,9 +1340,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1333,9 +1331,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 diff --git a/patches/server/0038-Implement-Linear-region-format.patch b/patches/server/0038-Implement-Linear-region-format.patch index 357d8d7..75e6c96 100644 --- a/patches/server/0038-Implement-Linear-region-format.patch +++ b/patches/server/0038-Implement-Linear-region-format.patch @@ -86,45 +86,11 @@ index 2934f0cf0ef09c84739312b00186c2ef0019a165..4405fa692b9994d14205fdc85ddf9f6c } } } -diff --git a/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java -index 7f6d1ccd147e5593412567bb2934ce5662da7ef0..8b232e22b1db41043ccc38e672c9bb3bcb28c8d6 100644 ---- a/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java -+++ b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java -@@ -9,7 +9,6 @@ import net.minecraft.nbt.CompoundTag; - import net.minecraft.resources.ResourceKey; - import net.minecraft.util.worldupdate.WorldUpgrader; - import net.minecraft.world.level.ChunkPos; --import net.minecraft.world.level.Level; - import net.minecraft.world.level.chunk.ChunkGenerator; - import net.minecraft.world.level.chunk.storage.ChunkStorage; - import net.minecraft.world.level.chunk.storage.RegionFileStorage; -@@ -19,6 +18,9 @@ import net.minecraft.world.level.storage.DimensionDataStorage; - import net.minecraft.world.level.storage.LevelStorageSource; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -+import org.bukkit.Bukkit; -+import org.bukkit.craftbukkit.CraftWorld; -+ - import java.io.File; - import java.io.IOException; - import java.text.DecimalFormat; -@@ -97,8 +99,10 @@ public class ThreadedWorldUpgrader { - "region" - ); - -+ space.bxteam.divinemc.region.RegionFileFormat formatName = ((CraftWorld) Bukkit.getWorld(worldName)).getHandle().divinemcConfig.regionFormatName; -+ int linearCompression = ((CraftWorld) Bukkit.getWorld(worldName)).getHandle().divinemcConfig.regionFormatLinearCompressionLevel; - final WorldInfo info = new WorldInfo(() -> worldPersistentData, -- new ChunkStorage(storageInfo, regionFolder.toPath(), this.dataFixer, false), this.removeCaches, this.dimensionType, this.generatorKey); -+ new ChunkStorage(formatName, linearCompression, storageInfo, regionFolder.toPath(), this.dataFixer, false), this.removeCaches, this.dimensionType, this.generatorKey); - - long expectedChunks = (long)regionFiles.length * (32L * 32L); - diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index eca0c8afe003e0c3155aded8b5a9855ad0952e60..0271452c3ddf2e95df3f6f8a6b1cbe3b76678658 100644 +index 9fa1c5d6a8f313cd3d0f99131da60b640fff5587..0fab6be4b5c5fcf539238b5f67cc9f8e0aac8af4 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -887,7 +887,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage, this.entitySliceManager); // Paper // Paper - rewrite chunk system StructureTemplateManager structuretemplatemanager = minecraftserver.getStructureManager(); diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java -index 3e582c49069f2a820ba3baac03917493877d9875..595a946b4f0e30e88f28e182d506375fea9f109b 100644 +index 954d468459fe167ede0e7fca5b9f99da565d59e1..ea6f0abe2341fc549ba75cb213305c054b635fc0 100644 --- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java +++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java @@ -76,7 +76,7 @@ public class WorldUpgrader { volatile int skipped; final Reference2FloatMap> progressMap = Reference2FloatMaps.synchronize(new Reference2FloatOpenHashMap()); volatile Component status = Component.translatable("optimizeWorld.stage.counting"); -- public static final Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.mca$"); -+ public static final Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.(linear | mca)$"); // DivineMC +- static final Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.mca$"); ++ static final Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.(linear | mca)$"); // DivineMC final DimensionDataStorage overworldDataStorage; public WorldUpgrader(LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, RegistryAccess dynamicRegistryManager, boolean eraseCache, boolean recreateRegionFiles) { @@ -466,7 +432,7 @@ index 1362a47943cf1a51a185a15094b1f74c94bf40ef..66caa91f56a4e9afaf1e501f80ad7cd5 try (DataInputStream out = new DataInputStream(new java.io.BufferedInputStream(new InflaterInputStream(Files.newInputStream(file))))) { return NbtIo.read((java.io.DataInput) out); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index f6e3b745fc417354380d4a969f83aee430bad785..155bc3d2ef7945a44421c660834641d5d4e48e82 100644 +index 1090b7e36e3c1c105bc36135b82751c651f237d4..c2ebcc3428a7048039bb5e2a393f4820c394ec3c 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -21,10 +21,14 @@ public class RegionFileStorage implements AutoCloseable { @@ -513,13 +479,11 @@ index f6e3b745fc417354380d4a969f83aee430bad785..155bc3d2ef7945a44421c660834641d5 return null; } -@@ -91,30 +99,30 @@ public class RegionFileStorage implements AutoCloseable { - return null; - } - } -- +@@ -94,29 +102,29 @@ public class RegionFileStorage implements AutoCloseable { + // Paper end + + // Paper start - public synchronized RegionFile getRegionFileIfLoaded(ChunkPos chunkcoordintpair) { -+ + public synchronized space.bxteam.divinemc.region.AbstractRegionFile getRegionFileIfLoaded(ChunkPos chunkcoordintpair) { // DivineMC return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ())); } @@ -551,7 +515,7 @@ index f6e3b745fc417354380d4a969f83aee430bad785..155bc3d2ef7945a44421c660834641d5 } // Paper end return regionfile; -@@ -125,28 +133,41 @@ public class RegionFileStorage implements AutoCloseable { +@@ -127,28 +135,41 @@ public class RegionFileStorage implements AutoCloseable { } // Paper end - cache regionfile does not exist state if (this.regionCache.size() >= io.papermc.paper.configuration.GlobalConfiguration.get().misc.regionFileCacheSize) { // Paper - Sanitise RegionFileCache and make configurable @@ -600,7 +564,7 @@ index f6e3b745fc417354380d4a969f83aee430bad785..155bc3d2ef7945a44421c660834641d5 } // Paper end return regionfile1; -@@ -158,7 +179,7 @@ public class RegionFileStorage implements AutoCloseable { +@@ -160,7 +181,7 @@ public class RegionFileStorage implements AutoCloseable { org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PAPER - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); } @@ -609,7 +573,7 @@ index f6e3b745fc417354380d4a969f83aee430bad785..155bc3d2ef7945a44421c660834641d5 synchronized (regionfile) { try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) { CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z); -@@ -193,14 +214,14 @@ public class RegionFileStorage implements AutoCloseable { +@@ -195,14 +216,14 @@ public class RegionFileStorage implements AutoCloseable { @Nullable public CompoundTag read(ChunkPos pos) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing @@ -626,7 +590,7 @@ index f6e3b745fc417354380d4a969f83aee430bad785..155bc3d2ef7945a44421c660834641d5 // We add the regionfile parameter to avoid the potential deadlock (on fileLock) if we went back to obtain a regionfile // if we decide to re-read // Paper end -@@ -210,7 +231,7 @@ public class RegionFileStorage implements AutoCloseable { +@@ -212,7 +233,7 @@ public class RegionFileStorage implements AutoCloseable { // Paper start if (regionfile.isOversized(pos.x, pos.z)) { @@ -635,7 +599,7 @@ index f6e3b745fc417354380d4a969f83aee430bad785..155bc3d2ef7945a44421c660834641d5 return readOversizedChunk(regionfile, pos); } // Paper end -@@ -224,12 +245,12 @@ public class RegionFileStorage implements AutoCloseable { +@@ -226,12 +247,12 @@ public class RegionFileStorage implements AutoCloseable { if (this.isChunkData) { ChunkPos chunkPos = ChunkSerializer.getChunkCoordinate(nbttagcompound); if (!chunkPos.equals(pos)) { @@ -651,7 +615,7 @@ index f6e3b745fc417354380d4a969f83aee430bad785..155bc3d2ef7945a44421c660834641d5 return null; } } -@@ -263,13 +284,13 @@ public class RegionFileStorage implements AutoCloseable { +@@ -265,13 +286,13 @@ public class RegionFileStorage implements AutoCloseable { return nbttagcompound; } finally { // Paper start @@ -667,7 +631,7 @@ index f6e3b745fc417354380d4a969f83aee430bad785..155bc3d2ef7945a44421c660834641d5 if (regionfile == null) { return; } -@@ -300,7 +321,7 @@ public class RegionFileStorage implements AutoCloseable { +@@ -302,7 +323,7 @@ public class RegionFileStorage implements AutoCloseable { protected void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException { // Paper start - rewrite chunk system @@ -676,7 +640,7 @@ index f6e3b745fc417354380d4a969f83aee430bad785..155bc3d2ef7945a44421c660834641d5 if (nbt == null && regionfile == null) { return; } -@@ -355,7 +376,7 @@ public class RegionFileStorage implements AutoCloseable { +@@ -357,7 +378,7 @@ public class RegionFileStorage implements AutoCloseable { // Paper end - Chunk save reattempt // Paper start - rewrite chunk system } finally { @@ -685,7 +649,7 @@ index f6e3b745fc417354380d4a969f83aee430bad785..155bc3d2ef7945a44421c660834641d5 } // Paper end - rewrite chunk system } -@@ -365,7 +386,7 @@ public class RegionFileStorage implements AutoCloseable { +@@ -367,7 +388,7 @@ public class RegionFileStorage implements AutoCloseable { ObjectIterator objectiterator = this.regionCache.values().iterator(); while (objectiterator.hasNext()) { @@ -694,7 +658,7 @@ index f6e3b745fc417354380d4a969f83aee430bad785..155bc3d2ef7945a44421c660834641d5 try { regionfile.close(); -@@ -381,7 +402,7 @@ public class RegionFileStorage implements AutoCloseable { +@@ -383,7 +404,7 @@ public class RegionFileStorage implements AutoCloseable { ObjectIterator objectiterator = this.regionCache.values().iterator(); while (objectiterator.hasNext()) {