diff --git a/.github/workflows/build_1.21.5.yml b/.github/workflows/build_1.21.5.yml index ccf6452..8e61c41 100644 --- a/.github/workflows/build_1.21.5.yml +++ b/.github/workflows/build_1.21.5.yml @@ -35,7 +35,7 @@ jobs: run: ./gradlew createMojmapPaperclipJar - name: Publish to repo - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' && false continue-on-error: true run: | ./gradlew generateDevelopmentBundle publish -PpublishDevBundle=true @@ -53,8 +53,8 @@ jobs: if: github.event_name != 'pull_request' run: sh scripts/SetENV.sh - - name: Create Release && false - if: github.event_name != 'pull_request' + - name: Create Release + if: github.event_name != 'pull_request' && false uses: ncipollo/release-action@v1 with: tag: ${{ env.tag }} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index a4b76b9..1b33c55 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/luminol-api/paper-patches/needupdate/0006-Pufferfish-SIMD-Utilities.patch b/luminol-api/paper-patches/needupdate/0006-Pufferfish-SIMD-Utilities.patch deleted file mode 100644 index db1d3ed..0000000 --- a/luminol-api/paper-patches/needupdate/0006-Pufferfish-SIMD-Utilities.patch +++ /dev/null @@ -1,202 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MrHua269 -Date: Sun, 12 Jan 2025 14:00:28 +0800 -Subject: [PATCH] Pufferfish SIMD Utilities - - -diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java -new file mode 100644 -index 0000000000000000000000000000000000000000..856de1331b15542c00e01990f471fa5152722c11 ---- /dev/null -+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java -@@ -0,0 +1,35 @@ -+package gg.pufferfish.pufferfish.simd; -+ -+import jdk.incubator.vector.FloatVector; -+import jdk.incubator.vector.IntVector; -+import jdk.incubator.vector.VectorSpecies; -+import org.slf4j.Logger; -+ -+/** -+ * Basically, java is annoying and we have to push this out to its own class. -+ */ -+@Deprecated -+public class SIMDChecker { -+ -+ @Deprecated -+ public static boolean canEnable(Logger logger) { -+ try { -+ SIMDDetection.testRun = true; -+ -+ VectorSpecies ISPEC = IntVector.SPECIES_PREFERRED; -+ VectorSpecies 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 " + FSPEC.vectorBitSize() + " bits (float)"); -+ -+ 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; -+ } -+ -+} -diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0a64cd0e88083ac4af6674ad0fb07b771109c737 ---- /dev/null -+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java -@@ -0,0 +1,34 @@ -+package gg.pufferfish.pufferfish.simd; -+ -+import org.slf4j.Logger; -+ -+@Deprecated -+public class SIMDDetection { -+ -+ public static boolean isEnabled = 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]; // Azul is stupid -+ return Integer.parseInt(version); -+ } -+ -+} -diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java -new file mode 100644 -index 0000000000000000000000000000000000000000..c26dcaaa2e85882730c854099df80d69eec70f33 ---- /dev/null -+++ b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java -@@ -0,0 +1,84 @@ -+package gg.pufferfish.pufferfish.simd; -+ -+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; -+ -+import java.awt.*; -+ -+@Deprecated -+public class VectorMapPalette { -+ -+ private static final VectorSpecies I_SPEC = IntVector.SPECIES_PREFERRED; -+ private static final VectorSpecies 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 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 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++) { -+ out[i] = MapPalette.matchColor(new Color(in[i], true)); -+ } -+ } -+ -+} -diff --git a/src/main/java/org/bukkit/map/MapPalette.java b/src/main/java/org/bukkit/map/MapPalette.java -index 6995f9cc08d162e3adcd3a28f6bfa6d329661999..83ea70a16b4090a8c628784f2807cd16e7065103 100644 ---- a/src/main/java/org/bukkit/map/MapPalette.java -+++ b/src/main/java/org/bukkit/map/MapPalette.java -@@ -45,7 +45,7 @@ public final class MapPalette { - } - - @NotNull -- static final Color[] colors = { -+ public static final Color[] colors = { // Luminol - package-private -> 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 +216,11 @@ public final class MapPalette { - temp.getRGB(0, 0, temp.getWidth(), temp.getHeight(), pixels, 0, temp.getWidth()); - - byte[] result = new byte[temp.getWidth() * temp.getHeight()]; -+ if ((mapColorCache != null && mapColorCache.isCached()) || !gg.pufferfish.pufferfish.simd.SIMDDetection.isEnabled) { // Luminol - Pufferfish - vectorized map color conversion - for (int i = 0; i < pixels.length; i++) { - result[i] = matchColor(new Color(pixels[i], true)); - } -+ } else gg.pufferfish.pufferfish.simd.VectorMapPalette.matchColorVectorized(pixels, result); // Luminol - Pufferfish - vectorized map color conversion - return result; - } - diff --git a/luminol-api/paper-patches/needupdate/0007-Tick-regions-api.patch b/luminol-api/paper-patches/needupdate/0007-Tick-regions-api.patch deleted file mode 100644 index b1ffeab..0000000 --- a/luminol-api/paper-patches/needupdate/0007-Tick-regions-api.patch +++ /dev/null @@ -1,206 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MrHua269 -Date: Mon, 27 Jan 2025 13:01:59 +0800 -Subject: [PATCH] Tick regions api - - -diff --git a/src/main/java/me/earthme/luminol/api/RegionStats.java b/src/main/java/me/earthme/luminol/api/RegionStats.java -new file mode 100644 -index 0000000000000000000000000000000000000000..96147cace1550d14c682258dab0397587dcf76a4 ---- /dev/null -+++ b/src/main/java/me/earthme/luminol/api/RegionStats.java -@@ -0,0 +1,25 @@ -+package me.earthme.luminol.api; -+ -+/** -+ * A simple package of folia's tick region state.It linked to the RegionStats of the nms part so that
-+ * You could call these methods to get the status of this tick region
-+ */ -+public interface RegionStats { -+ /** -+ * Get the entity count in this tick region -+ * @return the entity count -+ */ -+ int getEntityCount(); -+ -+ /** -+ * Get the player count in this tick region -+ * @return the player count -+ */ -+ int getPlayerCount(); -+ -+ /** -+ * Get the chunk count in this tick region -+ * @return the chunk count -+ */ -+ int getChunkCount(); -+} -diff --git a/src/main/java/me/earthme/luminol/api/ThreadedRegion.java b/src/main/java/me/earthme/luminol/api/ThreadedRegion.java -new file mode 100644 -index 0000000000000000000000000000000000000000..01dac0602b5f66f80c0adfbb779666fe0325a24f ---- /dev/null -+++ b/src/main/java/me/earthme/luminol/api/ThreadedRegion.java -@@ -0,0 +1,56 @@ -+package me.earthme.luminol.api; -+ -+import org.bukkit.Location; -+import org.bukkit.World; -+ -+import javax.annotation.Nullable; -+ -+/** -+ * A mirror of folia's ThreadedRegion
-+ * Including some handy methods to get the information of the tick region
-+ * Note: You should call these methods inside this tick region's thread context -+ */ -+public interface ThreadedRegion { -+ /** -+ * Get the center chunk pos of this tick region
-+ * Note:
-+ * 1.Global region will return a null value(But we don't finish the global region yet()
-+ * 2.You should call these methods inside this tick region's thread context -+ * @return The center chunk pos -+ */ -+ @Nullable -+ Location getCenterChunkPos(); -+ -+ /** -+ * Get the dead section percent of this tick region -+ * Note:
-+ * 1.Dead percent is mean the percent of the unloaded chunk count of this tick region, which is also used for determine -+ * that the tick region should or not check for splitting
-+ * 2.You should call these methods inside this tick region's thread context -+ * @return The dead section percent -+ */ -+ double getDeadSectionPercent(); -+ -+ /** -+ * Get the tick region data of this tick region
-+ * Note:
-+ * 1.You should call this method inside this tick region's thread context
-+ * 2.You should call these methods inside this tick region's thread context -+ * @return The tick region data -+ */ -+ TickRegionData getTickRegionData(); -+ -+ /** -+ * Get the world of this tick region
-+ * Note: Global region will return a null value too -+ * @return The world of this tick region -+ */ -+ @Nullable -+ World getWorld(); -+ -+ /** -+ * Get the id of the tick region
-+ * @return The id of the tick region -+ */ -+ long getId(); -+} -diff --git a/src/main/java/me/earthme/luminol/api/ThreadedRegionizer.java b/src/main/java/me/earthme/luminol/api/ThreadedRegionizer.java -new file mode 100644 -index 0000000000000000000000000000000000000000..ff31a68a019fd9e5e687e6818f8729f4950bc060 ---- /dev/null -+++ b/src/main/java/me/earthme/luminol/api/ThreadedRegionizer.java -@@ -0,0 +1,56 @@ -+package me.earthme.luminol.api; -+ -+import org.bukkit.Location; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+import java.util.Collection; -+ -+/** -+ * A mirror of folia's ThreadedRegionizer -+ */ -+public interface ThreadedRegionizer { -+ /** -+ * Get all the tick regions -+ * @return Temporary copied collection of all tick regions -+ */ -+ Collection getAllRegions(); -+ -+ /** -+ * Get the tick region at the given chunk coordinates -+ * @param chunkX Chunk X -+ * @param chunkZ Chunk Z -+ * @return The tick region at the given chunk coordinates -+ */ -+ @Nullable -+ ThreadedRegion getAtSynchronized(int chunkX, int chunkZ); -+ -+ /** -+ * Get the tick region at the given chunk coordinates -+ * @param chunkX Chunk X -+ * @param chunkZ Chunk Z -+ * @return The tick region at the given chunk coordinates -+ */ -+ @Nullable -+ ThreadedRegion getAtUnSynchronized(int chunkX, int chunkZ); -+ -+ /** -+ * Get the tick region at the given location -+ * @param pos The location -+ * @return The tick region at the given location -+ */ -+ @Nullable -+ default ThreadedRegion getAtSynchronized(@NotNull Location pos) { -+ return this.getAtSynchronized(pos.getBlockX() >> 4, pos.getBlockZ() >> 4); -+ } -+ -+ /** -+ * Get the tick region at the given location -+ * @param pos The location -+ * @return The tick region at the given location -+ */ -+ @Nullable -+ default ThreadedRegion getAtUnSynchronized(@NotNull Location pos) { -+ return this.getAtUnSynchronized(pos.getBlockX() >> 4, pos.getBlockZ() >> 4); -+ } -+} -diff --git a/src/main/java/me/earthme/luminol/api/TickRegionData.java b/src/main/java/me/earthme/luminol/api/TickRegionData.java -new file mode 100644 -index 0000000000000000000000000000000000000000..ecde4462b08d701b8bff9f26902f17754cf791dd ---- /dev/null -+++ b/src/main/java/me/earthme/luminol/api/TickRegionData.java -@@ -0,0 +1,26 @@ -+package me.earthme.luminol.api; -+ -+import org.bukkit.World; -+ -+/** -+ * A mirror of folia's tick region data -+ */ -+public interface TickRegionData { -+ /** -+ * Get the world it's currently holding -+ * @return the world -+ */ -+ World getWorld(); -+ -+ /** -+ * Get the current tick count -+ * @return the current tick count -+ */ -+ long getCurrentTickCount(); -+ -+ /** -+ * Get the region stats -+ * @return the region stats -+ */ -+ RegionStats getRegionStats(); -+} -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index bff01411f4b2d3ecd9e6d807c3f450d72c108323..1d74f4814d5c87d6cd1320634e5610cac16d32c5 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -4437,4 +4437,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - } - } - } -+ -+ // Luminol start - Tick regions api -+ me.earthme.luminol.api.ThreadedRegionizer getThreadedRegionizer(); -+ // Luminol end - Tick regions api - }