mirror of
https://github.com/SparklyPower/SparklyPaper.git
synced 2025-12-19 15:09:27 +00:00
More performance optimizations and patches
This commit is contained in:
@@ -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
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index a79461457ea19339f47572c70705d655ebc55276..768a691649d9146c7c975a3b25258551d0b6df0a 100644
|
index a79461457ea19339f47572c70705d655ebc55276..d43c3f2e17f9ef48ec458f9c94478cfd02db6edb 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -3,6 +3,8 @@ import io.papermc.paperweight.util.*
|
@@ -3,6 +3,8 @@ import io.papermc.paperweight.util.*
|
||||||
@@ -17,7 +17,7 @@ index a79461457ea19339f47572c70705d655ebc55276..768a691649d9146c7c975a3b25258551
|
|||||||
id("com.github.johnrengelman.shadow")
|
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
|
val alsoShade: Configuration by configurations.creating
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -25,6 +25,7 @@ index a79461457ea19339f47572c70705d655ebc55276..768a691649d9146c7c975a3b25258551
|
|||||||
- implementation(project(":paper-mojangapi"))
|
- implementation(project(":paper-mojangapi"))
|
||||||
+ // SparklyPaper start
|
+ // SparklyPaper start
|
||||||
+ implementation(project(":sparklypaper-api"))
|
+ implementation(project(":sparklypaper-api"))
|
||||||
|
+ implementation(kotlin("reflect"))
|
||||||
+ implementation("io.papermc.paper:paper-mojangapi:1.20.2-R0.1-SNAPSHOT") {
|
+ implementation("io.papermc.paper:paper-mojangapi:1.20.2-R0.1-SNAPSHOT") {
|
||||||
+ exclude("io.papermc.paper", "paper-api")
|
+ exclude("io.papermc.paper", "paper-api")
|
||||||
+ }
|
+ }
|
||||||
@@ -34,7 +35,7 @@ index a79461457ea19339f47572c70705d655ebc55276..768a691649d9146c7c975a3b25258551
|
|||||||
// Paper start
|
// Paper start
|
||||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||||
@@ -70,7 +78,7 @@ tasks.jar {
|
@@ -70,7 +79,7 @@ tasks.jar {
|
||||||
attributes(
|
attributes(
|
||||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||||
"Implementation-Title" to "CraftBukkit",
|
"Implementation-Title" to "CraftBukkit",
|
||||||
@@ -43,7 +44,7 @@ index a79461457ea19339f47572c70705d655ebc55276..768a691649d9146c7c975a3b25258551
|
|||||||
"Implementation-Vendor" to date, // Paper
|
"Implementation-Vendor" to date, // Paper
|
||||||
"Specification-Title" to "Bukkit",
|
"Specification-Title" to "Bukkit",
|
||||||
"Specification-Version" to project.version,
|
"Specification-Version" to project.version,
|
||||||
@@ -154,7 +162,7 @@ fun TaskContainer.registerRunTask(
|
@@ -154,7 +163,7 @@ fun TaskContainer.registerRunTask(
|
||||||
name: String,
|
name: String,
|
||||||
block: JavaExec.() -> Unit
|
block: JavaExec.() -> Unit
|
||||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: MrPowerGamerBR <git@mrpowergamerbr.com>
|
||||||
|
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<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
|
||||||
|
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> 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;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: MrPowerGamerBR <git@mrpowergamerbr.com>
|
||||||
|
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()) {
|
||||||
Reference in New Issue
Block a user