mirror of
https://github.com/BX-Team/DivineMC.git
synced 2026-01-06 15:41:52 +00:00
40 lines
2.5 KiB
Diff
40 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
|
Date: Sun, 6 Jul 2025 02:55:43 +0300
|
|
Subject: [PATCH] Pufferfish: SIMD support
|
|
|
|
Original license: GPL v3
|
|
Original project: https://github.com/pufferfish-gg/Pufferfish
|
|
|
|
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
|
index 7aefb6a81d5f7f5431f3d67a096a93b036bbbd1d..7ac82a49e3c64d1a41a2870c5cf9900812329a57 100644
|
|
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
|
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
|
@@ -204,6 +204,26 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
|
// DivineMC end - Configuration
|
|
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
|
|
|
|
+ // DivineMC start - Pufferfish SIMD
|
|
+ try {
|
|
+ gg.pufferfish.pufferfish.simd.SIMDDetection.isEnabled = gg.pufferfish.pufferfish.simd.SIMDDetection.canEnable(LOGGER);
|
|
+ gg.pufferfish.pufferfish.simd.SIMDDetection.versionLimited = gg.pufferfish.pufferfish.simd.SIMDDetection.getJavaVersion() < 17 || gg.pufferfish.pufferfish.simd.SIMDDetection.getJavaVersion() > 21;
|
|
+ } catch (NoClassDefFoundError | Exception ignored) {
|
|
+ ignored.printStackTrace();
|
|
+ }
|
|
+
|
|
+ if (gg.pufferfish.pufferfish.simd.SIMDDetection.isEnabled) {
|
|
+ LOGGER.info("SIMD operations detected as functional. Will replace some operations with faster versions.");
|
|
+ } else if (gg.pufferfish.pufferfish.simd.SIMDDetection.versionLimited) {
|
|
+ LOGGER.warn("Will not enable SIMD! These optimizations are only safely supported on Java 17 and higher.");
|
|
+ } else {
|
|
+ LOGGER.warn("SIMD operations are available for your server, but are not configured!");
|
|
+ LOGGER.warn("To enable additional optimizations, add \"--add-modules=jdk.incubator.vector\" to your startup flags, BEFORE the \"-jar\".");
|
|
+ LOGGER.warn("If you have already added this flag, then SIMD operations are not supported on your JVM or CPU.");
|
|
+ LOGGER.warn("Debug: Java: {}, test run: {}", System.getProperty("java.version"), gg.pufferfish.pufferfish.simd.SIMDDetection.testRun);
|
|
+ }
|
|
+ // DivineMC end - Pufferfish SIMD
|
|
+
|
|
this.setPvpAllowed(properties.pvp);
|
|
this.setFlightAllowed(properties.allowFlight);
|
|
this.setMotd(properties.motd);
|