From dd884986160a8bfeb550477496e2d18e28027caf Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Tue, 21 May 2024 08:41:36 -0700 Subject: [PATCH] Fix compile --- ...culate-regionfile-header-if-it-is-co.patch | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/patches/server/Attempt-to-recalculate-regionfile-header-if-it-is-co.patch b/patches/server/Attempt-to-recalculate-regionfile-header-if-it-is-co.patch index 68ed90bf27..4bd3c7a192 100644 --- a/patches/server/Attempt-to-recalculate-regionfile-header-if-it-is-co.patch +++ b/patches/server/Attempt-to-recalculate-regionfile-header-if-it-is-co.patch @@ -709,6 +709,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.folder = directory; this.sync = dsync; this.info = storageKey; + } + ++ // Paper start ++ @Nullable ++ public static ChunkPos getRegionFileCoordinates(Path file) { ++ String fileName = file.getFileName().toString(); ++ if (!fileName.startsWith("r.") || !fileName.endsWith(".mca")) { ++ return null; ++ } ++ ++ String[] split = fileName.split("\\."); ++ ++ if (split.length != 4) { ++ return null; ++ } ++ ++ try { ++ int x = Integer.parseInt(split[1]); ++ int z = Integer.parseInt(split[2]); ++ ++ return new ChunkPos(x << 5, z << 5); ++ } catch (NumberFormatException ex) { ++ return null; ++ } ++ } ++ // Paper end ++ + // Paper start + public synchronized RegionFile getRegionFileIfLoaded(ChunkPos chunkcoordintpair) { + return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ())); @@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable { // Paper - only create directory if not existing only - moved down Path path = this.folder;