diff --git a/patches/server/0001-new-fork-who-dis-Rebrand-to-SparklyPaper-and-Build-C.patch b/patches/server/0001-new-fork-who-dis-Rebrand-to-SparklyPaper-and-Build-C.patch index fabfe22..6c7607a 100644 --- a/patches/server/0001-new-fork-who-dis-Rebrand-to-SparklyPaper-and-Build-C.patch +++ b/patches/server/0001-new-fork-who-dis-Rebrand-to-SparklyPaper-and-Build-C.patch @@ -5,7 +5,7 @@ Subject: [PATCH] new fork who dis - Rebrand to SparklyPaper and Build Changes diff --git a/build.gradle.kts b/build.gradle.kts -index a79461457ea19339f47572c70705d655ebc55276..768a691649d9146c7c975a3b25258551d0b6df0a 100644 +index a79461457ea19339f47572c70705d655ebc55276..d43c3f2e17f9ef48ec458f9c94478cfd02db6edb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,6 +3,8 @@ import io.papermc.paperweight.util.* @@ -17,7 +17,7 @@ index a79461457ea19339f47572c70705d655ebc55276..768a691649d9146c7c975a3b25258551 id("com.github.johnrengelman.shadow") } -@@ -13,8 +15,14 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { +@@ -13,8 +15,15 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { val alsoShade: Configuration by configurations.creating dependencies { @@ -25,6 +25,7 @@ index a79461457ea19339f47572c70705d655ebc55276..768a691649d9146c7c975a3b25258551 - implementation(project(":paper-mojangapi")) + // SparklyPaper start + implementation(project(":sparklypaper-api")) ++ implementation(kotlin("reflect")) + implementation("io.papermc.paper:paper-mojangapi:1.20.2-R0.1-SNAPSHOT") { + exclude("io.papermc.paper", "paper-api") + } @@ -34,7 +35,7 @@ index a79461457ea19339f47572c70705d655ebc55276..768a691649d9146c7c975a3b25258551 // Paper start implementation("org.jline:jline-terminal-jansi:3.21.0") implementation("net.minecrell:terminalconsoleappender:1.3.0") -@@ -70,7 +78,7 @@ tasks.jar { +@@ -70,7 +79,7 @@ tasks.jar { attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", "Implementation-Title" to "CraftBukkit", @@ -43,7 +44,7 @@ index a79461457ea19339f47572c70705d655ebc55276..768a691649d9146c7c975a3b25258551 "Implementation-Vendor" to date, // Paper "Specification-Title" to "Bukkit", "Specification-Version" to project.version, -@@ -154,7 +162,7 @@ fun TaskContainer.registerRunTask( +@@ -154,7 +163,7 @@ fun TaskContainer.registerRunTask( name: String, block: JavaExec.() -> Unit ): TaskProvider = register(name) { diff --git a/patches/server/0004-Only-check-thundering-once-per-world-instead-for-eve.patch b/patches/server/0004-Only-check-thundering-once-per-world-instead-for-eve.patch new file mode 100644 index 0000000..9e5edb6 --- /dev/null +++ b/patches/server/0004-Only-check-thundering-once-per-world-instead-for-eve.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Sun, 22 Oct 2023 12:27:26 -0300 +Subject: [PATCH] Only check thundering once per world instead for every chunk + +For some reason the isThundering check is consuming ~3% of CPU time when profiled so, instead of checking the thunder every chunk, we can cache the result and reuse on the same chunk tick + +diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +index 17b6925b46f8386dcfc561483693de516465ec12..8f57bf4fffae352b1f81220b94def01c81af7f5e 100644 +--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java ++++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +@@ -598,6 +598,7 @@ public class ServerChunkCache extends ChunkSource { + } + // Paper end - optimise chunk tick iteration + ++ this.level.isCurrentlyThundering = this.level.isThundering_old(); // SparklyPaper - Only check thundering once per world instead for every chunk + int chunksTicked = 0; // Paper + // Paper start - optimise chunk tick iteration + io.papermc.paper.util.player.NearbyPlayers nearbyPlayers = this.chunkMap.getNearbyPlayers(); // Paper - optimise chunk tick iteration +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index aa9c56fb95d5e438e85aced984631493b84c8556..10adb0b41b4140c1361572f868b2595b0511590d 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -184,6 +184,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + private int tileTickPosition; + public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions + public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here ++ public boolean isCurrentlyThundering; // SparklyPaper - Only check if the world is currently thundering once instead for every chunk + + // Paper start - fix and optimise world upgrading + // copied from below +@@ -1612,7 +1613,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + this.rainLevel = f1; + } + ++ // SparklyPaper start - Only check thundering once per world instead for every chunk + public boolean isThundering() { ++ return isCurrentlyThundering; ++ } ++ public boolean isThundering_old() { ++ // SparklyPaper end + return this.dimensionType().hasSkyLight() && !this.dimensionType().hasCeiling() ? (double) this.getThunderLevel(1.0F) > 0.9D : false; + } + diff --git a/patches/server/0005-Avoid-allocating-an-iterator-in-getEffectiveRange-if.patch b/patches/server/0005-Avoid-allocating-an-iterator-in-getEffectiveRange-if.patch new file mode 100644 index 0000000..f07fb3f --- /dev/null +++ b/patches/server/0005-Avoid-allocating-an-iterator-in-getEffectiveRange-if.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Sun, 22 Oct 2023 12:47:38 -0300 +Subject: [PATCH] Avoid allocating an iterator in getEffectiveRange if the + entity does not have any passengers + + +diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java +index 28c6ec04750daca3d77a0cee2b9f17f2508662cc..841e2458548aa7ba3e29e693161f31f17344dfbe 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +@@ -1332,6 +1332,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + + private int getEffectiveRange() { + int i = this.range; ++ if (this.entity.passengers.isEmpty()) return this.scaledRange(i); // SparklyPaper - Avoid allocating an iterator if the entity does not have any passengers ++ + Iterator iterator = this.entity.getIndirectPassengers().iterator(); + + while (iterator.hasNext()) {