mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-26 10:29:13 +00:00
添加区域格式
This commit is contained in:
114
patches/server/0045-Region-format-configuration.patch
Normal file
114
patches/server/0045-Region-format-configuration.patch
Normal file
@@ -0,0 +1,114 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Triassic <techbyteofficial9@gmail.com>
|
||||
Date: Fri, 22 Sep 2023 23:27:14 +0300
|
||||
Subject: [PATCH] Region format configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index f69976dcba060027c67c2e1b49fa28d3f28f66f0..0bf2f897b8bbb44e223c5c4f3d22130a01cc545c 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<TickTa
|
||||
// Paper start - rewrite chunk system
|
||||
worldserver.save((ProgressListener) null, flush, worldserver.noSave && !force, close);
|
||||
if (flush) {
|
||||
- MinecraftServer.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", worldserver.getChunkSource().chunkMap.getStorageName());
|
||||
+ MinecraftServer.LOGGER.info("ThreadedChunkStorage ({}): All chunks are saved", worldserver.getChunkSource().chunkMap.getStorageName()); // LinearPurpur
|
||||
}
|
||||
// Paper end - rewrite chunk system
|
||||
}
|
||||
@@ -911,7 +911,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
//MinecraftServer.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", worldserver2.getChunkSource().chunkMap.getStorageName()); // Paper - move up
|
||||
}
|
||||
|
||||
- MinecraftServer.LOGGER.info("ThreadedAnvilChunkStorage: All dimensions are saved");
|
||||
+ MinecraftServer.LOGGER.info("ThreadedChunkStorage: All dimensions are saved"); // LinearPurpur
|
||||
}
|
||||
|
||||
return flag3;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 501cd8fd2e85b2cdb4183bbbafda42bdc1a3b850..0f1c925236a519934dcdbb23e67e3e7f2a878b86 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -246,6 +246,19 @@ public class PurpurConfig {
|
||||
useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive);
|
||||
}
|
||||
|
||||
+ // LinearPurpur start - region format configuration
|
||||
+ public static int linearFlushFrequency = 10;
|
||||
+ public static int linearFlushThreads = 1;
|
||||
+ private static void regionFormatSettings() {
|
||||
+ linearFlushFrequency = getInt("region-format.linear.flush-frequency", linearFlushFrequency);
|
||||
+ linearFlushThreads = getInt("region-format.linear.flush-max-threads", linearFlushThreads);
|
||||
+ if (linearFlushThreads < 0)
|
||||
+ linearFlushThreads = Math.max(Runtime.getRuntime().availableProcessors() + linearFlushThreads, 1);
|
||||
+ else
|
||||
+ linearFlushThreads = Math.max(linearFlushThreads, 1);
|
||||
+ }
|
||||
+ // LinearPurpur end
|
||||
+
|
||||
public static boolean disableGiveCommandDrops = false;
|
||||
private static void disableGiveCommandDrops() {
|
||||
disableGiveCommandDrops = getBoolean("settings.disable-give-dropping", disableGiveCommandDrops);
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index dab252cbadffbcdf19bacc0b378d671b29393e9c..7848aedd5f616ddbc96cf075a28b6bd0aa30c46c 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -27,6 +27,7 @@ import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
import static org.purpurmc.purpur.PurpurConfig.log;
|
||||
+import org.purpurmc.purpur.region.RegionFileFormat;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class PurpurWorldConfig {
|
||||
@@ -118,6 +119,27 @@ public class PurpurWorldConfig {
|
||||
arrowMovementResetsDespawnCounter = getBoolean("gameplay-mechanics.arrow.movement-resets-despawn-counter", arrowMovementResetsDespawnCounter);
|
||||
}
|
||||
|
||||
+ // LinearPurpur start - region format configuration
|
||||
+ public RegionFileFormat regionFormatName = RegionFileFormat.ANVIL;
|
||||
+ public boolean linearCrashOnBrokenSymlink = true;
|
||||
+ public int regionFormatLinearCompressionLevel = 1;
|
||||
+ private void regionFormatSettings() {
|
||||
+ regionFormatName = RegionFileFormat.fromString(getString("region-format.format", regionFormatName.name()));
|
||||
+ if (regionFormatName.equals(RegionFileFormat.INVALID)) {
|
||||
+ log(Level.SEVERE, "Unknown region format in purpur.yml: " + regionFormatName);
|
||||
+ log(Level.SEVERE, "Falling back to ANVIL region file format.");
|
||||
+ regionFormatName = RegionFileFormat.ANVIL;
|
||||
+ }
|
||||
+ regionFormatLinearCompressionLevel = getInt("region-format.linear.compression-level", regionFormatLinearCompressionLevel);
|
||||
+ if (regionFormatLinearCompressionLevel > 23 || regionFormatLinearCompressionLevel < 1) {
|
||||
+ log(Level.SEVERE, "Linear region compression level should be between 1 and 22 in purpur.yml: " + regionFormatLinearCompressionLevel);
|
||||
+ log(Level.SEVERE, "Falling back to compression level 1.");
|
||||
+ regionFormatLinearCompressionLevel = 1;
|
||||
+ }
|
||||
+ linearCrashOnBrokenSymlink = getBoolean("region-format.linear.crash-on-broken-symlink", linearCrashOnBrokenSymlink);
|
||||
+ }
|
||||
+ // LinearPurpur end
|
||||
+
|
||||
public boolean useBetterMending = false;
|
||||
public double mendingMultiplier = 1.0;
|
||||
public boolean alwaysTameInCreative = false;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/region/RegionFileFormat.java b/src/main/java/org/purpurmc/purpur/region/RegionFileFormat.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..593d684da10368e8cb37628445b36a826719e79e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/region/RegionFileFormat.java
|
||||
@@ -0,0 +1,16 @@
|
||||
+package org.purpurmc.purpur.region;
|
||||
+
|
||||
+public enum RegionFileFormat {
|
||||
+ ANVIL,
|
||||
+ LINEAR,
|
||||
+ INVALID;
|
||||
+
|
||||
+ public static RegionFileFormat fromString(String format) {
|
||||
+ for (RegionFileFormat rff : values()) {
|
||||
+ if (rff.name().equalsIgnoreCase(format)) {
|
||||
+ return rff;
|
||||
+ }
|
||||
+ }
|
||||
+ return RegionFileFormat.INVALID;
|
||||
+ }
|
||||
+}
|
||||
1070
patches/server/0046-Add-Linear-region-format.patch
Normal file
1070
patches/server/0046-Add-Linear-region-format.patch
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user