From 45d40874ec1b0f593de1a2a92aefee15572b327f Mon Sep 17 00:00:00 2001 From: MrHua269 Date: Sun, 12 Jan 2025 15:32:43 +0800 Subject: [PATCH] Move file patches to feature patches --- luminol-server/build.gradle.kts.patch | 11 ++ ...31-Gale-Use-platform-math-functions.patch} | 0 ...le-Variable-entity-wake-up-duration.patch} | 8 +- .../0028-Pufferfish-SIMD-Utilities.patch} | 11 +- .../0029-Pufferfish-Sentry.patch} | 115 +++++++++++++++++- ...le-Variable-entity-wake-up-duration.patch} | 11 +- .../sentry/SentryManager.java.patch | 47 ------- .../modules/misc/SentryConfig.java.patch | 50 -------- 8 files changed, 148 insertions(+), 105 deletions(-) rename luminol-server/minecraft-patches/features/{0032-Gale-Use-platform-math-functions.patch => 0031-Gale-Use-platform-math-functions.patch} (100%) rename luminol-server/minecraft-patches/features/{0031-Gale-Variable-entity-wake-up-duration.patch => 0032-Gale-Variable-entity-wake-up-duration.patch} (94%) rename luminol-server/paper-patches/{files/src/main/java/me/earthme/luminol/config/modules/optimizations/SIMDConfig.java.patch => features/0028-Pufferfish-SIMD-Utilities.patch} (82%) rename luminol-server/paper-patches/{files/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java.patch => features/0029-Pufferfish-Sentry.patch} (54%) rename luminol-server/paper-patches/{files/src/main/java/me/earthme/luminol/config/modules/optimizations/GaleVariableEntityWakeupConfig.java.patch => features/0030-Gale-Variable-entity-wake-up-duration.patch} (59%) delete mode 100644 luminol-server/paper-patches/files/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java.patch delete mode 100644 luminol-server/paper-patches/files/src/main/java/me/earthme/luminol/config/modules/misc/SentryConfig.java.patch diff --git a/luminol-server/build.gradle.kts.patch b/luminol-server/build.gradle.kts.patch index d5cf00d..e007138 100644 --- a/luminol-server/build.gradle.kts.patch +++ b/luminol-server/build.gradle.kts.patch @@ -99,3 +99,14 @@ "Build-Number" to (build ?: ""), "Build-Time" to buildTime.toString(), "Git-Branch" to gitBranch, +@@ -354,3 +_,10 @@ + classpath(tasks.createReobfPaperclipJar.flatMap { it.outputZip }) + mainClass.set(null as String?) + } ++ ++// Pufferfish Start ++tasks.withType { ++ val compilerArgs = options.compilerArgs ++ compilerArgs.add("--add-modules=jdk.incubator.vector") ++} ++// Pufferfish End diff --git a/luminol-server/minecraft-patches/features/0032-Gale-Use-platform-math-functions.patch b/luminol-server/minecraft-patches/features/0031-Gale-Use-platform-math-functions.patch similarity index 100% rename from luminol-server/minecraft-patches/features/0032-Gale-Use-platform-math-functions.patch rename to luminol-server/minecraft-patches/features/0031-Gale-Use-platform-math-functions.patch diff --git a/luminol-server/minecraft-patches/features/0031-Gale-Variable-entity-wake-up-duration.patch b/luminol-server/minecraft-patches/features/0032-Gale-Variable-entity-wake-up-duration.patch similarity index 94% rename from luminol-server/minecraft-patches/features/0031-Gale-Variable-entity-wake-up-duration.patch rename to luminol-server/minecraft-patches/features/0032-Gale-Variable-entity-wake-up-duration.patch index 13dc691..e6fb9f4 100644 --- a/luminol-server/minecraft-patches/features/0031-Gale-Variable-entity-wake-up-duration.patch +++ b/luminol-server/minecraft-patches/features/0032-Gale-Variable-entity-wake-up-duration.patch @@ -1,14 +1,14 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MrHua269 -Date: Sun, 12 Jan 2025 14:12:07 +0800 +Date: Sun, 12 Jan 2025 15:31:52 +0800 Subject: [PATCH] Gale Variable entity wake-up duration diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java -index 76e0b50b2dc9c718a67f89de720a891b398cec2a..4f0d6495fe8ae1d8104f31614350da7f84647505 100644 +index 76e0b50b2dc9c718a67f89de720a891b398cec2a..e3d2371e36b48bb820931394e5b4182152f57630 100644 --- a/io/papermc/paper/entity/activation/ActivationRange.java +++ b/io/papermc/paper/entity/activation/ActivationRange.java -@@ -54,27 +54,41 @@ public final class ActivationRange { +@@ -54,27 +54,39 @@ public final class ActivationRange { if (entity.activationType == ActivationType.VILLAGER) { if (inactiveFor > config.wakeUpInactiveVillagersEvery && worldData.wakeupInactiveRemainingVillagers > 0) { // Folia - threaded regions worldData.wakeupInactiveRemainingVillagers--; // Folia - threaded regions @@ -48,8 +48,6 @@ index 76e0b50b2dc9c718a67f89de720a891b398cec2a..4f0d6495fe8ae1d8104f31614350da7f + return (int) Math.min(Integer.MAX_VALUE, Math.max(1, Math.round(wakeUpDuration * wakeUpDurationRandom.nextGaussian(1, deviation)))); + } + // Gale end - variable entity wake-up duration -+ -+ + //static AABB maxBB = new AABB(0, 0, 0, 0, 0, 0); // Folia - threaded regions - replaced by local variable diff --git a/luminol-server/paper-patches/files/src/main/java/me/earthme/luminol/config/modules/optimizations/SIMDConfig.java.patch b/luminol-server/paper-patches/features/0028-Pufferfish-SIMD-Utilities.patch similarity index 82% rename from luminol-server/paper-patches/files/src/main/java/me/earthme/luminol/config/modules/optimizations/SIMDConfig.java.patch rename to luminol-server/paper-patches/features/0028-Pufferfish-SIMD-Utilities.patch index 2f696dc..3b7b65b 100644 --- a/luminol-server/paper-patches/files/src/main/java/me/earthme/luminol/config/modules/optimizations/SIMDConfig.java.patch +++ b/luminol-server/paper-patches/features/0028-Pufferfish-SIMD-Utilities.patch @@ -1,6 +1,15 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrHua269 +Date: Sun, 12 Jan 2025 15:22:25 +0800 +Subject: [PATCH] Pufferfish SIMD Utilities + + +diff --git a/src/main/java/me/earthme/luminol/config/modules/optimizations/SIMDConfig.java b/src/main/java/me/earthme/luminol/config/modules/optimizations/SIMDConfig.java +new file mode 100644 +index 0000000000000000000000000000000000000000..76cea165bcef0794a66ef7c29721f7716869420f --- /dev/null +++ b/src/main/java/me/earthme/luminol/config/modules/optimizations/SIMDConfig.java -@@ -1,0 +_,53 @@ +@@ -0,0 +1,53 @@ +package me.earthme.luminol.config.modules.optimizations; + +import com.electronwill.nightconfig.core.file.CommentedFileConfig; diff --git a/luminol-server/paper-patches/files/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java.patch b/luminol-server/paper-patches/features/0029-Pufferfish-Sentry.patch similarity index 54% rename from luminol-server/paper-patches/files/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java.patch rename to luminol-server/paper-patches/features/0029-Pufferfish-Sentry.patch index 7cbeb55..cb5d96d 100644 --- a/luminol-server/paper-patches/files/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java.patch +++ b/luminol-server/paper-patches/features/0029-Pufferfish-Sentry.patch @@ -1,6 +1,15 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrHua269 +Date: Sun, 12 Jan 2025 15:26:09 +0800 +Subject: [PATCH] Pufferfish Sentry + + +diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java b/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java +new file mode 100644 +index 0000000000000000000000000000000000000000..2b830cb288ceba390ed39cd33fc1ee855357a97e --- /dev/null +++ b/src/main/java/gg/pufferfish/pufferfish/sentry/PufferfishSentryAppender.java -@@ -1,0 +_,133 @@ +@@ -0,0 +1,133 @@ +package gg.pufferfish.pufferfish.sentry; + +import com.google.common.reflect.TypeToken; @@ -134,3 +143,107 @@ + } + } +} +diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c01e5b5de685eca7edbe8a87732efd45d4dd2557 +--- /dev/null ++++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java +@@ -0,0 +1,44 @@ ++package gg.pufferfish.pufferfish.sentry; ++ ++import io.sentry.Sentry; ++import org.apache.logging.log4j.Level; ++import org.apache.logging.log4j.LogManager; ++import org.apache.logging.log4j.Logger; ++ ++public class SentryManager { ++ ++ private static final Logger logger = LogManager.getLogger(SentryManager.class); ++ ++ private SentryManager() { ++ ++ } ++ ++ private static boolean initialized = false; ++ ++ public static synchronized void init(Level logLevel) { ++ if (initialized) { ++ return; ++ } ++ if (logLevel == null) { ++ logger.error("Invalid log level, defaulting to WARN."); ++ logLevel = Level.WARN; ++ } ++ try { ++ initialized = true; ++ ++ Sentry.init(options -> { ++ options.setDsn(me.earthme.luminol.config.modules.misc.SentryConfig.sentryDsn); ++ options.setMaxBreadcrumbs(100); ++ }); ++ ++ PufferfishSentryAppender appender = new PufferfishSentryAppender(logLevel); ++ appender.start(); ++ ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()).addAppender(appender); ++ logger.info("Sentry logging started!"); ++ } catch (Exception e) { ++ logger.warn("Failed to initialize sentry!", e); ++ initialized = false; ++ } ++ } ++ ++} +diff --git a/src/main/java/me/earthme/luminol/config/modules/misc/SentryConfig.java b/src/main/java/me/earthme/luminol/config/modules/misc/SentryConfig.java +new file mode 100644 +index 0000000000000000000000000000000000000000..55d6bb635b182d15471bfcd481a2b7c6ce26c00b +--- /dev/null ++++ b/src/main/java/me/earthme/luminol/config/modules/misc/SentryConfig.java +@@ -0,0 +1,47 @@ ++package me.earthme.luminol.config.modules.misc; ++ ++import com.electronwill.nightconfig.core.file.CommentedFileConfig; ++import me.earthme.luminol.config.ConfigInfo; ++import me.earthme.luminol.config.EnumConfigCategory; ++import me.earthme.luminol.config.IConfigModule; ++import org.apache.logging.log4j.Level; ++ ++public class SentryConfig implements IConfigModule { ++ ++ @ConfigInfo(baseName = "dsn", comments = ++ " Sentry DSN for improved error logging, leave blank to disable,\n" + ++ " Obtain from https://sentry.io/") ++ public static String sentryDsn = ""; ++ ++ @ConfigInfo(baseName = "log_level", comments = " Logs with a level higher than or equal to this level will be recorded.") ++ public static String logLevel = "WARN"; ++ ++ @ConfigInfo(baseName = "only_log_thrown", comments = " Only log with a Throwable will be recorded after enabling this.") ++ public static boolean onlyLogThrown = true; ++ ++ @Override ++ public EnumConfigCategory getCategory() { ++ return EnumConfigCategory.MISC; ++ } ++ ++ @Override ++ public String getBaseName() { ++ return "sentry"; ++ } ++ ++ @Override ++ public void onLoaded(CommentedFileConfig configInstance) { ++ String sentryEnvironment = System.getenv("SENTRY_DSN"); ++ ++ sentryDsn = sentryEnvironment != null && !sentryEnvironment.isBlank() ++ ? sentryEnvironment ++ : configInstance.getOrElse("sentry.dsn", sentryDsn); ++ ++ logLevel = configInstance.getOrElse("sentry.log-level", logLevel); ++ onlyLogThrown = configInstance.getOrElse("sentry.only-log-thrown", onlyLogThrown); ++ ++ if (sentryDsn != null && !sentryDsn.isBlank()) { ++ gg.pufferfish.pufferfish.sentry.SentryManager.init(Level.getLevel(logLevel)); ++ } ++ } ++} +\ No newline at end of file diff --git a/luminol-server/paper-patches/files/src/main/java/me/earthme/luminol/config/modules/optimizations/GaleVariableEntityWakeupConfig.java.patch b/luminol-server/paper-patches/features/0030-Gale-Variable-entity-wake-up-duration.patch similarity index 59% rename from luminol-server/paper-patches/files/src/main/java/me/earthme/luminol/config/modules/optimizations/GaleVariableEntityWakeupConfig.java.patch rename to luminol-server/paper-patches/features/0030-Gale-Variable-entity-wake-up-duration.patch index 70f5dd7..10f53f9 100644 --- a/luminol-server/paper-patches/files/src/main/java/me/earthme/luminol/config/modules/optimizations/GaleVariableEntityWakeupConfig.java.patch +++ b/luminol-server/paper-patches/features/0030-Gale-Variable-entity-wake-up-duration.patch @@ -1,6 +1,15 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrHua269 +Date: Sun, 12 Jan 2025 15:31:53 +0800 +Subject: [PATCH] Gale Variable entity wake-up duration + + +diff --git a/src/main/java/me/earthme/luminol/config/modules/optimizations/GaleVariableEntityWakeupConfig.java b/src/main/java/me/earthme/luminol/config/modules/optimizations/GaleVariableEntityWakeupConfig.java +new file mode 100644 +index 0000000000000000000000000000000000000000..fa30e8dc39a2d4bd1399e41230b307b19eeb716a --- /dev/null +++ b/src/main/java/me/earthme/luminol/config/modules/optimizations/GaleVariableEntityWakeupConfig.java -@@ -1,0 +_,20 @@ +@@ -0,0 +1,20 @@ +package me.earthme.luminol.config.modules.optimizations; + +import me.earthme.luminol.config.ConfigInfo; diff --git a/luminol-server/paper-patches/files/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java.patch b/luminol-server/paper-patches/files/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java.patch deleted file mode 100644 index 002f2a4..0000000 --- a/luminol-server/paper-patches/files/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- /dev/null -+++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java -@@ -1,0 +_,44 @@ -+package gg.pufferfish.pufferfish.sentry; -+ -+import io.sentry.Sentry; -+import org.apache.logging.log4j.Level; -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; -+ -+public class SentryManager { -+ -+ private static final Logger logger = LogManager.getLogger(SentryManager.class); -+ -+ private SentryManager() { -+ -+ } -+ -+ private static boolean initialized = false; -+ -+ public static synchronized void init(Level logLevel) { -+ if (initialized) { -+ return; -+ } -+ if (logLevel == null) { -+ logger.error("Invalid log level, defaulting to WARN."); -+ logLevel = Level.WARN; -+ } -+ try { -+ initialized = true; -+ -+ Sentry.init(options -> { -+ options.setDsn(me.earthme.luminol.config.modules.misc.SentryConfig.sentryDsn); -+ options.setMaxBreadcrumbs(100); -+ }); -+ -+ PufferfishSentryAppender appender = new PufferfishSentryAppender(logLevel); -+ appender.start(); -+ ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()).addAppender(appender); -+ logger.info("Sentry logging started!"); -+ } catch (Exception e) { -+ logger.warn("Failed to initialize sentry!", e); -+ initialized = false; -+ } -+ } -+ -+} diff --git a/luminol-server/paper-patches/files/src/main/java/me/earthme/luminol/config/modules/misc/SentryConfig.java.patch b/luminol-server/paper-patches/files/src/main/java/me/earthme/luminol/config/modules/misc/SentryConfig.java.patch deleted file mode 100644 index 5ff6577..0000000 --- a/luminol-server/paper-patches/files/src/main/java/me/earthme/luminol/config/modules/misc/SentryConfig.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- /dev/null -+++ b/src/main/java/me/earthme/luminol/config/modules/misc/SentryConfig.java -@@ -1,0 +_,47 @@ -+package me.earthme.luminol.config.modules.misc; -+ -+import com.electronwill.nightconfig.core.file.CommentedFileConfig; -+import me.earthme.luminol.config.ConfigInfo; -+import me.earthme.luminol.config.EnumConfigCategory; -+import me.earthme.luminol.config.IConfigModule; -+import org.apache.logging.log4j.Level; -+ -+public class SentryConfig implements IConfigModule { -+ -+ @ConfigInfo(baseName = "dsn", comments = -+ " Sentry DSN for improved error logging, leave blank to disable,\n" + -+ " Obtain from https://sentry.io/") -+ public static String sentryDsn = ""; -+ -+ @ConfigInfo(baseName = "log_level", comments = " Logs with a level higher than or equal to this level will be recorded.") -+ public static String logLevel = "WARN"; -+ -+ @ConfigInfo(baseName = "only_log_thrown", comments = " Only log with a Throwable will be recorded after enabling this.") -+ public static boolean onlyLogThrown = true; -+ -+ @Override -+ public EnumConfigCategory getCategory() { -+ return EnumConfigCategory.MISC; -+ } -+ -+ @Override -+ public String getBaseName() { -+ return "sentry"; -+ } -+ -+ @Override -+ public void onLoaded(CommentedFileConfig configInstance) { -+ String sentryEnvironment = System.getenv("SENTRY_DSN"); -+ -+ sentryDsn = sentryEnvironment != null && !sentryEnvironment.isBlank() -+ ? sentryEnvironment -+ : configInstance.getOrElse("sentry.dsn", sentryDsn); -+ -+ logLevel = configInstance.getOrElse("sentry.log-level", logLevel); -+ onlyLogThrown = configInstance.getOrElse("sentry.only-log-thrown", onlyLogThrown); -+ -+ if (sentryDsn != null && !sentryDsn.isBlank()) { -+ gg.pufferfish.pufferfish.sentry.SentryManager.init(Level.getLevel(logLevel)); -+ } -+ } -+}