mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
backport 1.21.5 features (final update)
This commit is contained in:
@@ -71,7 +71,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -162,6 +_,15 @@
|
||||
@@ -162,6 +_,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
+ compilerArgs.add("-Xlint:-module")
|
||||
+ compilerArgs.add("-Xlint:-removal")
|
||||
+ compilerArgs.add("-Xlint:-dep-ann")
|
||||
+ compilerArgs.add("--add-modules=jdk.incubator.vector")
|
||||
+}
|
||||
+// DivineMC end - Hide unnecessary compilation warnings
|
||||
+
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
--- a/src/main/java/org/bukkit/map/MapPalette.java
|
||||
+++ b/src/main/java/org/bukkit/map/MapPalette.java
|
||||
@@ -45,7 +_,7 @@
|
||||
}
|
||||
|
||||
@NotNull
|
||||
- static final Color[] colors = {
|
||||
+ public static final Color[] colors = { // DivineMC - Pufferfish SIMD - make public
|
||||
c(0, 0, 0, 0), c(0, 0, 0, 0), c(0, 0, 0, 0), c(0, 0, 0, 0),
|
||||
c(89, 125, 39), c(109, 153, 48), c(127, 178, 56), c(67, 94, 29),
|
||||
c(174, 164, 115), c(213, 201, 140), c(247, 233, 163), c(130, 123, 86),
|
||||
@@ -216,9 +_,15 @@
|
||||
temp.getRGB(0, 0, temp.getWidth(), temp.getHeight(), pixels, 0, temp.getWidth());
|
||||
|
||||
byte[] result = new byte[temp.getWidth() * temp.getHeight()];
|
||||
- for (int i = 0; i < pixels.length; i++) {
|
||||
- result[i] = matchColor(new Color(pixels[i], true));
|
||||
+ // DivineMC start - Pufferfish SIMD
|
||||
+ if (gg.pufferfish.pufferfish.simd.SIMDDetection.isEnabled) {
|
||||
+ gg.pufferfish.pufferfish.simd.VectorMapPalette.matchColorVectorized(pixels, result);
|
||||
+ } else {
|
||||
+ for (int i = 0; i < pixels.length; i++) {
|
||||
+ result[i] = matchColor(new Color(pixels[i], true));
|
||||
+ }
|
||||
}
|
||||
+ // DivineMC end - Pufferfish SIMD
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package gg.pufferfish.pufferfish.simd;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import jdk.incubator.vector.FloatVector;
|
||||
import jdk.incubator.vector.IntVector;
|
||||
import jdk.incubator.vector.VectorSpecies;
|
||||
|
||||
@Deprecated
|
||||
public class SIMDChecker {
|
||||
public static boolean canEnable(Logger logger) {
|
||||
try {
|
||||
if (SIMDDetection.getJavaVersion() < 17) {
|
||||
return false;
|
||||
} else {
|
||||
SIMDDetection.testRun = true;
|
||||
|
||||
VectorSpecies<Integer> ISPEC = IntVector.SPECIES_PREFERRED;
|
||||
VectorSpecies<Float> FSPEC = FloatVector.SPECIES_PREFERRED;
|
||||
|
||||
logger.info("Max SIMD vector size on this system is {} bits (int)", ISPEC.vectorBitSize());
|
||||
logger.info("Max SIMD vector size on this system is {} bits (float)", FSPEC.vectorBitSize());
|
||||
|
||||
if (ISPEC.elementSize() < 2 || FSPEC.elementSize() < 2) {
|
||||
logger.warn("SIMD is not properly supported on this system!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} catch (NoClassDefFoundError | Exception ignored) {} // Basically, we don't do anything. This lets us detect if it's not functional and disable it.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package gg.pufferfish.pufferfish.simd;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@Deprecated
|
||||
public class SIMDDetection {
|
||||
public static boolean isEnabled = false;
|
||||
public static boolean versionLimited = false;
|
||||
public static boolean testRun = false;
|
||||
|
||||
@Deprecated
|
||||
public static boolean canEnable(Logger logger) {
|
||||
try {
|
||||
return SIMDChecker.canEnable(logger);
|
||||
} catch (NoClassDefFoundError | Exception ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static int getJavaVersion() {
|
||||
// https://stackoverflow.com/a/2591122
|
||||
String version = System.getProperty("java.version");
|
||||
if(version.startsWith("1.")) {
|
||||
version = version.substring(2, 3);
|
||||
} else {
|
||||
int dot = version.indexOf(".");
|
||||
if(dot != -1) { version = version.substring(0, dot); }
|
||||
}
|
||||
version = version.split("-")[0];
|
||||
return Integer.parseInt(version);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package gg.pufferfish.pufferfish.simd;
|
||||
|
||||
import java.awt.Color;
|
||||
import jdk.incubator.vector.FloatVector;
|
||||
import jdk.incubator.vector.IntVector;
|
||||
import jdk.incubator.vector.VectorMask;
|
||||
import jdk.incubator.vector.VectorSpecies;
|
||||
import org.bukkit.map.MapPalette;
|
||||
|
||||
@Deprecated
|
||||
public class VectorMapPalette {
|
||||
private static final VectorSpecies<Integer> I_SPEC = IntVector.SPECIES_PREFERRED;
|
||||
private static final VectorSpecies<Float> F_SPEC = FloatVector.SPECIES_PREFERRED;
|
||||
|
||||
@Deprecated
|
||||
public static void matchColorVectorized(int[] in, byte[] out) {
|
||||
int speciesLength = I_SPEC.length();
|
||||
int i;
|
||||
for (i = 0; i < in.length - speciesLength; i += speciesLength) {
|
||||
float[] redsArr = new float[speciesLength];
|
||||
float[] bluesArr = new float[speciesLength];
|
||||
float[] greensArr = new float[speciesLength];
|
||||
int[] alphasArr = new int[speciesLength];
|
||||
|
||||
for (int j = 0; j < speciesLength; j++) {
|
||||
alphasArr[j] = (in[i + j] >> 24) & 0xFF;
|
||||
redsArr[j] = (in[i + j] >> 16) & 0xFF;
|
||||
greensArr[j] = (in[i + j] >> 8) & 0xFF;
|
||||
bluesArr[j] = (in[i + j] >> 0) & 0xFF;
|
||||
}
|
||||
|
||||
IntVector alphas = IntVector.fromArray(I_SPEC, alphasArr, 0);
|
||||
FloatVector reds = FloatVector.fromArray(F_SPEC, redsArr, 0);
|
||||
FloatVector greens = FloatVector.fromArray(F_SPEC, greensArr, 0);
|
||||
FloatVector blues = FloatVector.fromArray(F_SPEC, bluesArr, 0);
|
||||
IntVector resultIndex = IntVector.zero(I_SPEC);
|
||||
VectorMask<Integer> modificationMask = VectorMask.fromLong(I_SPEC, 0xffffffff);
|
||||
|
||||
modificationMask = modificationMask.and(alphas.lt(128).not());
|
||||
FloatVector bestDistances = FloatVector.broadcast(F_SPEC, Float.MAX_VALUE);
|
||||
|
||||
for (int c = 4; c < MapPalette.colors.length; c++) {
|
||||
// We're using 32-bit floats here because it's 2x faster and nobody will know the difference.
|
||||
// For correctness, the original algorithm uses 64-bit floats instead. Completely unnecessary.
|
||||
FloatVector compReds = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getRed());
|
||||
FloatVector compGreens = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getGreen());
|
||||
FloatVector compBlues = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getBlue());
|
||||
|
||||
FloatVector rMean = reds.add(compReds).div(2.0f);
|
||||
FloatVector rDiff = reds.sub(compReds);
|
||||
FloatVector gDiff = greens.sub(compGreens);
|
||||
FloatVector bDiff = blues.sub(compBlues);
|
||||
|
||||
FloatVector weightR = rMean.div(256.0f).add(2);
|
||||
FloatVector weightG = FloatVector.broadcast(F_SPEC, 4.0f);
|
||||
FloatVector weightB = FloatVector.broadcast(F_SPEC, 255.0f).sub(rMean).div(256.0f).add(2.0f);
|
||||
|
||||
FloatVector distance = weightR.mul(rDiff).mul(rDiff).add(weightG.mul(gDiff).mul(gDiff)).add(weightB.mul(bDiff).mul(bDiff));
|
||||
|
||||
// Now we compare to the best distance we've found.
|
||||
// This mask contains a "1" if better, and a "0" otherwise.
|
||||
VectorMask<Float> bestDistanceMask = distance.lt(bestDistances);
|
||||
bestDistances = bestDistances.blend(distance, bestDistanceMask); // Update the best distances
|
||||
|
||||
// Update the result array
|
||||
// We also AND with the modification mask because we don't want to interfere if the alpha value isn't large enough.
|
||||
resultIndex = resultIndex.blend(c, bestDistanceMask.cast(I_SPEC).and(modificationMask)); // Update the results
|
||||
}
|
||||
|
||||
for (int j = 0; j < speciesLength; j++) {
|
||||
int index = resultIndex.lane(j);
|
||||
out[i + j] = (byte) (index < 128 ? index : -129 + (index - 127));
|
||||
}
|
||||
}
|
||||
|
||||
// For the final ones, fall back to the regular method
|
||||
for (; i < in.length; i++) {
|
||||
//noinspection removal
|
||||
out[i] = MapPalette.matchColor(new Color(in[i], true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,7 @@
|
||||
|
||||
implementation("net.neoforged:srgutils:1.0.9") // Mappings handling
|
||||
implementation("net.neoforged:AutoRenamingTool:2.0.3") // Remap plugins
|
||||
@@ -204,30 +_,41 @@
|
||||
@@ -204,30 +_,42 @@
|
||||
implementation("me.lucko:spark-paper:1.10.119-20241121.092015-1")
|
||||
}
|
||||
|
||||
@@ -140,6 +140,7 @@
|
||||
+ compilerArgs.add("-Xlint:-module")
|
||||
+ compilerArgs.add("-Xlint:-removal")
|
||||
+ compilerArgs.add("-Xlint:-dep-ann")
|
||||
+ compilerArgs.add("--add-modules=jdk.incubator.vector")
|
||||
+}
|
||||
+// DivineMC end - hide irrelevant compilation warnings
|
||||
+
|
||||
|
||||
@@ -1069,10 +1069,10 @@ index a3192400b37274620977e5a40d4283bfec3ab9b3..97fb981d89b1a831e6e94708f44d0983
|
||||
+ // DivineMC end - Completely remove Mojang profiler
|
||||
}
|
||||
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 61eeec6a0d789e5e44abdeb5826d7ee2307301ba..0d889730641fd88d4da0c9116226a4dae385e846 100644
|
||||
index 76f48c7c60d9e6cb8609b070f74464548e7361d9..fd50e68725ab7b188c97cca1bb4b0cf3b758e3b2 100644
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -849,12 +849,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -869,12 +869,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
return this.settings.getProperties().serverResourcePackInfo;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,19 +4,6 @@ Date: Fri, 31 Jan 2025 21:50:46 +0300
|
||||
Subject: [PATCH] Misc Optimizations
|
||||
|
||||
|
||||
diff --git a/com/mojang/brigadier/tree/CommandNode.java b/com/mojang/brigadier/tree/CommandNode.java
|
||||
index 2ae5b80338282ac73c74765fc0729af2d54f6d6c..00a63a6a5983e6a25f2a9014a2f9eefeda468cdf 100644
|
||||
--- a/com/mojang/brigadier/tree/CommandNode.java
|
||||
+++ b/com/mojang/brigadier/tree/CommandNode.java
|
||||
@@ -24,7 +24,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
|
||||
- private final Map<String, CommandNode<S>> children = new LinkedHashMap<>();
|
||||
+ private final Map<String, CommandNode<S>> children = Collections.synchronizedMap(new LinkedHashMap<>()); // DivineMC - Misc Optimizations
|
||||
private final Map<String, LiteralCommandNode<S>> literals = new LinkedHashMap<>();
|
||||
private final Map<String, ArgumentCommandNode<S, ?>> arguments = new LinkedHashMap<>();
|
||||
public Predicate<S> requirement; // Paper - public-f
|
||||
diff --git a/com/mojang/math/OctahedralGroup.java b/com/mojang/math/OctahedralGroup.java
|
||||
index 11902e7427761746ee098fea3276a34fef0096ba..3ba23fa243f7af712a41316066ca554f1c23b495 100644
|
||||
--- a/com/mojang/math/OctahedralGroup.java
|
||||
@@ -434,7 +421,7 @@ index 15de39fa82c7aea18298509fe9587d027c30cc15..eb534ed5a7478fc632db096328e3582f
|
||||
public DebugSampleSubscriptionTracker(PlayerList playerList) {
|
||||
this.playerList = playerList;
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 258cb45f1f959b75c1bcdb130811af2f8fddf07d..9c0e539f09bddac018f93d212e3cdbc446f3c672 100644
|
||||
index 7e29f1f1972f2fb4f9a779653467bc85ce37c7bc..3943789e241f6bb6bc165099b1fb585463cf3d86 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -143,7 +143,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -556,7 +543,7 @@ index 01e5b29d6e9a5c53c0e23b61ed0c1d7be1a0fe08..d80df05e40f3941ade5ed320e12f8dcf
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
index 681dec447486138088fe5f705ef4fadab531139f..12ea268eaec629fde20d55460e618fde3a3e006d 100644
|
||||
index 3d6aad86519be3e1449d3288369a41aebb924c90..9294ac7bb91f86b631b1f0b4ad0bc1dbca82b3a1 100644
|
||||
--- a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
+++ b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
@@ -198,6 +198,7 @@ public class MapItemSavedData extends SavedData {
|
||||
|
||||
@@ -206,10 +206,10 @@ index 30bd254542d631676494f349ff3f44f52d54ab2f..6c728ae3b58bc1b8449d34c6c7409161
|
||||
private static final String PREFIX = "data:image/png;base64,";
|
||||
public static final Codec<ServerStatus.Favicon> CODEC = Codec.STRING.comapFlatMap(string -> {
|
||||
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 9fcdff2be139296f4e14b54c33cc795efdff0c7f..64c3bbe540599e5195f0cc89635bff2c56d1a320 100644
|
||||
index d3431511fdc6c3e807ea4dfcf877ebe088ff90bd..fb02ec67234e46a55d68d2b4b1c7a6ba56f9995a 100644
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -668,6 +668,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -688,6 +688,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
|
||||
@Override
|
||||
public boolean enforceSecureProfile() {
|
||||
@@ -287,7 +287,7 @@ index 801dd76a2c7f76fc6fdb7167cbf3ab1310be36c9..4fa55fac5dab26a505cba2c1876e9459
|
||||
if (packet == null || this.processedDisconnect) { // Spigot
|
||||
return;
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index 3d8c1c5aa922ec0417388a1ff27d423cdb6d1351..6cbd57650f1f966955ee14039bca8ceb164599cd 100644
|
||||
index 5ff0ce34cfacb745748d3dc627127842ac1df9fa..0483b754ab9c9da4eaa62101198007d12174cf84 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -274,7 +274,7 @@ public abstract class PlayerList {
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 26 Apr 2025 22:30:35 +0300
|
||||
Subject: [PATCH] Player ProfileResult caching
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index f4a9d49247d2124b03273c38b14ddf9661184749..818284f0fb3069363fc6849c0daeddb690a24e2b 100644
|
||||
--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -75,6 +75,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
private net.minecraft.server.level.ServerPlayer player; // CraftBukkit
|
||||
public boolean iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation = false; // Paper - username validation overriding
|
||||
private int velocityLoginMessageId = -1; // Paper - Add Velocity IP Forwarding Support
|
||||
+ // DivineMC start - Player ProfileResult caching
|
||||
+ private static final com.google.common.cache.Cache<String, ProfileResult> playerProfileResultCache = com.google.common.cache.CacheBuilder.newBuilder()
|
||||
+ .expireAfterWrite(1, java.util.concurrent.TimeUnit.MINUTES)
|
||||
+ .build();
|
||||
+ // DivineMC end - Player ProfileResult caching
|
||||
|
||||
public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection, boolean transferred) {
|
||||
this.server = server;
|
||||
@@ -294,9 +299,23 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
String string1 = Objects.requireNonNull(ServerLoginPacketListenerImpl.this.requestedUsername, "Player name not initialized");
|
||||
|
||||
try {
|
||||
- ProfileResult profileResult = ServerLoginPacketListenerImpl.this.server
|
||||
- .getSessionService()
|
||||
- .hasJoinedServer(string1, string, this.getAddress());
|
||||
+ // DivineMC start - Player ProfileResult caching
|
||||
+ ProfileResult profileResult;
|
||||
+ if (org.bxteam.divinemc.DivineConfig.playerProfileResultCachingEnabled) {
|
||||
+ profileResult = playerProfileResultCache.getIfPresent(string1);
|
||||
+
|
||||
+ if (profileResult == null) {
|
||||
+ profileResult = ServerLoginPacketListenerImpl.this.server
|
||||
+ .getSessionService()
|
||||
+ .hasJoinedServer(string1, string, this.getAddress());
|
||||
+ playerProfileResultCache.put(string1, profileResult);
|
||||
+ }
|
||||
+ } else {
|
||||
+ profileResult = ServerLoginPacketListenerImpl.this.server
|
||||
+ .getSessionService()
|
||||
+ .hasJoinedServer(string1, string, this.getAddress());
|
||||
+ }
|
||||
+ // DivineMC end - Player ProfileResult caching
|
||||
if (profileResult != null) {
|
||||
GameProfile gameProfile = profileResult.profile();
|
||||
// CraftBukkit start - fire PlayerPreLoginEvent
|
||||
@@ -0,0 +1,29 @@
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -245,6 +_,26 @@
|
||||
*/// Purpur end - Purpur config files // Purpur - Configurable void damage height and damage
|
||||
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);
|
||||
@@ -0,0 +1,307 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 26 Apr 2025 23:43:59 +0300
|
||||
Subject: [PATCH] Optimize default values for configs
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index f0c420f4a1b282fb976825c33cb7a118e45de36d..af728eec05f67d9c3185bd2ccf7a9088a33be401 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -349,8 +349,8 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@Constraints.Min(4)
|
||||
public int regionFileCacheSize = 256;
|
||||
@Comment("See https://luckformula.emc.gs")
|
||||
- public boolean useAlternativeLuckFormula = false;
|
||||
- public boolean useDimensionTypeForCustomSpawners = false;
|
||||
+ public boolean useAlternativeLuckFormula = true; // DivineMC - Optimize default values for configs
|
||||
+ public boolean useDimensionTypeForCustomSpawners = true; // DivineMC - Optimize default values for configs
|
||||
public boolean strictAdvancementDimensionCheck = false;
|
||||
public IntOr.Default compressionLevel = IntOr.Default.USE_DEFAULT;
|
||||
@Comment("Defines the leniency distance added on the server to the interaction range of a player when validating interact packets.")
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
index d838c90f98c6593404c77d0aab8655c0d15905c4..f4e60728cb0c1b1ae5a95b47d3291b07994477da 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
@@ -146,8 +146,10 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public ArmorStands armorStands;
|
||||
|
||||
public class ArmorStands extends ConfigurationPart {
|
||||
- public boolean doCollisionEntityLookups = true;
|
||||
- public boolean tick = true;
|
||||
+ // DivineMC start - Optimize default values for configs
|
||||
+ public boolean doCollisionEntityLookups = false;
|
||||
+ public boolean tick = false;
|
||||
+ // DivineMC end - Optimize default values for configs
|
||||
}
|
||||
|
||||
public Markers markers;
|
||||
@@ -273,8 +275,38 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public AltItemDespawnRate altItemDespawnRate;
|
||||
|
||||
public class AltItemDespawnRate extends ConfigurationPart {
|
||||
- public boolean enabled = false;
|
||||
- public Reference2IntMap<Item> items = new Reference2IntOpenHashMap<>(Map.of(Items.COBBLESTONE, 300));
|
||||
+ // DivineMC start - Optimize default values for configs
|
||||
+ public boolean enabled = true;
|
||||
+ public Reference2IntMap<Item> items = new Reference2IntOpenHashMap<>(Map.ofEntries(
|
||||
+ Map.entry(Items.COBBLESTONE, 300),
|
||||
+ Map.entry(Items.NETHERRACK, 300),
|
||||
+ Map.entry(Items.SAND, 300),
|
||||
+ Map.entry(Items.RED_SAND, 300),
|
||||
+ Map.entry(Items.GRAVEL, 300),
|
||||
+ Map.entry(Items.DIRT, 300),
|
||||
+ Map.entry(Items.SHORT_GRASS, 300),
|
||||
+ Map.entry(Items.PUMPKIN, 300),
|
||||
+ Map.entry(Items.MELON_SLICE, 300),
|
||||
+ Map.entry(Items.KELP, 300),
|
||||
+ Map.entry(Items.BAMBOO, 300),
|
||||
+ Map.entry(Items.SUGAR_CANE, 300),
|
||||
+ Map.entry(Items.TWISTING_VINES, 300),
|
||||
+ Map.entry(Items.WEEPING_VINES, 300),
|
||||
+ Map.entry(Items.OAK_LEAVES, 300),
|
||||
+ Map.entry(Items.SPRUCE_LEAVES, 300),
|
||||
+ Map.entry(Items.BIRCH_LEAVES, 300),
|
||||
+ Map.entry(Items.JUNGLE_LEAVES, 300),
|
||||
+ Map.entry(Items.ACACIA_LEAVES, 300),
|
||||
+ Map.entry(Items.DARK_OAK_LEAVES, 300),
|
||||
+ Map.entry(Items.MANGROVE_LEAVES, 300),
|
||||
+ Map.entry(Items.CHERRY_LEAVES, 300),
|
||||
+ Map.entry(Items.CACTUS, 300),
|
||||
+ Map.entry(Items.DIORITE, 300),
|
||||
+ Map.entry(Items.GRANITE, 300),
|
||||
+ Map.entry(Items.ANDESITE, 300),
|
||||
+ Map.entry(Items.SCAFFOLDING, 600)
|
||||
+ ));
|
||||
+ // DivineMC end - Optimize default values for configs
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,7 +450,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public class Environment extends ConfigurationPart {
|
||||
public boolean disableThunder = false;
|
||||
public boolean disableIceAndSnow = false;
|
||||
- public boolean optimizeExplosions = false;
|
||||
+ public boolean optimizeExplosions = true; // DivineMC - Optimize default values for configs
|
||||
public boolean disableExplosionKnockback = false;
|
||||
public boolean generateFlatBedrock = false;
|
||||
public FrostedIce frostedIce;
|
||||
@@ -473,7 +505,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public Fixes fixes;
|
||||
|
||||
public class Fixes extends ConfigurationPart {
|
||||
- public boolean fixItemsMergingThroughWalls = false;
|
||||
+ public boolean fixItemsMergingThroughWalls = true; // DivineMC - Optimize default values for configs
|
||||
public boolean disableUnloadedChunkEnderpearlExploit = false;
|
||||
public boolean preventTntFromMovingInWater = false;
|
||||
public boolean splitOverstackedLoot = true;
|
||||
@@ -501,9 +533,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public class Collisions extends ConfigurationPart {
|
||||
public boolean onlyPlayersCollide = false;
|
||||
public boolean allowVehicleCollisions = true;
|
||||
- public boolean fixClimbingBypassingCrammingRule = false;
|
||||
+ public boolean fixClimbingBypassingCrammingRule = true; // DivineMC - Optimize default values for configs
|
||||
@RequiresSpigotInitialization(MaxEntityCollisionsInitializer.class)
|
||||
- public int maxEntityCollisions = 8;
|
||||
+ public int maxEntityCollisions = 2; // DivineMC - Optimize default values for configs
|
||||
public boolean allowPlayerCrammingDamage = false;
|
||||
}
|
||||
|
||||
@@ -513,16 +545,33 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public AutosavePeriod autoSaveInterval = AutosavePeriod.def();
|
||||
public int maxAutoSaveChunksPerTick = 24;
|
||||
public int fixedChunkInhabitedTime = -1;
|
||||
- public boolean preventMovingIntoUnloadedChunks = false;
|
||||
+ public boolean preventMovingIntoUnloadedChunks = true; // DivineMC - Optimize default values for configs
|
||||
public Duration delayChunkUnloadsBy = Duration.of("10s");
|
||||
public Reference2IntMap<EntityType<?>> entityPerChunkSaveLimit = Util.make(new Reference2IntOpenHashMap<>(BuiltInRegistries.ENTITY_TYPE.size()), map -> {
|
||||
map.defaultReturnValue(-1);
|
||||
- map.put(EntityType.EXPERIENCE_ORB, -1);
|
||||
- map.put(EntityType.SNOWBALL, -1);
|
||||
- map.put(EntityType.ENDER_PEARL, -1);
|
||||
- map.put(EntityType.ARROW, -1);
|
||||
- map.put(EntityType.FIREBALL, -1);
|
||||
- map.put(EntityType.SMALL_FIREBALL, -1);
|
||||
+ // DivineMC start - Optimize default values for configs
|
||||
+ map.put(EntityType.AREA_EFFECT_CLOUD, 8);
|
||||
+ map.put(EntityType.ARROW, 16);
|
||||
+ map.put(EntityType.BREEZE_WIND_CHARGE, 8);
|
||||
+ map.put(EntityType.DRAGON_FIREBALL, 3);
|
||||
+ map.put(EntityType.EGG, 8);
|
||||
+ map.put(EntityType.ENDER_PEARL, 8);
|
||||
+ map.put(EntityType.EXPERIENCE_BOTTLE, 3);
|
||||
+ map.put(EntityType.EXPERIENCE_ORB, 16);
|
||||
+ map.put(EntityType.EYE_OF_ENDER, 8);
|
||||
+ map.put(EntityType.FIREBALL, 8);
|
||||
+ map.put(EntityType.FIREWORK_ROCKET, 8);
|
||||
+ map.put(EntityType.LLAMA_SPIT, 3);
|
||||
+ map.put(EntityType.SPLASH_POTION, 8);
|
||||
+ map.put(EntityType.LINGERING_POTION, 8);
|
||||
+ map.put(EntityType.SHULKER_BULLET, 8);
|
||||
+ map.put(EntityType.SMALL_FIREBALL, 8);
|
||||
+ map.put(EntityType.SNOWBALL, 8);
|
||||
+ map.put(EntityType.SPECTRAL_ARROW, 16);
|
||||
+ map.put(EntityType.TRIDENT, 16);
|
||||
+ map.put(EntityType.WIND_CHARGE, 8);
|
||||
+ map.put(EntityType.WITHER_SKULL, 4);
|
||||
+ // DivineMC end - Optimize default values for configs
|
||||
});
|
||||
public boolean flushRegionsOnSave = false;
|
||||
}
|
||||
@@ -537,9 +586,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public TickRates tickRates;
|
||||
|
||||
public class TickRates extends ConfigurationPart {
|
||||
- public int grassSpread = 1;
|
||||
+ public int grassSpread = 4;
|
||||
public int containerUpdate = 1;
|
||||
- public int mobSpawner = 1;
|
||||
+ public int mobSpawner = 2;
|
||||
public int wetFarmland = 1;
|
||||
public int dryFarmland = 1;
|
||||
public Table<EntityType<?>, String, Integer> sensor = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "secondarypoisensor", 40));
|
||||
@@ -574,7 +623,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public class Misc extends ConfigurationPart {
|
||||
public boolean updatePathfindingOnBlockUpdate = true;
|
||||
public boolean showSignClickCommandFailureMsgsToPlayer = false;
|
||||
- public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA;
|
||||
+ public RedstoneImplementation redstoneImplementation = RedstoneImplementation.ALTERNATE_CURRENT; // DivineMC - Optimize default values for configs
|
||||
public AlternateCurrentUpdateOrder alternateCurrentUpdateOrder = AlternateCurrentUpdateOrder.HORIZONTAL_FIRST_OUTWARD;
|
||||
public boolean disableEndCredits = false;
|
||||
public DoubleOr.Default maxLeashDistance = DoubleOr.Default.USE_DEFAULT;
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 89e2adbc1e1a0709d03e151e3ffcdbff10a44098..ad57e4a05dd1347c971424297f3b16cee992e200 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -135,13 +135,13 @@ public class SpigotWorldConfig {
|
||||
|
||||
public double itemMerge;
|
||||
private void itemMerge() {
|
||||
- this.itemMerge = this.getDouble("merge-radius.item", 0.5);
|
||||
+ this.itemMerge = this.getDouble("merge-radius.item", 3.5); // DivineMC - Optimize default values for configs
|
||||
this.log("Item Merge Radius: " + this.itemMerge);
|
||||
}
|
||||
|
||||
public double expMerge;
|
||||
private void expMerge() {
|
||||
- this.expMerge = this.getDouble("merge-radius.exp", -1);
|
||||
+ this.expMerge = this.getDouble("merge-radius.exp", 4.0); // DivineMC - Optimize default values for configs
|
||||
this.log("Experience Merge Radius: " + this.expMerge);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public class SpigotWorldConfig {
|
||||
|
||||
public byte mobSpawnRange;
|
||||
private void mobSpawnRange() {
|
||||
- this.mobSpawnRange = (byte) getInt("mob-spawn-range", 8); // Paper - Vanilla
|
||||
+ this.mobSpawnRange = (byte) getInt("mob-spawn-range", 3); // Paper - Vanilla // DivineMC - Optimize default values for configs
|
||||
this.log("Mob Spawn Range: " + this.mobSpawnRange);
|
||||
}
|
||||
|
||||
@@ -184,14 +184,16 @@ public class SpigotWorldConfig {
|
||||
this.log("Item Despawn Rate: " + this.itemDespawnRate);
|
||||
}
|
||||
|
||||
- public int animalActivationRange = 32;
|
||||
- public int monsterActivationRange = 32;
|
||||
- public int raiderActivationRange = 64;
|
||||
- public int miscActivationRange = 16;
|
||||
+ // DivineMC start - Optimize default values for configs
|
||||
+ public int animalActivationRange = 16;
|
||||
+ public int monsterActivationRange = 24;
|
||||
+ public int raiderActivationRange = 48;
|
||||
+ public int miscActivationRange = 8;
|
||||
// Paper start
|
||||
public int flyingMonsterActivationRange = 32;
|
||||
- public int waterActivationRange = 16;
|
||||
- public int villagerActivationRange = 32;
|
||||
+ public int waterActivationRange = 8;
|
||||
+ public int villagerActivationRange = 16;
|
||||
+ // DivineMC end - Optimize default values for configs
|
||||
public int wakeUpInactiveAnimals = 4;
|
||||
public int wakeUpInactiveAnimalsEvery = 60 * 20;
|
||||
public int wakeUpInactiveAnimalsFor = 5 * 20;
|
||||
@@ -247,10 +249,10 @@ public class SpigotWorldConfig {
|
||||
this.log("Entity Activation Range: An " + this.animalActivationRange + " / Mo " + this.monsterActivationRange + " / Ra " + this.raiderActivationRange + " / Mi " + this.miscActivationRange + " / Tiv " + this.tickInactiveVillagers + " / Isa " + this.ignoreSpectatorActivation);
|
||||
}
|
||||
|
||||
- public int playerTrackingRange = 128;
|
||||
- public int animalTrackingRange = 96;
|
||||
- public int monsterTrackingRange = 96;
|
||||
- public int miscTrackingRange = 96;
|
||||
+ public int playerTrackingRange = 48;
|
||||
+ public int animalTrackingRange = 48;
|
||||
+ public int monsterTrackingRange = 48;
|
||||
+ public int miscTrackingRange = 32;
|
||||
public int displayTrackingRange = 128;
|
||||
public int otherTrackingRange = 64;
|
||||
private void trackingRange() {
|
||||
@@ -273,7 +275,7 @@ public class SpigotWorldConfig {
|
||||
if (SpigotConfig.version < 11) {
|
||||
this.set("ticks-per.hopper-check", 1);
|
||||
}
|
||||
- this.hopperCheck = this.getInt("ticks-per.hopper-check", 1);
|
||||
+ this.hopperCheck = this.getInt("ticks-per.hopper-check", 8); // DivineMC - Optimize default values for configs
|
||||
this.hopperAmount = this.getInt("hopper-amount", 1);
|
||||
this.hopperCanLoadChunks = this.getBoolean("hopper-can-load-chunks", false);
|
||||
this.log("Hopper Transfer: " + this.hopperTransfer + " Hopper Check: " + this.hopperCheck + " Hopper Amount: " + this.hopperAmount + " Hopper Can Load Chunks: " + this.hopperCanLoadChunks);
|
||||
diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
|
||||
index eef7c125b2689f29cae5464659eacdf33f5695b2..ff8086f55106f72aa2e2d64b459e6ce0d3d1efb3 100644
|
||||
--- a/src/main/resources/configurations/bukkit.yml
|
||||
+++ b/src/main/resources/configurations/bukkit.yml
|
||||
@@ -18,28 +18,28 @@ settings:
|
||||
update-folder: update
|
||||
plugin-profiling: false
|
||||
connection-throttle: 4000
|
||||
- query-plugins: true
|
||||
+ query-plugins: false
|
||||
deprecated-verbose: default
|
||||
shutdown-message: Server closed
|
||||
minimum-api: none
|
||||
use-map-color-cache: true
|
||||
spawn-limits:
|
||||
- monsters: 70
|
||||
- animals: 10
|
||||
- water-animals: 5
|
||||
- water-ambient: 20
|
||||
- water-underground-creature: 5
|
||||
- axolotls: 5
|
||||
- ambient: 15
|
||||
+ monsters: 20
|
||||
+ animals: 8
|
||||
+ water-animals: 3
|
||||
+ water-ambient: 1
|
||||
+ water-underground-creature: 3
|
||||
+ axolotls: 3
|
||||
+ ambient: 1
|
||||
chunk-gc:
|
||||
- period-in-ticks: 600
|
||||
+ period-in-ticks: 400
|
||||
ticks-per:
|
||||
animal-spawns: 400
|
||||
- monster-spawns: 1
|
||||
- water-spawns: 1
|
||||
- water-ambient-spawns: 1
|
||||
- water-underground-creature-spawns: 1
|
||||
- axolotl-spawns: 1
|
||||
- ambient-spawns: 1
|
||||
+ monster-spawns: 20
|
||||
+ water-spawns: 400
|
||||
+ water-ambient-spawns: 600
|
||||
+ water-underground-creature-spawns: 600
|
||||
+ axolotl-spawns: 400
|
||||
+ ambient-spawns: 1800
|
||||
autosave: 6000
|
||||
aliases: now-in-commands.yml
|
||||
diff --git a/src/main/resources/configurations/commands.yml b/src/main/resources/configurations/commands.yml
|
||||
index 18f54571200e2eca09a39b88f170fe7b99d8618f..12312a1c393f1008dab5b6c82b8c65b3848efed1 100644
|
||||
--- a/src/main/resources/configurations/commands.yml
|
||||
+++ b/src/main/resources/configurations/commands.yml
|
||||
@@ -11,6 +11,4 @@
|
||||
|
||||
command-block-overrides: []
|
||||
ignore-vanilla-permissions: false
|
||||
-aliases:
|
||||
- icanhasbukkit:
|
||||
- - "version $1-"
|
||||
+aliases: []
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Optimize default values for configs
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 702f71bed6634042bc306fa365ff00b4053d8661..8208a91dd9d15a23b17590f88ab2fefdc0fcfcf3 100644
|
||||
index 338154a8098b577acc54f5543f9c20ee91bbc40a..554ae05a1a7f7dbe91455cb14b1d9a02f3b7d288 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -240,7 +240,7 @@ public class PurpurConfig {
|
||||
@@ -17,3 +17,18 @@ index 702f71bed6634042bc306fa365ff00b4053d8661..8208a91dd9d15a23b17590f88ab2fefd
|
||||
private static void useAlternateKeepAlive() {
|
||||
useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive);
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 1dd74216ec8bfaca080bd6ae67169815e9a9b855..26ea01d16cfda9ee06eee9fc40461393dad422e0 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -3043,8 +3043,8 @@ public class PurpurWorldConfig {
|
||||
public boolean villagerDisplayTradeItem = true;
|
||||
public int villagerSpawnIronGolemRadius = 0;
|
||||
public int villagerSpawnIronGolemLimit = 0;
|
||||
- public int villagerAcquirePoiSearchRadius = 48;
|
||||
- public int villagerNearestBedSensorSearchRadius = 48;
|
||||
+ public int villagerAcquirePoiSearchRadius = 16; // DivineMC - Optimize default values for configs
|
||||
+ public int villagerNearestBedSensorSearchRadius = 16; // DivineMC - Optimize default values for configs
|
||||
private void villagerSettings() {
|
||||
villagerRidable = getBoolean("mobs.villager.ridable", villagerRidable);
|
||||
villagerRidableInWater = getBoolean("mobs.villager.ridable-in-water", villagerRidableInWater);
|
||||
|
||||
@@ -2,7 +2,7 @@ group = org.bxteam.divinemc
|
||||
version=1.21.4-R0.1-SNAPSHOT
|
||||
|
||||
mcVersion=1.21.4
|
||||
purpurRef=f2f682fb483131357e72ebaa4958e2c8aad79678
|
||||
purpurRef=51aafbc731b33dfebc4b6180970570cfbbd14d3c
|
||||
experimental=false
|
||||
|
||||
org.gradle.configuration-cache=true
|
||||
|
||||
Reference in New Issue
Block a user